diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-08 03:38:48 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-08 03:38:48 +0100 |
| commit | 10bd35e6b6d34d58b93700b498609926aa5d90ba (patch) | |
| tree | 3b3978a5a41f81c1750cc9ee3255a1fbd0a19a49 /webd | |
| parent | web: show the account number and stop reel spin on an error (diff) | |
| download | zagan-bet-10bd35e6b6d34d58b93700b498609926aa5d90ba.tar.gz zagan-bet-10bd35e6b6d34d58b93700b498609926aa5d90ba.zip | |
web: link the GPL source from the play page; normalise gateway config
The browser footer links the public repository. ZAGAN_WEB_ORIGIN is lowercased for origin matching, and the pinned fingerprint accepts the colon-separated form operators often copy.
Diffstat (limited to 'webd')
| -rw-r--r-- | webd/src/config.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/webd/src/config.rs b/webd/src/config.rs index d3ada8f..44ce4ec 100644 --- a/webd/src/config.rs +++ b/webd/src/config.rs | |||
| @@ -34,11 +34,14 @@ impl Config { | |||
| 34 | if !origin.starts_with("http://") && !origin.starts_with("https://") { | 34 | if !origin.starts_with("http://") && !origin.starts_with("https://") { |
| 35 | return Err("ZAGAN_WEB_ORIGIN must start with http:// or https://".to_string()); | 35 | return Err("ZAGAN_WEB_ORIGIN must start with http:// or https://".to_string()); |
| 36 | } | 36 | } |
| 37 | let origin = origin.trim_end_matches('/').to_string(); | 37 | let origin = origin.trim_end_matches('/').to_ascii_lowercase(); |
| 38 | 38 | ||
| 39 | let upstream = value("ZAGAN_UPSTREAM", DEFAULT_UPSTREAM); | 39 | let upstream = value("ZAGAN_UPSTREAM", DEFAULT_UPSTREAM); |
| 40 | let fingerprint = required("ZAGAN_UPSTREAM_FINGERPRINT")?; | 40 | let fingerprint = required("ZAGAN_UPSTREAM_FINGERPRINT")?; |
| 41 | let fingerprint = fingerprint.trim().to_ascii_lowercase(); | 41 | let fingerprint = fingerprint |
| 42 | .trim() | ||
| 43 | .replace([':', ' ', '-'], "") | ||
| 44 | .to_ascii_lowercase(); | ||
| 42 | if fingerprint.len() != 64 || !fingerprint.bytes().all(|byte| byte.is_ascii_hexdigit()) { | 45 | if fingerprint.len() != 64 || !fingerprint.bytes().all(|byte| byte.is_ascii_hexdigit()) { |
| 43 | return Err( | 46 | return Err( |
| 44 | "ZAGAN_UPSTREAM_FINGERPRINT must be the 64-character SHA-256 of the upstream SPKI" | 47 | "ZAGAN_UPSTREAM_FINGERPRINT must be the 64-character SHA-256 of the upstream SPKI" |
