diff --git a/src/web/sse.rs b/src/web/sse.rs index 0e6c207..553e49c 100644 --- a/src/web/sse.rs +++ b/src/web/sse.rs @@ -119,6 +119,10 @@ fn render_sse_payload( webdav_running: status.webdav_running, }; + let sync_status = SyncStatusPartial { + all_synced: status.all_synced, + }; + let mut html = String::new(); // Primary target: dashboard stats if let Ok(s) = stats.render() { @@ -132,6 +136,10 @@ fn render_sse_payload( if let Ok(s) = badges.render() { html.push_str(&s); } + // OOB: sync status indicator + if let Ok(s) = sync_status.render() { + html.push_str(&s); + } html } @@ -205,3 +213,9 @@ struct ProtocolBadgesPartial { nfs_exported: bool, webdav_running: bool, } + +#[derive(Template)] +#[template(path = "web/partials/sync_status.html")] +struct SyncStatusPartial { + all_synced: bool, +} diff --git a/templates/web/partials/sync_status.html b/templates/web/partials/sync_status.html new file mode 100644 index 0000000..d2e9133 --- /dev/null +++ b/templates/web/partials/sync_status.html @@ -0,0 +1,13 @@ +{% if all_synced %} +
+ + 已全部同步 — 可以断网 + All synced — safe to disconnect +
+{% else %} +
+ + 同步进行中 — 请勿断网 + Sync in progress — do not disconnect +
+{% endif %}