From 408fac5c545c4294c81df5fff36b2fed19d7fe55 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 8 Nov 2026 03:34:38 +0100 Subject: web: restore the balance on a refresh into history The gateway hello now carries the core's last known balance alongside the user, so a refresh on a non-game view does not blank the header before the next INFO reply. --- web/play/src/main.ts | 1 + web/play/src/types.ts | 2 ++ 2 files changed, 3 insertions(+) (limited to 'web/play/src') diff --git a/web/play/src/main.ts b/web/play/src/main.ts index f051429..2dd3ce9 100644 --- a/web/play/src/main.ts +++ b/web/play/src/main.ts @@ -68,6 +68,7 @@ const gateway = new Gateway(wsUrl, { onHello(hello) { serverOffset = hello.time - Date.now(); currentUser = hello.user ?? null; + if (typeof hello.balance === "number") lastBalance = hello.balance; gameBadge.textContent = `v${hello.version}`; }, onView(next) { diff --git a/web/play/src/types.ts b/web/play/src/types.ts index e594a0b..ae2c4c7 100644 --- a/web/play/src/types.ts +++ b/web/play/src/types.ts @@ -9,6 +9,8 @@ export type Hello = { grace_seconds: number; /** Signed-in user restored after a refresh, if any. */ user?: string | null; + /** Last known balance, for views that do not carry one. */ + balance?: number | null; /** Estimated game-server Unix time in milliseconds. */ time: number; }; -- cgit v1.2.3