Files
Mycelium-ui-private/src-tauri/src/lib.rs
syoul 95e7cb4bd3 P3: routes (selected, fallback, queried)
Backend
- api/routes.rs models the Babel-style route shape; metric uses an
  untagged enum to round-trip both numeric hop counts and the
  literal "infinite" string the daemon emits for poisoned routes
- routes_snapshot() runs the three GETs concurrently with try_join
  so the snapshot is internally consistent
- poller spawns a second 5s loop emitting routes://updated; both
  loops are owned by the Poller and aborted together on stop_daemon

Frontend
- routes store mirrors the snapshot shape; tabbed view (radix-vue)
  with selected, fallback and queried lists
- RouteTable component shared by selected/fallback; metric column
  is colour-coded (0 green, low neutral, high yellow, infinite red)
- Queried subnets show a live `expires in 12s` countdown driven by
  a 1Hz tick ref instead of mutating the store
2026-04-25 23:02:32 +02:00

47 lines
1.3 KiB
Rust

pub mod api;
pub mod commands;
pub mod elevation;
pub mod error;
pub mod poller;
pub mod sidecar;
pub mod state;
use state::AppState;
use tauri::Manager;
use tracing_subscriber::EnvFilter;
pub fn run() {
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
)
.with_target(false)
.compact()
.try_init()
.ok();
tauri::Builder::default()
.plugin(tauri_plugin_log::Builder::new().build())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_dialog::init())
.setup(|app| {
app.manage(AppState::new());
Ok(())
})
.invoke_handler(tauri::generate_handler![
commands::daemon_status,
commands::start_daemon,
commands::stop_daemon,
commands::node_info,
commands::sidecar_logs,
commands::peers_list,
commands::peer_add,
commands::peer_remove,
commands::peers_stats,
commands::routes_snapshot,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}