mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-05 15:57:50 +00:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e7f2fa03b | ||
|
|
f9a64a9a45 | ||
|
|
72ac6d56aa | ||
|
|
695a8174c8 | ||
| 36aab56037 | |||
| 79477bf231 | |||
| 3d9bb6c424 | |||
| 334e989c2d | |||
|
|
b4b6c93e3d | ||
|
|
b658ac5ae1 | ||
|
|
57a3c315bf | ||
|
|
3717f1315e | ||
| 9442c733f9 | |||
| 71a3ccdf47 | |||
| 2454b25d56 | |||
| c8155761f2 | |||
| ab872bd2ab | |||
|
|
7f977ea680 | ||
|
|
cfa3629fa0 | ||
|
|
0b35a865b4 | ||
|
|
cc62261b2f | ||
|
|
cfc9826fb0 | ||
| 066311f7bb | |||
| d9b7f7fc07 | |||
| 1f7142b30b | |||
| b69f2e3338 | |||
|
|
2cd227fec4 | ||
|
|
c9cb2c3604 | ||
|
|
2c2184a8b3 | ||
|
|
609bfde418 | ||
|
|
a2e4f304dc | ||
|
|
2dab50111b | ||
| 27795f6680 | |||
| 39db6099e4 | |||
| 0493a7a4d8 | |||
| bb9ebcf830 | |||
| 1e2dca0162 | |||
|
|
d4e7cb1eb1 | ||
|
|
cb2f433c39 | ||
|
|
764a892f71 | ||
|
|
66554a0374 | ||
|
|
e96e0ca630 |
6
.github/workflows/lint.yml
vendored
6
.github/workflows/lint.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- uses: taiki-e/create-gh-release-action@v1.9.1
|
||||
with:
|
||||
draft: true
|
||||
@@ -29,8 +29,8 @@ jobs:
|
||||
os: windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: taiki-e/upload-rust-binary-action@v1.26.0
|
||||
- uses: actions/checkout@v5
|
||||
- uses: taiki-e/upload-rust-binary-action@v1.27.0
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
bin: alterware-launcher
|
||||
|
||||
219
Cargo.lock
generated
219
Cargo.lock
generated
@@ -19,7 +19,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "alterware-launcher"
|
||||
version = "0.11.3"
|
||||
version = "0.11.5"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"colored",
|
||||
@@ -29,7 +29,7 @@ dependencies = [
|
||||
"mslnk",
|
||||
"once_cell",
|
||||
"openssl",
|
||||
"rand 0.9.1",
|
||||
"rand 0.9.2",
|
||||
"reqwest",
|
||||
"self-replace",
|
||||
"semver",
|
||||
@@ -207,15 +207,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.7"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8"
|
||||
checksum = "2e09ced7ebbccb63b4c65413d821f2e00ce54c5ca4514ddc6b3c892fdbcbc69d"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"unicode-width 0.1.11",
|
||||
"windows-sys 0.45.0",
|
||||
"once_cell",
|
||||
"unicode-width",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -327,9 +327,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.6"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
@@ -678,7 +678,7 @@ dependencies = [
|
||||
"libc",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"socket2 0.5.10",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
@@ -731,17 +731,28 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indicatif"
|
||||
version = "0.17.11"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235"
|
||||
checksum = "70a646d946d06bedbbc4cac4c218acf4bbf2d87757a784857025f4d447e4e1cd"
|
||||
dependencies = [
|
||||
"console",
|
||||
"number_prefix",
|
||||
"portable-atomic",
|
||||
"unicode-width 0.2.0",
|
||||
"unicode-width",
|
||||
"unit-prefix",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io-uring"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.9.0"
|
||||
@@ -948,12 +959,6 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "number_prefix"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.1"
|
||||
@@ -971,9 +976,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.71"
|
||||
version = "0.10.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd"
|
||||
checksum = "24ad14dd45412269e1a30f52ad8f0664f0f4f4a89ee8fe28c3b3527021ebb654"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"cfg-if",
|
||||
@@ -1012,9 +1017,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.106"
|
||||
version = "0.9.110"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd"
|
||||
checksum = "0a9f0075ba3c21b09f8e8b2026584b1d18d49388648f2fbbf3c97ea8deced8e2"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -1172,9 +1177,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.1"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||
dependencies = [
|
||||
"rand_chacha 0.9.0",
|
||||
"rand_core 0.9.2",
|
||||
@@ -1241,9 +1246,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.20"
|
||||
version = "0.12.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813"
|
||||
checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
@@ -1432,16 +1437,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.25"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
|
||||
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.219"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
@@ -1456,10 +1462,19 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.219"
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1468,14 +1483,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.140"
|
||||
version = "1.0.145"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
||||
checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1556,9 +1572,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "simple-log"
|
||||
version = "2.3.0"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b08896e123e7fc00305e1df04999a25679768122daf636ccc01c7ca5465163ea"
|
||||
checksum = "3f8030713cfe4aa369ef3c8cbf5e391cc18d7f6fba1f2a68ec959c5504413e51"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log4rs",
|
||||
@@ -1592,6 +1608,16 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_vcruntime"
|
||||
version = "2.0.0"
|
||||
@@ -1739,18 +1765,20 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.45.1"
|
||||
version = "1.47.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
|
||||
checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"io-uring",
|
||||
"libc",
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"slab",
|
||||
"socket2 0.6.0",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1935,18 +1963,18 @@ dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
||||
|
||||
[[package]]
|
||||
name = "unit-prefix"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "323402cff2dd658f39ca17c789b502021b3f18707c91cdf22e3838e1b4023817"
|
||||
|
||||
[[package]]
|
||||
name = "unsafe-libyaml"
|
||||
version = "0.2.11"
|
||||
@@ -2203,15 +2231,6 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
@@ -2240,18 +2259,12 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.2"
|
||||
name = "windows-sys"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.42.2",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm 0.42.2",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
"windows-targets 0.53.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2278,7 +2291,7 @@ dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_gnullvm 0.52.6",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
@@ -2286,10 +2299,20 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.2"
|
||||
name = "windows-targets"
|
||||
version = "0.53.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.53.0",
|
||||
"windows_aarch64_msvc 0.53.0",
|
||||
"windows_i686_gnu 0.53.0",
|
||||
"windows_i686_gnullvm 0.53.0",
|
||||
"windows_i686_msvc 0.53.0",
|
||||
"windows_x86_64_gnu 0.53.0",
|
||||
"windows_x86_64_gnullvm 0.53.0",
|
||||
"windows_x86_64_msvc 0.53.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
@@ -2304,10 +2327,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
@@ -2322,10 +2345,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
@@ -2339,6 +2362,12 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
@@ -2346,10 +2375,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
@@ -2364,10 +2393,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
@@ -2382,10 +2411,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
@@ -2400,10 +2429,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
@@ -2417,6 +2446,12 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.20"
|
||||
@@ -2447,9 +2482,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winresource"
|
||||
version = "0.1.19"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7276691b353ad4547af8c3268488d1311f4be791ffdc0c65b8cfa8f41eed693b"
|
||||
checksum = "edcacf11b6f48dd21b9ba002f991bdd5de29b2da8cc2800412f4b80f677e4957"
|
||||
dependencies = [
|
||||
"toml",
|
||||
"version_check",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "alterware-launcher"
|
||||
version = "0.11.3"
|
||||
version = "0.11.5"
|
||||
edition = "2021"
|
||||
build = "res/build.rs"
|
||||
|
||||
@@ -21,9 +21,9 @@ once_cell = "1.21"
|
||||
reqwest = { version = "0.12", features = ["stream"] }
|
||||
futures-util = "0.3"
|
||||
futures = "0.3"
|
||||
indicatif = "0.17"
|
||||
tokio = { version="1.45", features = ["rt-multi-thread", "macros"] }
|
||||
simple-log = "2.3"
|
||||
indicatif = "0.18"
|
||||
tokio = { version="1.47", features = ["rt-multi-thread", "macros"] }
|
||||
simple-log = "2.4"
|
||||
walkdir = "2.5"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
||||
@@ -146,11 +146,8 @@
|
||||
- Install or reinstall redistributables
|
||||
- ```--prerelease```
|
||||
- Update to prerelease version of the launcher
|
||||
- ```--rate```
|
||||
- Rate and display CDN servers
|
||||
- ```--cdn-url```
|
||||
- ```--offline```
|
||||
- ```--skip-connectivity-check```
|
||||
|
||||
|
||||
##### Example:
|
||||
@@ -175,7 +172,6 @@ alterware-launcher.exe iw6 --bonus -u --path "C:\Games\IW6x" --pass "-headless"
|
||||
- `prerelease`: Update to prerelease version of clients and launcher. Default: `false`.
|
||||
- `cdn_url`
|
||||
- `offline`
|
||||
- `skip-connectivity-check`
|
||||
|
||||
---
|
||||
|
||||
|
||||
184
src/cdn.rs
184
src/cdn.rs
@@ -6,93 +6,19 @@ use std::time::Duration;
|
||||
|
||||
static CURRENT_CDN: Mutex<Option<Arc<Server>>> = Mutex::new(None);
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum Region {
|
||||
Africa,
|
||||
Asia,
|
||||
Europe,
|
||||
NorthAmerica,
|
||||
Oceania,
|
||||
SouthAmerica,
|
||||
Global,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl Region {
|
||||
pub fn from_str(region_str: &str) -> Self {
|
||||
match region_str {
|
||||
"Africa" => Region::Africa,
|
||||
"Asia" => Region::Asia,
|
||||
"Europe" => Region::Europe,
|
||||
"NorthAmerica" => Region::NorthAmerica,
|
||||
"Oceania" => Region::Oceania,
|
||||
"SouthAmerica" => Region::SouthAmerica,
|
||||
_ => Region::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn coordinates(&self) -> Option<(f64, f64)> {
|
||||
match self {
|
||||
Region::Europe => Some((54.0, 15.0)),
|
||||
Region::Asia => Some((35.0, 105.0)),
|
||||
Region::NorthAmerica => Some((45.0, -100.0)),
|
||||
Region::SouthAmerica => Some((-15.0, -60.0)),
|
||||
Region::Africa => Some((0.0, 20.0)),
|
||||
Region::Oceania => Some((-25.0, 140.0)),
|
||||
Region::Global => None,
|
||||
Region::Unknown => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn distance_to(&self, other: Region) -> f64 {
|
||||
if *self == Region::Global || other == Region::Global {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if *self == other {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
let (lat1, lon1) = match self.coordinates() {
|
||||
Some(coords) => coords,
|
||||
None => return 20000.0,
|
||||
};
|
||||
|
||||
let (lat2, lon2) = match other.coordinates() {
|
||||
Some(coords) => coords,
|
||||
None => return 20000.0,
|
||||
};
|
||||
|
||||
// haversine
|
||||
let r = 6371.0;
|
||||
let d_lat = (lat2 - lat1).to_radians();
|
||||
let d_lon = (lon2 - lon1).to_radians();
|
||||
let lat1_rad = lat1.to_radians();
|
||||
let lat2_rad = lat2.to_radians();
|
||||
|
||||
let a = (d_lat / 2.0).sin().powi(2)
|
||||
+ lat1_rad.cos() * lat2_rad.cos() * (d_lon / 2.0).sin().powi(2);
|
||||
let c = 2.0 * a.sqrt().atan2((1.0 - a).sqrt());
|
||||
|
||||
r * c
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Server {
|
||||
pub host: &'static str,
|
||||
pub rating: u8,
|
||||
pub latency: Option<std::time::Duration>,
|
||||
pub region: Region,
|
||||
}
|
||||
|
||||
impl Server {
|
||||
pub const fn new(host: &'static str, region: Region) -> Self {
|
||||
pub const fn new(host: &'static str) -> Self {
|
||||
Server {
|
||||
host,
|
||||
rating: 255,
|
||||
latency: None,
|
||||
region,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +26,7 @@ impl Server {
|
||||
format!("https://{}/", self.host)
|
||||
}
|
||||
|
||||
async fn rate(&mut self, asn: u32, user_region: Region, is_initial: bool) {
|
||||
async fn rate(&mut self, asn: u32, is_initial: bool) {
|
||||
let timeout = if is_initial {
|
||||
Duration::from_millis(1000)
|
||||
} else {
|
||||
@@ -109,16 +35,15 @@ impl Server {
|
||||
match http::rating_request(&self.url(), timeout).await {
|
||||
Ok((latency, is_cloudflare)) => {
|
||||
self.latency = Some(latency);
|
||||
self.rating = self.calculate_rating(latency, is_cloudflare, asn, user_region);
|
||||
self.rating = self.calculate_rating(latency, is_cloudflare, asn);
|
||||
|
||||
info!(
|
||||
"Server {} rated {} ({}ms, rating: {}, cloudflare: {}, region: {:?})",
|
||||
"Server {} rated {} ({}ms, rating: {}, cloudflare: {})",
|
||||
self.host,
|
||||
self.rating,
|
||||
latency.as_millis(),
|
||||
self.rating,
|
||||
is_cloudflare,
|
||||
self.region
|
||||
);
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -147,13 +72,7 @@ impl Server {
|
||||
rating.clamp(1.0, 255.0) as u8
|
||||
}
|
||||
|
||||
fn calculate_rating(
|
||||
&self,
|
||||
latency: std::time::Duration,
|
||||
is_cloudflare: bool,
|
||||
asn: u32,
|
||||
user_region: Region,
|
||||
) -> u8 {
|
||||
fn calculate_rating(&self, latency: std::time::Duration, is_cloudflare: bool, asn: u32) -> u8 {
|
||||
let mut rating = self.rate_latency(latency);
|
||||
|
||||
// Additional factors for full rating
|
||||
@@ -165,25 +84,6 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
let distance_km = user_region.distance_to(self.region);
|
||||
let region_multiplier = if self.region == Region::Global {
|
||||
1.4
|
||||
} else if distance_km == 0.0 {
|
||||
1.3
|
||||
} else if user_region == Region::Unknown {
|
||||
1.0
|
||||
} else if distance_km <= 2000.0 {
|
||||
1.25
|
||||
} else if distance_km <= 5000.0 {
|
||||
1.15
|
||||
} else if distance_km <= 10000.0 {
|
||||
1.05
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
rating = (rating as f32 * region_multiplier).min(255.0) as u8;
|
||||
|
||||
rating
|
||||
}
|
||||
}
|
||||
@@ -198,23 +98,13 @@ impl Hosts {
|
||||
pub async fn new() -> Self {
|
||||
let cdn_hosts = crate::global::CDN_HOSTS.to_vec();
|
||||
|
||||
let mut hosts = Hosts {
|
||||
let hosts = Hosts {
|
||||
servers: cdn_hosts,
|
||||
active_index: RwLock::new(None),
|
||||
};
|
||||
|
||||
let (asn, region_str) = crate::http::get_location_info().await;
|
||||
let user_region = Region::from_str(®ion_str);
|
||||
info!(
|
||||
"Detected user region as {:?} (region: {})",
|
||||
user_region, region_str
|
||||
);
|
||||
|
||||
hosts.rate(asn, user_region, true).await;
|
||||
|
||||
if hosts.servers.iter().all(|server| server.rating == 0) {
|
||||
info!("All CDN servers failed with 1000ms timeout, retrying with 5000ms timeout");
|
||||
hosts.rate(asn, user_region, false).await;
|
||||
}
|
||||
|
||||
hosts
|
||||
@@ -250,11 +140,11 @@ impl Hosts {
|
||||
}
|
||||
|
||||
/// rate and order all servers, then select the best one
|
||||
pub async fn rate(&mut self, asn: u32, user_region: Region, is_initial: bool) {
|
||||
pub async fn rate(&mut self, asn: u32, is_initial: bool) {
|
||||
let rating_futures: Vec<_> = self
|
||||
.servers
|
||||
.iter_mut()
|
||||
.map(|server| server.rate(asn, user_region, is_initial))
|
||||
.map(|server| server.rate(asn, is_initial))
|
||||
.collect();
|
||||
|
||||
join_all(rating_futures).await;
|
||||
@@ -270,61 +160,3 @@ impl Hosts {
|
||||
self.active_url()
|
||||
}
|
||||
}
|
||||
|
||||
/// CDN rating function for --rate flag
|
||||
pub async fn rate_cdns_and_display() {
|
||||
use colored::Colorize;
|
||||
|
||||
let (asn, region_str) = crate::http::get_location_info().await;
|
||||
let user_region = Region::from_str(®ion_str);
|
||||
|
||||
if user_region == Region::Unknown {
|
||||
println!(
|
||||
"User region: {} (using Global server preference)",
|
||||
"Unknown".bright_red()
|
||||
);
|
||||
} else {
|
||||
println!("User region: {user_region:?}");
|
||||
}
|
||||
|
||||
println!("Rating CDNs...");
|
||||
|
||||
let cdn_hosts = crate::global::CDN_HOSTS.to_vec();
|
||||
|
||||
let mut hosts = Hosts {
|
||||
servers: cdn_hosts,
|
||||
active_index: RwLock::new(None),
|
||||
};
|
||||
|
||||
hosts.rate(asn, user_region, true).await;
|
||||
|
||||
if hosts.servers.iter().all(|server| server.rating == 0) {
|
||||
println!("Retrying with longer timeout...");
|
||||
hosts.rate(asn, user_region, false).await;
|
||||
}
|
||||
|
||||
println!();
|
||||
for server in hosts.servers.iter() {
|
||||
let latency_str = server
|
||||
.latency
|
||||
.map_or("timeout".to_string(), |l| format!("{} ms", l.as_millis()));
|
||||
|
||||
println!(
|
||||
"{}: rating {}, latency {}",
|
||||
server.host.bright_white(),
|
||||
server.rating.to_string().bright_cyan(),
|
||||
latency_str
|
||||
);
|
||||
}
|
||||
|
||||
// Show selected CDN
|
||||
if hosts.next() {
|
||||
if let Some(best_url) = hosts.active_url() {
|
||||
println!();
|
||||
println!("Selected: {}", best_url.bright_green());
|
||||
}
|
||||
} else {
|
||||
println!();
|
||||
println!("{}", "No available CDN servers".bright_red());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ pub async fn latest_version(
|
||||
let tag = latest_tag(owner, repo, prerelease).await?;
|
||||
let cleaned_tag = tag.replace('v', "");
|
||||
Version::parse(&cleaned_tag)
|
||||
.map_err(|e| format!("Failed to parse version '{}': {}", cleaned_tag, e).into())
|
||||
.map_err(|e| format!("Failed to parse version '{cleaned_tag}': {e}").into())
|
||||
}
|
||||
|
||||
pub fn download_url(owner: &str, repo: &str, tag: Option<&str>) -> String {
|
||||
|
||||
@@ -6,18 +6,13 @@ use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::cdn::{Hosts, Region, Server};
|
||||
use crate::cdn::{Hosts, Server};
|
||||
|
||||
pub const GH_OWNER: &str = "alterware";
|
||||
pub const GH_REPO: &str = "alterware-launcher";
|
||||
pub const DEFAULT_MASTER: &str = "https://cdn.alterware.ovh";
|
||||
|
||||
pub const CDN_HOSTS: [Server; 2] = [
|
||||
Server::new("cdn.alterware.ovh", Region::Global),
|
||||
Server::new("us-cdn.alterware.ovh", Region::NorthAmerica),
|
||||
];
|
||||
|
||||
pub const IP2ASN: &str = "https://ip2asn.getserve.rs/v1/as/ip/self";
|
||||
pub const CDN_HOSTS: [Server; 1] = [Server::new("cdn.alterware.ovh")];
|
||||
|
||||
pub static USER_AGENT: Lazy<String> = Lazy::new(|| {
|
||||
format!(
|
||||
@@ -31,8 +26,6 @@ pub static USER_AGENT: Lazy<String> = Lazy::new(|| {
|
||||
|
||||
pub static MASTER_URL: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new(String::from(DEFAULT_MASTER)));
|
||||
|
||||
pub static IS_OFFLINE: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
|
||||
|
||||
pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
|
||||
HashMap::from([
|
||||
(
|
||||
@@ -79,54 +72,3 @@ pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
|
||||
),
|
||||
])
|
||||
});
|
||||
|
||||
pub async fn check_connectivity_and_rate_cdns() -> Pin<Box<dyn Future<Output = bool> + Send>> {
|
||||
Box::pin(async move {
|
||||
crate::println_info!("Initializing CDN rating system...");
|
||||
let hosts = Hosts::new().await;
|
||||
let best_cdn = hosts.get_master_url();
|
||||
|
||||
if let Some(cdn_url) = best_cdn {
|
||||
let cdn_url = cdn_url.trim_end_matches('/');
|
||||
*MASTER_URL.lock().unwrap() = cdn_url.to_string();
|
||||
crate::println_info!("Selected CDN: {}", cdn_url);
|
||||
|
||||
match crate::http_async::get_body_string(cdn_url).await {
|
||||
Ok(_) => {
|
||||
info!("Successfully connected to CDN: {}", cdn_url);
|
||||
true
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Failed to connect to selected CDN {}: {}", cdn_url, e);
|
||||
*IS_OFFLINE.lock().unwrap() = true;
|
||||
false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
crate::println_error!("No CDN hosts are available");
|
||||
*IS_OFFLINE.lock().unwrap() = true;
|
||||
false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn check_connectivity(
|
||||
master_url: Option<String>,
|
||||
) -> Pin<Box<dyn Future<Output = bool> + Send>> {
|
||||
Box::pin(async move {
|
||||
if let Some(url) = master_url {
|
||||
*MASTER_URL.lock().unwrap() = url.clone();
|
||||
crate::println_info!("Using fallback connectivity check on {}", url);
|
||||
|
||||
match crate::http_async::get_body_string(&url).await {
|
||||
Ok(_) => true,
|
||||
Err(_) => {
|
||||
*IS_OFFLINE.lock().unwrap() = true;
|
||||
false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
check_connectivity_and_rate_cdns().await.await
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
43
src/http.rs
43
src/http.rs
@@ -1,5 +1,4 @@
|
||||
use reqwest::header::HeaderMap;
|
||||
use serde_json::Value;
|
||||
use simple_log::*;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
@@ -17,18 +16,18 @@ pub async fn quick_request(url: &str) -> Result<String, Box<dyn std::error::Erro
|
||||
.await;
|
||||
|
||||
if let Err(e) = &res {
|
||||
error!("Failed to get {}: {}", url, e);
|
||||
return Err(format!("Failed to get {} {}", url, e).into());
|
||||
error!("Failed to get {url}: {e}");
|
||||
return Err(format!("Failed to get {url} {e}").into());
|
||||
}
|
||||
|
||||
let res = res.unwrap();
|
||||
match res.text().await {
|
||||
Ok(text) => {
|
||||
info!("Successfully received response from: {}", url);
|
||||
info!("Successfully received response from: {url}");
|
||||
Ok(text)
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to get response text from {}: {}", url, e);
|
||||
warn!("Failed to get response text from {url}: {e}");
|
||||
Err(e.into())
|
||||
}
|
||||
}
|
||||
@@ -64,8 +63,8 @@ pub async fn rating_request(
|
||||
let latency = start.elapsed();
|
||||
|
||||
if let Err(e) = &res {
|
||||
error!("Failed to get {}: {} (after {:?})", url, e, latency);
|
||||
return Err(format!("Failed to get {} {} (after {:?})", url, e, latency).into());
|
||||
error!("Failed to get {url}: {e} (after {latency:?})");
|
||||
return Err(format!("Failed to get {url} {e} (after {latency:?})").into());
|
||||
}
|
||||
|
||||
let res = res.unwrap();
|
||||
@@ -74,36 +73,10 @@ pub async fn rating_request(
|
||||
|
||||
// We don't need the response body for rating
|
||||
if let Err(e) = res.text().await {
|
||||
warn!(
|
||||
"Failed to get response text from {}: {} (after {:?})",
|
||||
url, e, latency
|
||||
);
|
||||
warn!("Failed to get response text from {url}: {e} (after {latency:?})");
|
||||
return Err(e.into());
|
||||
}
|
||||
|
||||
info!(
|
||||
"Successfully rated {} in {:?} (cloudflare: {})",
|
||||
url, latency, is_cloudflare
|
||||
);
|
||||
info!("Successfully rated {url} in {latency:?} (cloudflare: {is_cloudflare})");
|
||||
Ok((latency, is_cloudflare))
|
||||
}
|
||||
|
||||
/// Retrieve client ASN and region
|
||||
pub async fn get_location_info() -> (u32, String) {
|
||||
let response = quick_request(crate::global::IP2ASN).await;
|
||||
if let Ok(as_data_str) = response {
|
||||
if let Ok(as_data) = serde_json::from_str::<Value>(&as_data_str) {
|
||||
let as_number = as_data
|
||||
.get("as_number")
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(0) as u32;
|
||||
let region = as_data
|
||||
.get("region")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("Unknown")
|
||||
.to_string();
|
||||
return (as_number, region);
|
||||
}
|
||||
}
|
||||
(0, "Unknown".to_string())
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ pub async fn download_file_progress(
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("Failed to GET from '{}': {}", url, e);
|
||||
error!("Failed to GET from '{url}': {e}");
|
||||
format!("Failed to GET from '{url}'")
|
||||
})?;
|
||||
|
||||
@@ -89,14 +89,14 @@ pub async fn get_body(url: &str) -> Result<Vec<u8>, String> {
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| format!("Failed to send request: {}", e))?;
|
||||
.map_err(|e| format!("Failed to send request: {e}"))?;
|
||||
|
||||
debug!("{} {url}", res.status());
|
||||
|
||||
res.bytes()
|
||||
.await
|
||||
.map(|b| b.to_vec())
|
||||
.map_err(|e| format!("Failed to get body: {}", e))
|
||||
.map_err(|e| format!("Failed to get body: {e}"))
|
||||
}
|
||||
|
||||
pub async fn get_body_string(url: &str) -> Result<String, String> {
|
||||
@@ -119,7 +119,7 @@ pub async fn get_json<T: serde::de::DeserializeOwned>(url: &str) -> Result<T, St
|
||||
.header("Accept", "application/json")
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| format!("Failed to send request: {}", e))?;
|
||||
.map_err(|e| format!("Failed to send request: {e}"))?;
|
||||
|
||||
debug!("{} {}", res.status(), url);
|
||||
|
||||
@@ -130,7 +130,7 @@ pub async fn get_json<T: serde::de::DeserializeOwned>(url: &str) -> Result<T, St
|
||||
let body = res
|
||||
.bytes()
|
||||
.await
|
||||
.map_err(|e| format!("Failed to read response body: {}", e))?;
|
||||
.map_err(|e| format!("Failed to read response body: {e}"))?;
|
||||
|
||||
serde_json::from_slice::<T>(&body).map_err(|e| format!("Failed to parse JSON: {}", e))
|
||||
serde_json::from_slice::<T>(&body).map_err(|e| format!("Failed to parse JSON: {e}"))
|
||||
}
|
||||
|
||||
24
src/main.rs
24
src/main.rs
@@ -626,8 +626,6 @@ async fn main() {
|
||||
println!(" --redist: (Re-)Install redistributables");
|
||||
println!(" --prerelease: Update to prerelease version of clients and launcher");
|
||||
println!(" --offline: Run in offline mode");
|
||||
println!(" --skip-connectivity-check: Don't check connectivity");
|
||||
println!(" --rate: Display CDN rating information and exit");
|
||||
println!("\nExample:\n alterware-launcher.exe iw6 --pass \"-headless\"");
|
||||
return;
|
||||
}
|
||||
@@ -663,11 +661,6 @@ async fn main() {
|
||||
install_path = env::current_dir().unwrap();
|
||||
}
|
||||
|
||||
if arg_bool(&args, "--rate") {
|
||||
cdn::rate_cdns_and_display().await;
|
||||
return;
|
||||
}
|
||||
|
||||
let mut cfg = config::load(install_path.join("alterware-launcher.json"));
|
||||
|
||||
if let Some(cdn_url) = arg_value(&args, "--cdn-url") {
|
||||
@@ -680,11 +673,6 @@ async fn main() {
|
||||
arg_remove(&mut args, "--offline");
|
||||
}
|
||||
|
||||
if arg_bool(&args, "--skip-connectivity-check") {
|
||||
cfg.skip_connectivity_check = true;
|
||||
arg_remove(&mut args, "--skip-connectivity-check");
|
||||
}
|
||||
|
||||
let initial_cdn = if !cfg.cdn_url.is_empty() {
|
||||
info!("Using custom CDN URL: {}", cfg.cdn_url);
|
||||
Some(cfg.cdn_url.clone())
|
||||
@@ -692,14 +680,6 @@ async fn main() {
|
||||
None
|
||||
};
|
||||
|
||||
if !cfg.offline && !cfg.skip_connectivity_check {
|
||||
if initial_cdn.is_some() {
|
||||
cfg.offline = !global::check_connectivity(initial_cdn).await;
|
||||
} else {
|
||||
cfg.offline = !global::check_connectivity_and_rate_cdns().await.await;
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.offline {
|
||||
// Check if this is a first-time run (no stored data)
|
||||
let stored_data = cache::get_stored_data();
|
||||
@@ -763,9 +743,9 @@ async fn main() {
|
||||
std::process::exit(1);
|
||||
};
|
||||
|
||||
info!("Launching game in offline mode with client: {}", client);
|
||||
info!("Launching game in offline mode with client: {client}");
|
||||
// Launch game without updates
|
||||
launch(&install_path.join(format!("{}.exe", client)), &cfg.args);
|
||||
launch(&install_path.join(format!("{client}.exe")), &cfg.args);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ pub fn is_program_in_path(program: &str) -> bool {
|
||||
paths.to_str().map(|paths| {
|
||||
paths
|
||||
.split(':')
|
||||
.any(|dir| fs::metadata(format!("{}/{}", dir, program)).is_ok())
|
||||
.any(|dir| fs::metadata(format!("{dir}/{program}")).is_ok())
|
||||
})
|
||||
})
|
||||
.unwrap_or(false)
|
||||
@@ -53,9 +53,9 @@ pub fn is_program_in_path(program: &str) -> bool {
|
||||
.and_then(|paths| {
|
||||
paths.to_str().map(|paths| {
|
||||
paths.split(';').any(|dir| {
|
||||
fs::metadata(format!("{}\\{}.exe", dir, program)).is_ok()
|
||||
|| fs::metadata(format!("{}\\{}.cmd", dir, program)).is_ok()
|
||||
|| fs::metadata(format!("{}\\{}.bat", dir, program)).is_ok()
|
||||
fs::metadata(format!("{dir}\\{program}.exe")).is_ok()
|
||||
|| fs::metadata(format!("{dir}\\{program}.cmd")).is_ok()
|
||||
|| fs::metadata(format!("{dir}\\{program}.bat")).is_ok()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ pub async fn self_update_available(prerelease: Option<bool>) -> bool {
|
||||
let latest_version = match github::latest_version(GH_OWNER, GH_REPO, prerelease).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error!("Failed to get latest version: {}", e);
|
||||
error!("Failed to get latest version: {e}");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,8 +54,6 @@ pub struct Config {
|
||||
pub cdn_url: String,
|
||||
#[serde(default)]
|
||||
pub offline: bool,
|
||||
#[serde(default)]
|
||||
pub skip_connectivity_check: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@@ -73,7 +71,6 @@ impl Default for Config {
|
||||
prerelease: false,
|
||||
cdn_url: String::default(),
|
||||
offline: false,
|
||||
skip_connectivity_check: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user