From a864953d1a42509040ec0c2694a4f3f6f9205adb Mon Sep 17 00:00:00 2001
From: Mud <44410798+MudDev@users.noreply.github.com>
Date: Thu, 2 Jul 2026 15:21:17 -0700
Subject: [PATCH] feat(Sidebar): add the missing panel sections and controls
The sidebar was a stripped subset. Added the sections whose ws commands already
work, matching the ids the bundled Sidebar JS binds to:
- Peers: "Copy to clipboard" link (#link-copypeers).
- Optional files: downloaded/total bar + the "download and help distribute all
files" toggle (#checkbox-autodownloadoptional).
- Needs-to-be-updated: bad-files count.
- Database: Reload / Rebuild (#button-dbreload / #button-dbrebuild).
- Identity: a Change link (#button-identity).
- Site control: Favourite/Unfavourite and Pause/Resume (shown by state, the JS
toggles the paired button), plus a Show-directory link (#link-directory).
All wired to the Tier-1 handlers (siteFavourite, siteResume,
siteSetAutodownloadoptional, dbReload/dbRebuild, serverShowdirectory). Test
extended to assert the new controls and their state-driven hidden classes.
Desktop and mobile builds green; full suite green.
---
crates/epix-plugins/src/sidebar.rs | 87 ++++++++++++++++++++++++++----
1 file changed, 78 insertions(+), 9 deletions(-)
diff --git a/crates/epix-plugins/src/sidebar.rs b/crates/epix-plugins/src/sidebar.rs
index 7246c16..504ef70 100644
--- a/crates/epix-plugins/src/sidebar.rs
+++ b/crates/epix-plugins/src/sidebar.rs
@@ -134,6 +134,13 @@ fn render_sidebar(address: &str, info: &Value, counts: PeerCounts, recv: u64, se
let size_limit = info["size_limit"].as_i64().unwrap_or(10);
let auth_address = info["auth_address"].as_str().unwrap_or("");
let cert_user_id = info["cert_user_id"].as_str();
+ let serving = info["settings"]["serving"].as_bool().unwrap_or(true);
+ let favorite = info["settings"]["favorite"].as_bool().unwrap_or(false);
+ let autodownload = info["settings"]["autodownloadoptional"].as_bool().unwrap_or(false);
+ let size_optional = info["settings"]["size_optional"].as_i64().unwrap_or(0);
+ let optional_downloaded = info["settings"]["optional_downloaded"].as_i64().unwrap_or(0);
+ let bad_files = info["settings"]["cache"]["bad_files"].as_object().map(|m| m.len()).unwrap_or(0);
+ let hidden = |cond: bool| if cond { "hidden" } else { "" };
let total = counts.total as f64;
let recv_mb = recv as f64 / 1024.0 / 1024.0;
@@ -149,7 +156,8 @@ fn render_sidebar(address: &str, info: &Value, counts: PeerCounts, recv: u64, se
// Peers
b.push_str(&format!(
- "
\
+ "
\
\
\
\
@@ -213,23 +221,68 @@ fn render_sidebar(address: &str, info: &Value, counts: PeerCounts, recv: u64, se
Set
",
));
+ // Optional files (only when the site declares any).
+ if size_optional > 0 {
+ let opt_mb = size_optional as f64 / 1024.0 / 1024.0;
+ let opt_dl_mb = optional_downloaded as f64 / 1024.0 / 1024.0;
+ b.push_str(&format!(
+ "