diff --git a/src/main.rs b/src/main.rs index f6a4798..06ea57d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,8 @@ use std::{ sync::{Arc, RwLock}, }; +#[derive(Serialize, Clone)] +#[serde(crate = "rocket::serde")] enum TrackedState { Conscrit { invisible: bool, @@ -172,8 +174,10 @@ struct TrackedInfo { #[serde(crate = "rocket::serde")] struct AdminTrackedInfo { name: String, + id: String, pos: (f32, f32), color: u8, + state: TrackedState, } impl From for TrackedInfo { @@ -197,8 +201,10 @@ fn base_view(team: &Tracked) -> TrackedInfo { fn admin_view(team: &Tracked) -> AdminTrackedInfo { AdminTrackedInfo { name: team.name.clone(), + id: team.id.clone(), pos: team.pos, color: team.state.admin_color(), + state: team.state.clone(), } } @@ -237,8 +243,13 @@ fn apparent_info(watcher: &Tracked, team: &Tracked) -> Option { } } -#[get("/track/?")] -fn tracked_view(id: &str, gpslog: Option, tracking: &State) -> Option