Compare commits
No commits in common. "eb59bd978cf33a153e7094f21f9f2aa03182fbe7" and "f5bbfe171d3cc17fbc5633546ba68ab89cd9b1f8" have entirely different histories.
eb59bd978c
...
f5bbfe171d
323
Cargo.lock
generated
323
Cargo.lock
generated
@ -173,12 +173,6 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.4"
|
||||
@ -256,12 +250,43 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
dependencies = [
|
||||
"foreign-types-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
@ -329,10 +354,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -342,11 +365,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasi 0.14.2+wasi-0.2.4",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -463,7 +484,22 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tower-service",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -484,7 +520,7 @@ dependencies = [
|
||||
"libc",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"socket2 0.6.0",
|
||||
"socket2",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
@ -658,6 +694,12 @@ version = "0.2.175"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.8.0"
|
||||
@ -680,12 +722,6 @@ version = "0.4.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "lru-slab"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
version = "0.8.4"
|
||||
@ -724,6 +760,23 @@ dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.7"
|
||||
@ -739,6 +792,50 @@ version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"openssl-macros",
|
||||
"openssl-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.4"
|
||||
@ -780,6 +877,12 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "potential_utf"
|
||||
version = "0.1.2"
|
||||
@ -807,61 +910,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn"
|
||||
version = "0.11.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cfg_aliases",
|
||||
"pin-project-lite",
|
||||
"quinn-proto",
|
||||
"quinn-udp",
|
||||
"rustc-hash",
|
||||
"rustls",
|
||||
"socket2 0.5.10",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn-proto"
|
||||
version = "0.11.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"getrandom 0.3.3",
|
||||
"lru-slab",
|
||||
"rand",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"slab",
|
||||
"thiserror",
|
||||
"tinyvec",
|
||||
"tracing",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn-udp"
|
||||
version = "0.5.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcebb1209ee276352ef14ff8732e24cc2b02bbac986cd74a4c81bcb2f9881970"
|
||||
dependencies = [
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"socket2 0.5.10",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.40"
|
||||
@ -931,21 +979,21 @@ dependencies = [
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-rustls",
|
||||
"hyper-tls",
|
||||
"hyper-util",
|
||||
"js-sys",
|
||||
"log",
|
||||
"mime",
|
||||
"native-tls",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"quinn",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-native-tls",
|
||||
"tower",
|
||||
"tower-http",
|
||||
"tower-service",
|
||||
@ -953,7 +1001,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -977,10 +1024,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
name = "rustix"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
@ -989,7 +1043,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"subtle",
|
||||
@ -1002,7 +1055,6 @@ version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79"
|
||||
dependencies = [
|
||||
"web-time",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@ -1029,12 +1081,44 @@ version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.219"
|
||||
@ -1127,16 +1211,6 @@ version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.0"
|
||||
@ -1211,6 +1285,19 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.3.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.15"
|
||||
@ -1241,21 +1328,6 @@ dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec_macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.47.1"
|
||||
@ -1271,7 +1343,7 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"socket2 0.6.0",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
@ -1287,6 +1359,16 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-native-tls"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
|
||||
dependencies = [
|
||||
"native-tls",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.26.2"
|
||||
@ -1452,6 +1534,12 @@ version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
@ -1563,25 +1651,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-time"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.3"
|
||||
|
49
index.html
49
index.html
@ -3,7 +3,6 @@
|
||||
<!--
|
||||
IDEAS:
|
||||
- Achievements (i.e. "take a train which is delayed by at least 60 minutes" xd)
|
||||
- Bonus bei Verspätung, Gesamtverspätung sammeln
|
||||
- Show a map in the end (no need for world map, just use coordinates on flat black rectangle)
|
||||
-->
|
||||
<head>
|
||||
@ -23,12 +22,7 @@ body {
|
||||
background: light-dark(#ECE, #000);
|
||||
}
|
||||
|
||||
.DraggingTop {
|
||||
z-index: 15;
|
||||
}
|
||||
|
||||
#Header {
|
||||
z-index: 5;
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
display: flex;
|
||||
@ -277,7 +271,6 @@ function draggingOnDown(x, y, e) {
|
||||
if (isInGame) return;
|
||||
if (draggingElement !== null) return;
|
||||
draggingElement = e;
|
||||
draggingElement.classList.add("DraggingTop");
|
||||
draggingStartPos = [x, y];
|
||||
}
|
||||
function draggingOnMove(x, y) {
|
||||
@ -290,7 +283,6 @@ function draggingOnMove(x, y) {
|
||||
}
|
||||
function draggingOnUp(x, y) {
|
||||
if (draggingElement === null) return;
|
||||
draggingElement.classList.remove("DraggingTop");
|
||||
if (!isInGame) {
|
||||
if (draggingEndCallback) draggingEndCallback(x, y);
|
||||
}
|
||||
@ -474,17 +466,8 @@ function hideFocusDeparturePanel() {
|
||||
}
|
||||
domFocusedDeparturePanelCloseClickable.addEventListener("click", hideFocusDeparturePanel);
|
||||
|
||||
async function goInGame() {
|
||||
function goInGame() {
|
||||
isInGame = true;
|
||||
// make server get all eva numbers of the destination station
|
||||
let testDestinationDepartures = await (await fetch("./query_departures/" + encodeURIComponent(transportModesInteger) + "/" + encodeURIComponent(stationDestination.evaNumber) + "/")).json();
|
||||
if (testDestinationDepartures[1].length < 10) {
|
||||
if (!window.confirm("Warning: Low activity (" + testDestinationDepartures[1].length + ") at the specified destination. It may not be possible to win.")) {
|
||||
isInGame = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
stationDestination.relatedEvaNumbers = testDestinationDepartures[0];
|
||||
for (const elem of draggableElements) elem.style.cursor = "default";
|
||||
draggableElements = new Array();
|
||||
domWelcome.style.display = "none";
|
||||
@ -497,23 +480,20 @@ domStartGameButton.onclick = () => goInGame();
|
||||
async function reloadDepartures() {
|
||||
domDeparturesList.replaceChildren();
|
||||
hideFocusDeparturePanel();
|
||||
if (stationDestination.evaNumber === stationCurrent.evaNumber || (stationDestination.relatedEvaNumbers && stationDestination.relatedEvaNumbers.includes(stationCurrent.evaNumber))) {
|
||||
endGameWin();
|
||||
let currentEvaNumber = stationCurrent.evaNumber;
|
||||
if (currentEvaNumber === stationDestination.evaNumber) {
|
||||
// TODO: obv
|
||||
alert("You won! Unfortunately, i haven't made a screen for that yet...");
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
let response = await fetch("./query_departures/" + encodeURIComponent(transportModesInteger) + "/" + encodeURIComponent(stationCurrent.evaNumber) + "/");
|
||||
let response = await fetch("./query_departures/" + encodeURIComponent(transportModesInteger) + "/" + encodeURIComponent(currentEvaNumber) + "/");
|
||||
if (!response.ok) {
|
||||
let error = await response.text();
|
||||
console.warn("Query Departures: Got error " + response.status + " from server: " + error);
|
||||
} else {
|
||||
let [stationRelatedEvaNumbers, result] = await response.json();
|
||||
for (let relatedEvaNumber of stationRelatedEvaNumbers) {
|
||||
if (stationDestination.evaNumber === relatedEvaNumber || (stationDestination.relatedEvaNumbers && stationDestination.relatedEvaNumbers.includes(relatedEvaNumber))) {
|
||||
endGameWin();
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const [route, stopEvaNumber, stops, routeId] of result) {
|
||||
let result = await response.json();
|
||||
for (const [route, stops, routeId] of result) {
|
||||
if (stops.length > 0) {
|
||||
let departureElem = document.createElement("div");
|
||||
let departureElemHead = document.createElement("div");
|
||||
@ -563,14 +543,15 @@ async function reloadDepartures() {
|
||||
let canceled = result[1];
|
||||
let foundCurrent = true;
|
||||
for (const [stop, evaNumber] of result[0]) {
|
||||
if (evaNumber === stopEvaNumber) foundCurrent = false;
|
||||
if (evaNumber === currentEvaNumber) foundCurrent = false;
|
||||
}
|
||||
for (const [stop, evaNumber] of result[0]) {
|
||||
console.log(stop, ": ", evaNumber);
|
||||
let stopElem = document.createElement("li");
|
||||
stopElem.innerText = stop;
|
||||
stopElem.style.wordWrap = "nowrap";
|
||||
if (!foundCurrent) {
|
||||
if (evaNumber === stopEvaNumber) {
|
||||
if (evaNumber === currentEvaNumber) {
|
||||
foundCurrent = true;
|
||||
stopElem.classList.add("DetailedViewCurrentStop");
|
||||
} else {
|
||||
@ -593,12 +574,6 @@ async function reloadDepartures() {
|
||||
}
|
||||
}
|
||||
|
||||
function endGameWin() {
|
||||
// TODO: obv
|
||||
alert("You won! Unfortunately, i haven't made a screen for that yet...");
|
||||
location.reload();
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,10 +7,10 @@ pub mod station_ids {
|
||||
pub id: StationId,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub struct StationEvaNumber(pub String);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct DbStopId(pub String);
|
||||
|
||||
impl StationEvaNumber {
|
||||
@ -49,7 +49,7 @@ pub mod station_ids {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub struct StationId {
|
||||
pub eva_number: StationEvaNumber,
|
||||
pub db_station_id: DbStopId,
|
||||
|
@ -6,7 +6,7 @@ use crate::bahn_api::transport_modes::TransportMode;
|
||||
use super::{
|
||||
basic_types::{
|
||||
route_ids::RouteId,
|
||||
station_ids::{AsStationId, StationEvaNumber, StationIdRef},
|
||||
station_ids::{AsStationId, StationIdRef},
|
||||
},
|
||||
transport_modes::TransportModesSet,
|
||||
};
|
||||
@ -82,7 +82,6 @@ pub struct Arrivals {
|
||||
#[derive(Debug)]
|
||||
pub struct Departure {
|
||||
pub id: RouteId,
|
||||
pub station: StationEvaNumber,
|
||||
pub route: String,
|
||||
pub category: Option<TransportMode>,
|
||||
pub stops: Vec<NamedStop>,
|
||||
@ -91,7 +90,6 @@ pub struct Departure {
|
||||
#[derive(Debug)]
|
||||
pub struct Arrival {
|
||||
pub id: RouteId,
|
||||
pub station: StationEvaNumber,
|
||||
pub route: String,
|
||||
pub category: Option<TransportMode>,
|
||||
pub stops: Vec<NamedStop>,
|
||||
@ -135,10 +133,7 @@ impl GetDepartureOrArrivalError for GetArrivalsError {
|
||||
pub mod deserialize {
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::bahn_api::{
|
||||
basic_types::{route_ids::RouteId, station_ids::StationEvaNumber},
|
||||
transport_modes::TransportMode,
|
||||
};
|
||||
use crate::bahn_api::{basic_types::route_ids::RouteId, transport_modes::TransportMode};
|
||||
|
||||
use super::{
|
||||
Arrival, Arrivals, Departure, Departures, GetArrivalsError, GetDeparturesError, NamedStop,
|
||||
@ -181,7 +176,6 @@ pub mod deserialize {
|
||||
.map(|dep| Departure {
|
||||
id: RouteId(dep.journey_id),
|
||||
route: dep.vehicle.route,
|
||||
station: StationEvaNumber(dep.bahnhofs_id),
|
||||
category: dep
|
||||
.vehicle
|
||||
.category
|
||||
@ -222,7 +216,6 @@ pub mod deserialize {
|
||||
.map(|arr| Arrival {
|
||||
id: RouteId(arr.journey_id),
|
||||
route: arr.vehicle.route,
|
||||
station: StationEvaNumber(arr.bahnhofs_id),
|
||||
category: arr
|
||||
.vehicle
|
||||
.category
|
||||
@ -240,13 +233,13 @@ pub mod deserialize {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct DepData {
|
||||
#[serde(default, rename = "entries")]
|
||||
#[serde(rename = "entries")]
|
||||
departures: Vec<DepDeparture>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ArrData {
|
||||
#[serde(default, rename = "entries")]
|
||||
#[serde(rename = "entries")]
|
||||
arrivals: Vec<ArrArrival>,
|
||||
}
|
||||
|
||||
@ -256,7 +249,6 @@ pub mod deserialize {
|
||||
#[serde(rename = "ueber")]
|
||||
stops: Vec<String>,
|
||||
journey_id: String,
|
||||
bahnhofs_id: String,
|
||||
#[serde(default)]
|
||||
terminus: Option<String>,
|
||||
#[serde(rename = "verkehrmittel")]
|
||||
@ -269,7 +261,6 @@ pub mod deserialize {
|
||||
#[serde(rename = "ueber")]
|
||||
stops: Vec<String>,
|
||||
journey_id: String,
|
||||
bahnhofs_id: String,
|
||||
#[serde(default)]
|
||||
terminus: Option<String>,
|
||||
#[serde(rename = "verkehrmittel")]
|
||||
|
@ -1,10 +1,8 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub struct TransportModesSet(u32);
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum TransportMode {
|
||||
Bus,
|
||||
Tram,
|
||||
|
@ -1,12 +1,12 @@
|
||||
pub mod ratelimit;
|
||||
|
||||
use std::{collections::HashSet, sync::Arc, time::Duration};
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::{Json, extract::Path, response::Html, routing::get};
|
||||
use rand::seq::IndexedRandom;
|
||||
use ratelimit::Ratelimit;
|
||||
use reqwest::StatusCode;
|
||||
use tokio::{sync::Mutex, time::sleep};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
bahn_api::{
|
||||
@ -28,19 +28,7 @@ pub async fn main() {
|
||||
|
||||
let ratelimit = Ratelimit::new(10, 10);
|
||||
|
||||
let stations = Arc::new(Mutex::new(Stations::load().await.unwrap().unwrap()));
|
||||
{
|
||||
let stations = Arc::clone(&stations);
|
||||
tokio::task::spawn(async move {
|
||||
loop {
|
||||
#[cfg(debug_assertions)]
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
#[cfg(not(debug_assertions))]
|
||||
sleep(Duration::from_secs(900)).await;
|
||||
stations.lock().await.save().await;
|
||||
}
|
||||
});
|
||||
}
|
||||
let stations = Arc::new(Mutex::new(Stations::new()));
|
||||
|
||||
axum::serve(
|
||||
tokio::net::TcpListener::bind(
|
||||
@ -86,10 +74,8 @@ pub async fn main() {
|
||||
Station {
|
||||
name: station.station.name,
|
||||
db_station_id: station.station.id.db_station_id,
|
||||
related_stations: HashSet::new(),
|
||||
lat_lon: station.lat_lon,
|
||||
transport_modes: Some(station.transport_modes),
|
||||
has_been_changed: true,
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -112,8 +98,8 @@ pub async fn main() {
|
||||
return Err(StatusCode::NOT_FOUND);
|
||||
}
|
||||
let eva_number = StationEvaNumber(eva_number);
|
||||
if let Some(station) = stations.lock().await.get_mut(&eva_number) {
|
||||
match departures((&eva_number, &station.db_station_id), transport_modes).await {
|
||||
if let Some(station) = stations.lock().await.get(&eva_number) {
|
||||
match departures((&eva_number, station), transport_modes).await {
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
"Tried to get departures at {}, but got error: {e:?}",
|
||||
@ -121,36 +107,23 @@ pub async fn main() {
|
||||
);
|
||||
Err(StatusCode::INTERNAL_SERVER_ERROR)
|
||||
}
|
||||
Ok(departures) => {
|
||||
for departure in departures.departures.iter() {
|
||||
if departure.station != eva_number && !station.related_stations.contains(&departure.station) {
|
||||
station.related_stations.insert(departure.station.clone());
|
||||
}
|
||||
}
|
||||
Ok(Json((
|
||||
station
|
||||
.related_stations
|
||||
.iter()
|
||||
.map(|v| v.0.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
departures
|
||||
.departures
|
||||
.into_iter()
|
||||
.map(|departure| {
|
||||
(
|
||||
departure.route,
|
||||
departure.station.0,
|
||||
departure
|
||||
.stops
|
||||
.into_iter()
|
||||
.map(|stop| stop.name)
|
||||
.collect::<Vec<_>>(),
|
||||
departure.id.0,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
)))
|
||||
}
|
||||
Ok(departures) => Ok(Json(
|
||||
departures
|
||||
.departures
|
||||
.into_iter()
|
||||
.map(|departure| {
|
||||
(
|
||||
departure.route,
|
||||
departure
|
||||
.stops
|
||||
.into_iter()
|
||||
.map(|stop| stop.name)
|
||||
.collect::<Vec<_>>(),
|
||||
departure.id.0,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
)),
|
||||
}
|
||||
} else {
|
||||
Err(StatusCode::GONE)
|
||||
@ -190,10 +163,8 @@ pub async fn main() {
|
||||
Station {
|
||||
name: station.name,
|
||||
db_station_id: station.id.db_station_id,
|
||||
related_stations: HashSet::new(),
|
||||
lat_lon: None,
|
||||
transport_modes: None,
|
||||
has_been_changed: true,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1 @@
|
||||
pub mod stations;
|
||||
pub mod stations_files;
|
||||
pub mod stations_saving;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::bahn_api::{
|
||||
basic_types::station_ids::{DbStopId, StationEvaNumber, StationIdRef},
|
||||
@ -12,10 +12,8 @@ pub struct Stations {
|
||||
pub struct Station {
|
||||
pub name: String,
|
||||
pub db_station_id: DbStopId,
|
||||
pub related_stations: HashSet<StationEvaNumber>,
|
||||
pub lat_lon: Option<(f64, f64)>,
|
||||
pub transport_modes: Option<TransportModesSet>,
|
||||
pub has_been_changed: bool,
|
||||
}
|
||||
|
||||
impl Stations {
|
||||
@ -25,7 +23,7 @@ impl Stations {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, eva_number: StationEvaNumber, mut station: Station) {
|
||||
pub fn insert(&mut self, eva_number: StationEvaNumber, station: Station) {
|
||||
if let Some(prev) = self.stations.get_mut(&eva_number) {
|
||||
// partial update: if we had more information than the new `station` has,
|
||||
// keep parts of the old information, but wherever the new `station` has
|
||||
@ -37,18 +35,12 @@ impl Stations {
|
||||
Station {
|
||||
name: String::new(),
|
||||
db_station_id: DbStopId(unreachable!()),
|
||||
related_stations: HashSet::new(),
|
||||
lat_lon: None,
|
||||
transport_modes: None,
|
||||
has_been_changed: true,
|
||||
}
|
||||
}
|
||||
prev.has_been_changed = true;
|
||||
prev.name = station.name;
|
||||
prev.db_station_id = station.db_station_id;
|
||||
for station in station.related_stations {
|
||||
prev.related_stations.insert(station);
|
||||
}
|
||||
if let Some(v) = station.lat_lon {
|
||||
prev.lat_lon = Some(v);
|
||||
}
|
||||
@ -56,32 +48,20 @@ impl Stations {
|
||||
prev.transport_modes = Some(v);
|
||||
}
|
||||
} else {
|
||||
station.has_been_changed = true;
|
||||
self.stations.insert(eva_number, station);
|
||||
}
|
||||
}
|
||||
pub(super) fn insert_raw(&mut self, eva_number: StationEvaNumber, station: Station) {
|
||||
self.stations.insert(eva_number, station);
|
||||
}
|
||||
|
||||
pub fn get(&self, eva_number: &StationEvaNumber) -> Option<&Station> {
|
||||
pub fn get(&mut self, eva_number: &StationEvaNumber) -> Option<&Station> {
|
||||
self.stations.get(eva_number)
|
||||
}
|
||||
pub fn get_mut(&mut self, eva_number: &StationEvaNumber) -> Option<&mut Station> {
|
||||
self.stations.get_mut(eva_number)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<(&'a StationEvaNumber, &'a Station)> for StationIdRef<'a> {
|
||||
fn from(value: (&'a StationEvaNumber, &'a Station)) -> Self {
|
||||
(value.0, &value.1.db_station_id).into()
|
||||
}
|
||||
}
|
||||
impl<'a> From<(&'a StationEvaNumber, &'a DbStopId)> for StationIdRef<'a> {
|
||||
fn from(value: (&'a StationEvaNumber, &'a DbStopId)) -> Self {
|
||||
StationIdRef {
|
||||
eva_number: value.0,
|
||||
db_station_id: &value.1,
|
||||
db_station_id: &value.1.db_station_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::bahn_api::{
|
||||
basic_types::station_ids::{DbStopId, StationEvaNumber},
|
||||
transport_modes::{TransportMode, TransportModesSet},
|
||||
};
|
||||
|
||||
use super::stations::Station;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct StationJsonRef<'a> {
|
||||
name: &'a str,
|
||||
db_station_id: &'a str,
|
||||
related_stations: Vec<&'a str>,
|
||||
lat_lon: Option<(f64, f64)>,
|
||||
transport_modes: Vec<TransportMode>,
|
||||
}
|
||||
#[derive(Deserialize)]
|
||||
struct StationJson {
|
||||
name: String,
|
||||
db_station_id: String,
|
||||
related_stations: Vec<String>,
|
||||
lat_lon: Option<(f64, f64)>,
|
||||
transport_modes: Vec<TransportMode>,
|
||||
}
|
||||
|
||||
pub fn station_to_string(
|
||||
Station {
|
||||
name,
|
||||
db_station_id,
|
||||
related_stations,
|
||||
lat_lon,
|
||||
transport_modes,
|
||||
has_been_changed: _,
|
||||
}: &Station,
|
||||
) -> String {
|
||||
serde_json::to_string(&StationJsonRef {
|
||||
name: &name,
|
||||
db_station_id: &db_station_id.0,
|
||||
related_stations: related_stations.iter().map(|v| v.0.as_str()).collect(),
|
||||
lat_lon: *lat_lon,
|
||||
transport_modes: transport_modes
|
||||
.as_ref()
|
||||
.map(|v| v.iter().collect())
|
||||
.unwrap_or_else(Vec::default),
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn station_from_string(string: &str) -> Result<Station, serde_json::Error> {
|
||||
let StationJson {
|
||||
name,
|
||||
db_station_id,
|
||||
related_stations,
|
||||
lat_lon,
|
||||
transport_modes,
|
||||
} = serde_json::from_str(string)?;
|
||||
Ok(Station {
|
||||
name,
|
||||
db_station_id: DbStopId(db_station_id),
|
||||
related_stations: related_stations.into_iter().map(StationEvaNumber).collect(),
|
||||
lat_lon,
|
||||
transport_modes: Some(
|
||||
transport_modes
|
||||
.into_iter()
|
||||
.fold(TransportModesSet::new(), |set, m| set.with(m)),
|
||||
)
|
||||
.filter(|set| set.len() > 0),
|
||||
has_been_changed: false,
|
||||
})
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
use crate::bahn_api::basic_types::station_ids::StationEvaNumber;
|
||||
|
||||
use super::{
|
||||
stations::Stations,
|
||||
stations_files::{station_from_string, station_to_string},
|
||||
};
|
||||
|
||||
impl Stations {
|
||||
pub async fn save(&mut self) {
|
||||
for (key, station) in self.stations.iter_mut() {
|
||||
if station.has_been_changed {
|
||||
eprintln!("Saving station {:?} ({:?}).", station.name, key.0);
|
||||
station.has_been_changed = false;
|
||||
if key.0.chars().all(|ch| ch.is_ascii_alphanumeric()) {
|
||||
if let Err(e) = tokio::fs::write(
|
||||
format!("stations/{}", key.0.as_str()),
|
||||
station_to_string(station),
|
||||
)
|
||||
.await
|
||||
{
|
||||
eprintln!(
|
||||
"[stations/save] could not save station {:?}: {e}.",
|
||||
station.name
|
||||
);
|
||||
}
|
||||
} else {
|
||||
eprintln!(
|
||||
"[stations/save] skipping station {:?} because key {:?} contained at least one non-ascii-alphanumeric character.",
|
||||
station.name, key.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn load() -> Result<Result<Self, serde_json::Error>, tokio::io::Error> {
|
||||
let mut dir_entries = tokio::fs::read_dir("stations/").await?;
|
||||
let mut s = Self::new();
|
||||
while let Some(file) = dir_entries.next_entry().await? {
|
||||
if let Some(name) = file
|
||||
.file_name()
|
||||
.to_str()
|
||||
.filter(|name| name.chars().all(|ch| ch.is_ascii_alphanumeric()))
|
||||
{
|
||||
let eva_number = StationEvaNumber(name.to_owned());
|
||||
let mut station =
|
||||
match station_from_string(&tokio::fs::read_to_string(file.path()).await?) {
|
||||
Ok(v) => v,
|
||||
Err(e) => return Ok(Err(e)),
|
||||
};
|
||||
station.has_been_changed = false;
|
||||
s.insert_raw(eva_number, station);
|
||||
}
|
||||
}
|
||||
Ok(Ok(s))
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
station data goes here, program will not start without this folder
|
Loading…
x
Reference in New Issue
Block a user