feat: add periodic tray menu refresh and normalize tunnel metrics field names

Add background task to refresh tray menu every 5 seconds to keep status display current. Add RawTunnelMetrics type and normalizeTunnelMetrics helper to handle both snake_case and camelCase field names from backend responses. Update refreshTunnelMetrics to normalize metrics before setting state and explicitly cast active status to boolean.
This commit is contained in:
2026-03-18 10:04:55 +01:00
parent 184192e1c2
commit 0fcea99006
2 changed files with 26 additions and 2 deletions

View File

@@ -665,6 +665,14 @@ pub fn run() {
});
refresh_tray_menu(app.handle());
let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
loop {
refresh_tray_menu(&app_handle);
tauri::async_runtime::sleep(std::time::Duration::from_secs(5)).await;
}
});
Ok(())
})
.on_window_event(|window, event| match event {