mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
offline mode, expanded logging
This commit is contained in:
156
Cargo.lock
generated
156
Cargo.lock
generated
@@ -41,6 +41,7 @@ dependencies = [
|
|||||||
"steamlocate",
|
"steamlocate",
|
||||||
"strip-ansi-escapes",
|
"strip-ansi-escapes",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"ureq",
|
||||||
"winresource",
|
"winresource",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -83,6 +84,12 @@ version = "0.7.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atomic-waker"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -106,9 +113,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
@@ -158,9 +165,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.5.0"
|
version = "1.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
@@ -520,15 +527,15 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.4.4"
|
version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069"
|
checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"atomic-waker",
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
|
||||||
"http",
|
"http",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"slab",
|
"slab",
|
||||||
@@ -560,9 +567,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "http"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
@@ -571,9 +578,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-body"
|
name = "http-body"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http",
|
||||||
@@ -581,12 +588,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-body-util"
|
name = "http-body-util"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d"
|
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
@@ -606,9 +613,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "1.2.0"
|
version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a"
|
checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@@ -626,9 +633,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-rustls"
|
name = "hyper-rustls"
|
||||||
version = "0.27.2"
|
version = "0.27.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
|
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
@@ -659,9 +666,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-util"
|
name = "hyper-util"
|
||||||
version = "0.1.3"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
|
checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@@ -672,7 +679,6 @@ dependencies = [
|
|||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower",
|
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@@ -1090,26 +1096,6 @@ dependencies = [
|
|||||||
"sha2",
|
"sha2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pin-project"
|
|
||||||
version = "1.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
|
||||||
dependencies = [
|
|
||||||
"pin-project-internal",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pin-project-internal"
|
|
||||||
version = "1.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.48",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.13"
|
version = "0.2.13"
|
||||||
@@ -1219,9 +1205,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.12.7"
|
version = "0.12.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63"
|
checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -1310,11 +1296,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.7"
|
version = "0.23.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ebbbdb961df0ad3f2652da8f3fdc4b36122f568f968f45ad3316f26c025c677b"
|
checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"ring",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"rustls-webpki",
|
"rustls-webpki",
|
||||||
"subtle",
|
"subtle",
|
||||||
@@ -1323,25 +1311,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-pemfile"
|
name = "rustls-pemfile"
|
||||||
version = "2.1.2"
|
version = "2.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
|
checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-pki-types"
|
name = "rustls-pki-types"
|
||||||
version = "1.4.1"
|
version = "1.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247"
|
checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.102.3"
|
version = "0.102.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf"
|
checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ring",
|
"ring",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
@@ -1617,9 +1604,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
version = "2.5.0"
|
version = "2.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
@@ -1645,9 +1632,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sync_wrapper"
|
name = "sync_wrapper"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
|
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
]
|
]
|
||||||
@@ -1770,12 +1757,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-rustls"
|
name = "tokio-rustls"
|
||||||
version = "0.26.0"
|
version = "0.26.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
|
checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustls",
|
"rustls",
|
||||||
"rustls-pki-types",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1827,28 +1813,6 @@ dependencies = [
|
|||||||
"winnow 0.5.40",
|
"winnow 0.5.40",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tower"
|
|
||||||
version = "0.4.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
|
||||||
dependencies = [
|
|
||||||
"futures-core",
|
|
||||||
"futures-util",
|
|
||||||
"pin-project",
|
|
||||||
"pin-project-lite",
|
|
||||||
"tokio",
|
|
||||||
"tower-layer",
|
|
||||||
"tower-service",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tower-layer"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-service"
|
name = "tower-service"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -1861,7 +1825,6 @@ version = "0.1.40"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
@@ -1932,6 +1895,22 @@ version = "0.9.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ureq"
|
||||||
|
version = "2.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"flate2",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"rustls",
|
||||||
|
"rustls-pki-types",
|
||||||
|
"url",
|
||||||
|
"webpki-roots",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.4.1"
|
version = "2.4.1"
|
||||||
@@ -2064,9 +2043,9 @@ checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-streams"
|
name = "wasm-streams"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129"
|
checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -2085,6 +2064,15 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "webpki-roots"
|
||||||
|
version = "0.26.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e"
|
||||||
|
dependencies = [
|
||||||
|
"rustls-pki-types",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "which"
|
name = "which"
|
||||||
version = "4.4.2"
|
version = "4.4.2"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ semver = "1.0.23"
|
|||||||
colored = "2.1.0"
|
colored = "2.1.0"
|
||||||
once_cell = "1.20.0"
|
once_cell = "1.20.0"
|
||||||
reqwest = { version = "0.12.7", features = ["stream"] }
|
reqwest = { version = "0.12.7", features = ["stream"] }
|
||||||
|
ureq = "2.9"
|
||||||
futures-util = "0.3.30"
|
futures-util = "0.3.30"
|
||||||
indicatif = "0.17.8"
|
indicatif = "0.17.8"
|
||||||
tokio = {version="1.40.0", features = ["rt-multi-thread", "macros"]}
|
tokio = {version="1.40.0", features = ["rt-multi-thread", "macros"]}
|
||||||
|
|||||||
@@ -3,11 +3,17 @@ use crate::structs::Config;
|
|||||||
use std::{fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
|
|
||||||
pub fn load(config_path: PathBuf) -> Config {
|
pub fn load(config_path: PathBuf) -> Config {
|
||||||
|
debug!("Loading config from: {}", config_path.display());
|
||||||
if config_path.exists() {
|
if config_path.exists() {
|
||||||
let cfg = fs::read_to_string(&config_path).unwrap();
|
let cfg = fs::read_to_string(&config_path).unwrap();
|
||||||
let cfg: Config = serde_json::from_str(&cfg).unwrap_or(Config::default());
|
let cfg: Config = serde_json::from_str(&cfg).unwrap_or_else(|e| {
|
||||||
|
warn!("Failed to parse config file: {}", e);
|
||||||
|
Config::default()
|
||||||
|
});
|
||||||
|
debug!("Loaded config: {:?}", cfg);
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
info!("No config file found, creating default config");
|
||||||
save(config_path.clone(), Config::default());
|
save(config_path.clone(), Config::default());
|
||||||
Config::default()
|
Config::default()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::structs::PrintPrefix;
|
use crate::misc;
|
||||||
|
use crate::structs::{PrintPrefix, StoredGameData};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@@ -12,6 +13,8 @@ pub const GH_IW4X_REPO: &str = "iw4x-client";
|
|||||||
pub static MASTER: Lazy<Mutex<String>> =
|
pub static MASTER: Lazy<Mutex<String>> =
|
||||||
Lazy::new(|| Mutex::new("https://cdn.alterware.ovh".to_owned()));
|
Lazy::new(|| Mutex::new("https://cdn.alterware.ovh".to_owned()));
|
||||||
|
|
||||||
|
pub static IS_OFFLINE: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
|
||||||
|
|
||||||
pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
|
pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
|
||||||
HashMap::from([
|
HashMap::from([
|
||||||
(
|
(
|
||||||
@@ -51,3 +54,29 @@ pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pub async fn check_connectivity() -> bool {
|
||||||
|
let master_url = MASTER.lock().unwrap().clone();
|
||||||
|
|
||||||
|
match crate::http_async::get_body_string(&master_url).await {
|
||||||
|
Ok(_) => true,
|
||||||
|
Err(_) => {
|
||||||
|
*IS_OFFLINE.lock().unwrap() = true;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_stored_data() -> Option<StoredGameData> {
|
||||||
|
let dir = std::env::current_dir().ok()?;
|
||||||
|
let cache = misc::get_cache(&dir);
|
||||||
|
cache.stored_data
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn store_game_data(data: &StoredGameData) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let dir = std::env::current_dir()?;
|
||||||
|
let mut cache = misc::get_cache(&dir);
|
||||||
|
cache.stored_data = Some((*data).clone());
|
||||||
|
misc::save_cache(&dir, cache);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ pub async fn download_file_progress(
|
|||||||
path: &PathBuf,
|
path: &PathBuf,
|
||||||
size: u64,
|
size: u64,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
debug!("Starting download: {} -> {}", url, path.display());
|
||||||
|
|
||||||
let res = client
|
let res = client
|
||||||
.get(url)
|
.get(url)
|
||||||
.header(
|
.header(
|
||||||
@@ -29,9 +31,13 @@ pub async fn download_file_progress(
|
|||||||
)
|
)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|_| format!("Failed to GET from '{url}'"))?;
|
.map_err(|e| {
|
||||||
|
error!("Failed to GET from '{}': {}", url, e);
|
||||||
|
format!("Failed to GET from '{url}'")
|
||||||
|
})?;
|
||||||
|
|
||||||
let total_size = res.content_length().unwrap_or(size);
|
let total_size = res.content_length().unwrap_or(size);
|
||||||
|
debug!("Download size: {}", misc::human_readable_bytes(total_size));
|
||||||
pb.set_length(total_size);
|
pb.set_length(total_size);
|
||||||
|
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
|
|||||||
138
src/main.rs
138
src/main.rs
@@ -337,6 +337,10 @@ async fn update(
|
|||||||
skip_iw4x_sp: Option<bool>,
|
skip_iw4x_sp: Option<bool>,
|
||||||
ignore_required_files: Option<bool>,
|
ignore_required_files: Option<bool>,
|
||||||
) {
|
) {
|
||||||
|
info!("Starting update for game engine: {}", game.engine);
|
||||||
|
info!("Update path: {}", dir.display());
|
||||||
|
debug!("Bonus content: {}, Force update: {}", bonus_content, force);
|
||||||
|
|
||||||
let skip_iw4x_sp = skip_iw4x_sp.unwrap_or(false);
|
let skip_iw4x_sp = skip_iw4x_sp.unwrap_or(false);
|
||||||
let ignore_required_files = ignore_required_files.unwrap_or(false);
|
let ignore_required_files = ignore_required_files.unwrap_or(false);
|
||||||
|
|
||||||
@@ -344,9 +348,11 @@ async fn update(
|
|||||||
http_async::get_body_string(format!("{}/files.json", MASTER.lock().unwrap()).as_str())
|
http_async::get_body_string(format!("{}/files.json", MASTER.lock().unwrap()).as_str())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
debug!("Retrieved files.json from server");
|
||||||
let cdn_info: Vec<CdnFile> = serde_json::from_str(&res).unwrap();
|
let cdn_info: Vec<CdnFile> = serde_json::from_str(&res).unwrap();
|
||||||
|
|
||||||
if !ignore_required_files && !game.required_files_exist(dir) {
|
if !ignore_required_files && !game.required_files_exist(dir) {
|
||||||
|
error!("Critical game files missing. Required files check failed.");
|
||||||
println!(
|
println!(
|
||||||
"{}\nVerify game file integrity on Steam or reinstall the game.",
|
"{}\nVerify game file integrity on Steam or reinstall the game.",
|
||||||
"Critical game files missing.".bright_red()
|
"Critical game files missing.".bright_red()
|
||||||
@@ -477,10 +483,33 @@ async fn update(
|
|||||||
}
|
}
|
||||||
|
|
||||||
misc::save_cache(dir, cache);
|
misc::save_cache(dir, cache);
|
||||||
|
|
||||||
|
// Store game data for offline mode
|
||||||
|
let mut stored_data = global::get_stored_data().unwrap_or_default();
|
||||||
|
stored_data.game_path = dir.to_string_lossy().into_owned();
|
||||||
|
|
||||||
|
// Store available clients for this engine
|
||||||
|
stored_data.clients.insert(
|
||||||
|
game.engine.to_string(),
|
||||||
|
game.client.iter().map(|s| s.to_string()).collect(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Err(e) = global::store_game_data(&stored_data) {
|
||||||
|
println!(
|
||||||
|
"{} Failed to store game data: {}",
|
||||||
|
PREFIXES.get("error").unwrap().formatted(),
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn launch(file_path: &PathBuf, args: &str) {
|
fn launch(file_path: &PathBuf, args: &str) {
|
||||||
|
info!(
|
||||||
|
"Launching game on Windows: {} {}",
|
||||||
|
file_path.display(),
|
||||||
|
args
|
||||||
|
);
|
||||||
println!("\n\nJoin the AlterWare Discord server:\nhttps://discord.gg/2ETE8engZM\n\n");
|
println!("\n\nJoin the AlterWare Discord server:\nhttps://discord.gg/2ETE8engZM\n\n");
|
||||||
crate::println_info!("Launching {} {args}", file_path.display());
|
crate::println_info!("Launching {} {args}", file_path.display());
|
||||||
let exit_status = std::process::Command::new(file_path)
|
let exit_status = std::process::Command::new(file_path)
|
||||||
@@ -491,6 +520,12 @@ fn launch(file_path: &PathBuf, args: &str) {
|
|||||||
.wait()
|
.wait()
|
||||||
.expect("Failed to wait for the game process to finish");
|
.expect("Failed to wait for the game process to finish");
|
||||||
|
|
||||||
|
if exit_status.success() {
|
||||||
|
info!("Game exited successfully with status: {}", exit_status);
|
||||||
|
} else {
|
||||||
|
error!("Game exited with error status: {}", exit_status);
|
||||||
|
}
|
||||||
|
|
||||||
crate::println_error!("Game exited with {exit_status}");
|
crate::println_error!("Game exited with {exit_status}");
|
||||||
if !exit_status.success() {
|
if !exit_status.success() {
|
||||||
misc::stdin();
|
misc::stdin();
|
||||||
@@ -641,6 +676,90 @@ async fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let offline_mode = !global::check_connectivity().await;
|
||||||
|
if offline_mode {
|
||||||
|
// Check if this is a first-time run (no stored data)
|
||||||
|
let stored_data = global::get_stored_data();
|
||||||
|
if stored_data.is_none() {
|
||||||
|
println!(
|
||||||
|
"{} Internet connection is required for first-time installation.",
|
||||||
|
PREFIXES.get("error").unwrap().formatted()
|
||||||
|
);
|
||||||
|
error!("Internet connection required for first-time installation");
|
||||||
|
println!("Please connect to the internet and try again.");
|
||||||
|
println!("Press enter to exit...");
|
||||||
|
misc::stdin();
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"{} No internet connection or MASTER server is unreachable. Running in offline mode...",
|
||||||
|
PREFIXES.get("error").unwrap().formatted()
|
||||||
|
);
|
||||||
|
warn!("No internet connection or MASTER server is unreachable. Running in offline mode...");
|
||||||
|
|
||||||
|
// Handle path the same way as online mode
|
||||||
|
let install_path: PathBuf;
|
||||||
|
if let Some(path) = arg_value(&args, "--path") {
|
||||||
|
install_path = PathBuf::from(path);
|
||||||
|
arg_remove_value(&mut args, "--path");
|
||||||
|
} else if let Some(path) = arg_value(&args, "-p") {
|
||||||
|
install_path = PathBuf::from(path);
|
||||||
|
arg_remove_value(&mut args, "-p");
|
||||||
|
} else {
|
||||||
|
install_path = env::current_dir().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
let cfg = config::load(install_path.join("alterware-launcher.json"));
|
||||||
|
|
||||||
|
// Try to get stored game data
|
||||||
|
let stored_data = global::get_stored_data();
|
||||||
|
if let Some(ref data) = stored_data {
|
||||||
|
info!("Found stored game data for path: {}", data.game_path);
|
||||||
|
} else {
|
||||||
|
warn!("No stored game data found");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get client from args, config, or prompt user
|
||||||
|
let client = if args.len() > 1 {
|
||||||
|
args[1].clone()
|
||||||
|
} else if let Some(engine) = stored_data
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|d| d.clients.get(&cfg.engine))
|
||||||
|
{
|
||||||
|
if engine.len() > 1 {
|
||||||
|
println!("Multiple clients available, select one to launch:");
|
||||||
|
for (i, c) in engine.iter().enumerate() {
|
||||||
|
println!("{i}: {c}");
|
||||||
|
}
|
||||||
|
info!("Multiple clients available, prompting user for selection");
|
||||||
|
engine[misc::stdin().parse::<usize>().unwrap()].clone()
|
||||||
|
} else if !engine.is_empty() {
|
||||||
|
info!("Using single available client: {}", engine[0]);
|
||||||
|
engine[0].clone()
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"{} No client specified and no stored clients available.",
|
||||||
|
PREFIXES.get("error").unwrap().formatted()
|
||||||
|
);
|
||||||
|
error!("No client specified and no stored clients available");
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"{} No client specified and no stored data available.",
|
||||||
|
PREFIXES.get("error").unwrap().formatted()
|
||||||
|
);
|
||||||
|
error!("No client specified and no stored data available");
|
||||||
|
std::process::exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
info!("Launching game in offline mode with client: {}", client);
|
||||||
|
// Launch game without updates
|
||||||
|
launch(&install_path.join(format!("{}.exe", client)), &cfg.args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let install_path: PathBuf;
|
let install_path: PathBuf;
|
||||||
if let Some(path) = arg_value(&args, "--path") {
|
if let Some(path) = arg_value(&args, "--path") {
|
||||||
install_path = PathBuf::from(path);
|
install_path = PathBuf::from(path);
|
||||||
@@ -812,6 +931,25 @@ async fn main() {
|
|||||||
if !cfg.update_only {
|
if !cfg.update_only {
|
||||||
launch(&install_path.join(format!("{c}.exe")), &cfg.args);
|
launch(&install_path.join(format!("{c}.exe")), &cfg.args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store game data for offline mode
|
||||||
|
let mut stored_data = global::get_stored_data().unwrap_or_default();
|
||||||
|
stored_data.game_path = install_path.to_string_lossy().into_owned();
|
||||||
|
|
||||||
|
// Store available clients for this engine
|
||||||
|
stored_data.clients.insert(
|
||||||
|
g.engine.to_string(),
|
||||||
|
g.client.iter().map(|s| s.to_string()).collect(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Err(e) = global::store_game_data(&stored_data) {
|
||||||
|
println!(
|
||||||
|
"{} Failed to store game data: {}",
|
||||||
|
PREFIXES.get("error").unwrap().formatted(),
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,8 +75,17 @@ impl PrintPrefix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize, serde::Serialize, Default, PartialEq, Debug, Clone)]
|
#[derive(serde::Deserialize, serde::Serialize, Default, Debug, Clone, PartialEq)]
|
||||||
pub struct Cache {
|
pub struct Cache {
|
||||||
pub iw4x_revision: String,
|
pub iw4x_revision: String,
|
||||||
pub hashes: HashMap<String, String>,
|
pub hashes: HashMap<String, String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub stored_data: Option<StoredGameData>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Deserialize, serde::Serialize, Default, Debug, Clone, PartialEq)]
|
||||||
|
pub struct StoredGameData {
|
||||||
|
pub game_path: String,
|
||||||
|
#[serde(default)]
|
||||||
|
pub clients: HashMap<String, Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|||||||
31
src/tests.rs
31
src/tests.rs
@@ -104,6 +104,7 @@ mod misc {
|
|||||||
hashes: [("test".to_string(), "hash".to_string())]
|
hashes: [("test".to_string(), "hash".to_string())]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect(),
|
.collect(),
|
||||||
|
stored_data: None,
|
||||||
};
|
};
|
||||||
misc::save_cache(path, test_cache.clone());
|
misc::save_cache(path, test_cache.clone());
|
||||||
let loaded_cache = misc::get_cache(path);
|
let loaded_cache = misc::get_cache(path);
|
||||||
@@ -112,3 +113,33 @@ mod misc {
|
|||||||
fs::remove_file(&cache_file).unwrap();
|
fs::remove_file(&cache_file).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod stored_data {
|
||||||
|
use crate::{fs, global, structs::StoredGameData};
|
||||||
|
use serial_test::serial;
|
||||||
|
use std::{collections::HashMap, path::Path};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn stored_game_data() {
|
||||||
|
let test_path = "test/path";
|
||||||
|
let mut test_clients = HashMap::new();
|
||||||
|
test_clients.insert("iw4".to_string(), vec!["iw4x".to_string()]);
|
||||||
|
|
||||||
|
let data = StoredGameData {
|
||||||
|
game_path: test_path.to_string(),
|
||||||
|
clients: test_clients,
|
||||||
|
};
|
||||||
|
|
||||||
|
let path = Path::new("tests_tmp");
|
||||||
|
fs::create_dir_all(path).unwrap();
|
||||||
|
|
||||||
|
global::store_game_data(&data).unwrap();
|
||||||
|
let loaded = global::get_stored_data().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(data.game_path, loaded.game_path);
|
||||||
|
assert_eq!(data.clients, loaded.clients);
|
||||||
|
|
||||||
|
fs::remove_dir_all(path).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user