summaryrefslogtreecommitdiffstats
path: root/webd
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-08 03:32:24 +0100
committersalmonik <salmonik@tuta.io>2026-11-08 03:32:24 +0100
commitfda24c47a8262388ada92722850a362da65aaa6e (patch)
tree13363fa1461ae4e10087acba562a527b8bde4228 /webd
parentv5.0.0: protocol v5 and the browser frontend (diff)
downloadzagan-bet-fda24c47a8262388ada92722850a362da65aaa6e.tar.gz
zagan-bet-fda24c47a8262388ada92722850a362da65aaa6e.zip
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.
Diffstat (limited to '')
-rw-r--r--webd/src/session.rs7
-rw-r--r--webd/zagan-bet-webd.service20
2 files changed, 26 insertions, 1 deletions
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 {
575 let id = "a".repeat(64); 575 let id = "a".repeat(64);
576 assert_eq!( 576 assert_eq!(
577 cookie_id(&format!("other=1; {COOKIE_NAME}={id}; theme=dark")), 577 cookie_id(&format!("other=1; {COOKIE_NAME}={id}; theme=dark")),
578 Some(id) 578 Some(id.clone())
579 );
580 assert_eq!(
581 cookie_id(&format!("{HOST_COOKIE_NAME}={id}")),
582 Some(id),
583 "the secure __Host- name is accepted"
579 ); 584 );
580 assert_eq!(cookie_id(&format!("{COOKIE_NAME}=short")), None); 585 assert_eq!(cookie_id(&format!("{COOKIE_NAME}=short")), None);
581 assert_eq!(cookie_id("other=1"), None); 586 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 @@
1[Unit]
2Description=zagan-bet browser gateway
3After=network-online.target
4Wants=network-online.target
5
6[Service]
7Type=simple
8User=zagan
9Group=zagan
10EnvironmentFile=/etc/zagan-bet-webd.env
11ExecStart=/usr/local/bin/zagan-bet-webd
12Restart=on-failure
13RestartSec=2
14NoNewPrivileges=true
15PrivateTmp=true
16ProtectSystem=strict
17ProtectHome=true
18
19[Install]
20WantedBy=multi-user.target