feat(server): persist activity history on the server and expose it to the dashboard UI via /api/activity instead of relying on fragile localStorage

This commit is contained in:
Riz Ashraf committed 2026-09-21 18:01:21 +01:00
1 parent bf7bf48163
commit ae0ea9ab22
4 files changed
+83 -41

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
--- server/src/main.rs
+++ server/src/main.rs
@@ -225,6 +225,20 @@
next_id: AtomicUsize::new(1),
});
+ let app_state_clone = Arc::clone(&app_state);
+ let mut rx = state.activity_tx.subscribe();
+ tokio::spawn(async move {
+ while let Ok(msg) = rx.recv().await {
+ let senders: Vec<_> = app_state_clone
+ .clients
+ .read()
+ .unwrap_or_else(|e| e.into_inner())
+ .values()
+ .cloned()
+ .collect();
+ for client_tx in senders {
+ let _ = client_tx.try_send(msg.clone());
+ }
+ }
+ });
+
let app = Router::new()
.route(