From fda24c47a8262388ada92722850a362da65aaa6e Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 8 Nov 2026 03:32:24 +0100 Subject: web: accept the serialized reels array and stop game loops on navigation The Rust SlotsView serializes reels as an array of chars, so the browser joins it instead of String(array). The crash chart, reel animation and roulette observer now stop when another screen takes over, and a returning crash screen rebuilds its detached canvas. Action buttons ignore a double click before the server view arrives. Also tightens the gateway session registry with a generation token, caps WebSocket messages at 64 KiB, uses the __Host- cookie prefix on HTTPS, and ships the systemd unit. --- web/play/src/main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/play/src/main.ts') diff --git a/web/play/src/main.ts b/web/play/src/main.ts index fd55250..f051429 100644 --- a/web/play/src/main.ts +++ b/web/play/src/main.ts @@ -1,10 +1,10 @@ import { byId, money, node, sha256Hex, toast, toneFor } from "./dom"; import { Gateway } from "./net"; import { renderBlackjack } from "./blackjack"; -import { renderCrash } from "./crash"; +import { renderCrash, stopCrashAnimation } from "./crash"; import { renderHistory } from "./history"; import { renderRoulette } from "./roulette"; -import { renderSlots } from "./slots"; +import { renderSlots, stopSlotsAnimation } from "./slots"; import type { View } from "./types"; const authScreen = byId("auth-screen"); @@ -72,6 +72,8 @@ const gateway = new Gateway(wsUrl, { }, onView(next) { view = next; + if (next.screen !== "slots") stopSlotsAnimation(); + if (next.screen !== "crash") stopCrashAnimation(); // Game and history views carry no account field; the lobby is the source // of truth for who is signed in. A null lobby user is a logout or an // expired session. -- cgit v1.2.3