Add a banner to indicate updates in progress

This commit is contained in:
khalid@traclabs.com
2026-04-23 08:34:47 -05:00
parent 4e014fa648
commit 46247b7733
3 changed files with 86 additions and 1 deletions

View File

@@ -43,3 +43,22 @@ export function broadcastReload(reason: string, data?: Record<string, unknown>):
}
}
export type UpdateStatusPhase = 'request_received' | 'update_started' | 'update_done';
export function broadcastUpdateStatus(phase: UpdateStatusPhase, data?: Record<string, unknown>): void {
if (!wss) return;
const payload = JSON.stringify({
type: 'update_status',
ts: Date.now(),
phase,
...data,
});
for (const client of wss.clients) {
if (client.readyState === client.OPEN) {
client.send(payload);
}
}
}