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. --- webd/src/session.rs | 7 ++++++- webd/zagan-bet-webd.service | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 webd/zagan-bet-webd.service (limited to 'webd') diff --git a/webd/src/session.rs b/webd/src/session.rs index 8a20721..3b34f47 100644 --- a/webd/src/session.rs +++ b/webd/src/session.rs @@ -575,7 +575,12 @@ mod tests { let id = "a".repeat(64); assert_eq!( cookie_id(&format!("other=1; {COOKIE_NAME}={id}; theme=dark")), - Some(id) + Some(id.clone()) + ); + assert_eq!( + cookie_id(&format!("{HOST_COOKIE_NAME}={id}")), + Some(id), + "the secure __Host- name is accepted" ); assert_eq!(cookie_id(&format!("{COOKIE_NAME}=short")), None); assert_eq!(cookie_id("other=1"), None); diff --git a/webd/zagan-bet-webd.service b/webd/zagan-bet-webd.service new file mode 100644 index 0000000..58bec71 --- /dev/null +++ b/webd/zagan-bet-webd.service @@ -0,0 +1,20 @@ +[Unit] +Description=zagan-bet browser gateway +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=zagan +Group=zagan +EnvironmentFile=/etc/zagan-bet-webd.env +ExecStart=/usr/local/bin/zagan-bet-webd +Restart=on-failure +RestartSec=2 +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3