Add active/inactive/game-time timers to fleet + server pages

Fleet cards and the per-server detail hero now show three live-ticking
timers: Active (since players > 0), Inactive (since server emptied), and
Game (since InitGame in games_sp.log, back-computed from the log's own
MM:SS prefix so it stays accurate across restarts). Anchors are
persisted on `servers` and fanned out via the SSE bus; a single 1s
ticker feeds every card. Idle map cycles are filtered out so the game
timer doesn't flicker.
This commit is contained in:
2026-09-13 21:45:54 -04:00
parent 79b2ba1464
commit 3d111880d3
11 changed files with 403 additions and 13 deletions
+9 -1
View File
@@ -84,6 +84,10 @@ export interface ServerRow {
image: string | null;
created_by: string | null;
destroyed_at: string | null;
active_since: string | null;
inactive_since: string | null;
game_started_at: string | null;
game_ended_at: string | null;
created_at: string;
}
@@ -169,7 +173,11 @@ export function setServerField(
'game_id',
'image',
'created_by',
'destroyed_at'
'destroyed_at',
'active_since',
'inactive_since',
'game_started_at',
'game_ended_at'
];
if (!allowed.includes(field)) throw new Error(`refusing to set ${field}`);
db().prepare(`UPDATE servers SET ${field} = ? WHERE name = ?`).run(value, name);