diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 22:55:49 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 22:55:49 +0100 |
| commit | 49df948de25d28601469e9ca993f33530989ebd0 (patch) | |
| tree | 291aae0f57d0d7d12a27eb28038e43f942d6b991 /src/bin/client | |
| parent | v2.4.0: key stored credentials by certificate fingerprint (diff) | |
| download | zagan-bet-49df948de25d28601469e9ca993f33530989ebd0.tar.gz zagan-bet-49df948de25d28601469e9ca993f33530989ebd0.zip | |
v3.0.0: cursor-driven roulette felt with splits and corners; drop schema migrations; require 80x24
Diffstat (limited to '')
| -rw-r--r-- | src/bin/client/connection.rs | 2 | ||||
| -rw-r--r-- | src/bin/client/main.rs | 15 | ||||
| -rw-r--r-- | src/bin/client/repl.rs | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/bin/client/connection.rs b/src/bin/client/connection.rs index ec5642c..7516836 100644 --- a/src/bin/client/connection.rs +++ b/src/bin/client/connection.rs | |||
| @@ -49,7 +49,7 @@ pub fn connect( | |||
| 49 | Ok(Ok((tls, fp))) => (tls, fp), | 49 | Ok(Ok((tls, fp))) => (tls, fp), |
| 50 | Ok(Err(e)) => return Err(Box::new(TrustError(format!("{e}")))), | 50 | Ok(Err(e)) => return Err(Box::new(TrustError(format!("{e}")))), |
| 51 | Err(mpsc::RecvTimeoutError::Timeout) => { | 51 | Err(mpsc::RecvTimeoutError::Timeout) => { |
| 52 | return Err("Connection timed out after 3 seconds".into()); | 52 | return Err("Connection timed out after 10 seconds".into()); |
| 53 | } | 53 | } |
| 54 | Err(_) => return Err("Connection attempt failed".into()), | 54 | Err(_) => return Err("Connection attempt failed".into()), |
| 55 | }; | 55 | }; |
diff --git a/src/bin/client/main.rs b/src/bin/client/main.rs index 1b701d8..9018026 100644 --- a/src/bin/client/main.rs +++ b/src/bin/client/main.rs | |||
| @@ -10,6 +10,21 @@ fn main() { | |||
| 10 | let args: Vec<String> = std::env::args().collect(); | 10 | let args: Vec<String> = std::env::args().collect(); |
| 11 | let unsafe_mode = args.iter().any(|arg| arg == "--unsafe"); | 11 | let unsafe_mode = args.iter().any(|arg| arg == "--unsafe"); |
| 12 | 12 | ||
| 13 | // Every game board is drawn in place, so refuse a terminal that cannot fit | ||
| 14 | // them before touching the network or the terminal mode. | ||
| 15 | let size = crossterm::terminal::size(); | ||
| 16 | let (columns, rows) = match &size { | ||
| 17 | Ok((columns, rows)) => (*columns, *rows), | ||
| 18 | Err(_) => (0, 0), | ||
| 19 | }; | ||
| 20 | if let Some(message) = zagan_bet::client::ui::terminal_too_small(columns, rows) { | ||
| 21 | eprintln!("{message}"); | ||
| 22 | if size.is_err() { | ||
| 23 | eprintln!("Could not read the terminal size (is this a real terminal?)."); | ||
| 24 | } | ||
| 25 | std::process::exit(1); | ||
| 26 | } | ||
| 27 | |||
| 13 | if unsafe_mode { | 28 | if unsafe_mode { |
| 14 | println!("WARNING: Running in UNSAFE mode - certificate verification disabled!"); | 29 | println!("WARNING: Running in UNSAFE mode - certificate verification disabled!"); |
| 15 | } | 30 | } |
diff --git a/src/bin/client/repl.rs b/src/bin/client/repl.rs index d973596..2cf121d 100644 --- a/src/bin/client/repl.rs +++ b/src/bin/client/repl.rs | |||
| @@ -712,6 +712,8 @@ fn map_key(key: crossterm::event::KeyEvent) -> Option<Key> { | |||
| 712 | KeyCode::Backspace => Some(Key::Backspace), | 712 | KeyCode::Backspace => Some(Key::Backspace), |
| 713 | KeyCode::Up => Some(Key::Up), | 713 | KeyCode::Up => Some(Key::Up), |
| 714 | KeyCode::Down => Some(Key::Down), | 714 | KeyCode::Down => Some(Key::Down), |
| 715 | KeyCode::Left => Some(Key::Left), | ||
| 716 | KeyCode::Right => Some(Key::Right), | ||
| 715 | KeyCode::Tab => Some(Key::Tab), | 717 | KeyCode::Tab => Some(Key::Tab), |
| 716 | KeyCode::Esc => Some(Key::Esc), | 718 | KeyCode::Esc => Some(Key::Esc), |
| 717 | _ => None, | 719 | _ => None, |
