summaryrefslogtreecommitdiffstats
path: root/src/bin/client/connection.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-08 03:29:35 +0100
committersalmonik <salmonik@tuta.io>2026-11-08 03:29:35 +0100
commit058432130628d00764663ecf819a9adc6793768d (patch)
treed3f49f111fbfaa48647cca2600adcf9017af2d30 /src/bin/client/connection.rs
parentweb: serve latest.php through PHP and refuse stray PHP files (diff)
downloadzagan-bet-058432130628d00764663ecf819a9adc6793768d.tar.gz
zagan-bet-058432130628d00764663ecf819a9adc6793768d.zip
v5.0.0: protocol v5 and the browser frontend
Protocol v5 replaces newline lines with bounded [u32 len][text] frames and REQ/RES/EVT envelopes. Requests carry correlation ids and the server replays the last 256 replies per connection, so a gateway retry cannot double-debit and a late reply cannot clobber a newer request. HELLO/PONG carry server time; crash rounds announce started_at and push coalesced 10 Hz ticks. Crash now commits sha256(seed) before a round and reveals the seed when it ends, so clients recompute the crash point. Adds the webd/ gateway: one blocking thread, one ClientCore and one pinned upstream TLS connection per session, an HttpOnly session cookie, takeover, and a 60-second grace window. The browser sends Command JSON and renders View JSON; it never speaks the game protocol or stores credentials. Adds the vanilla TypeScript browser app at /play/ (login, lobby, all four games, history, notices, crash verification), the nginx /play and /ws routes, and the headless DOM smoke test. webd and the app stay out of the TUI/GUI/server build graph. The client/server version moves to 5.0.0 in lockstep; v4 peers are refused at HELLO.
Diffstat (limited to 'src/bin/client/connection.rs')
-rw-r--r--src/bin/client/connection.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/client/connection.rs b/src/bin/client/connection.rs
index f88f62b..e808d90 100644
--- a/src/bin/client/connection.rs
+++ b/src/bin/client/connection.rs
@@ -8,7 +8,7 @@ use parking_lot::Mutex;
8use std::error::Error; 8use std::error::Error;
9use zagan_bet::client::transport::{self, TrustPrompt}; 9use zagan_bet::client::transport::{self, TrustPrompt};
10use zagan_bet::client::ui::first_contact_lines; 10use zagan_bet::client::ui::first_contact_lines;
11use zagan_bet::version::{is_newer, VERSION}; 11use zagan_bet::version::{VERSION, is_newer};
12 12
13pub use zagan_bet::client::transport::TlsStream; 13pub use zagan_bet::client::transport::TlsStream;
14 14
@@ -21,7 +21,7 @@ pub fn set_unsafe_mode(unsafe_mode: bool) {
21pub fn connect( 21pub fn connect(
22 addr: &str, 22 addr: &str,
23 conn: &rusqlite::Connection, 23 conn: &rusqlite::Connection,
24) -> Result<(TlsStream, Option<String>), Box<dyn Error>> { 24) -> Result<(TlsStream, Option<String>, u64), Box<dyn Error>> {
25 let unsafe_mode = *UNSAFE_MODE.lock(); 25 let unsafe_mode = *UNSAFE_MODE.lock();
26 26
27 // The terminal has no dialog: print the first-contact notice and trust. 27 // The terminal has no dialog: print the first-contact notice and trust.
@@ -53,5 +53,5 @@ pub fn connect(
53 println!("Authentication failed: {error}"); 53 println!("Authentication failed: {error}");
54 } 54 }
55 55
56 Ok((connected.stream, connected.user)) 56 Ok((connected.stream, connected.user, connected.server_time))
57} 57}