44 Commits

Author SHA1 Message Date
alterware
f9a64a9a45 chore: remove unused but there is like 20 more 2025-11-21 16:47:25 +01:00
alterware
72ac6d56aa chore: remove dead service (2nd attempt) 2025-11-21 16:44:07 +01:00
alterware
695a8174c8 chore: remove dead service 2025-11-21 16:29:45 +01:00
36aab56037 Merge pull request #29 from alterware/dependabot/cargo/openssl-0.10.74
Bump openssl from 0.10.73 to 0.10.74
2025-11-04 12:57:12 +01:00
79477bf231 Merge pull request #26 from alterware/dependabot/cargo/simple-log-2.4.0
Bump simple-log from 2.3.0 to 2.4.0
2025-11-04 12:56:59 +01:00
3d9bb6c424 Merge pull request #27 from alterware/dependabot/cargo/rand-0.9.2
Bump rand from 0.9.1 to 0.9.2
2025-11-04 12:56:51 +01:00
334e989c2d Merge pull request #28 from alterware/dependabot/cargo/reqwest-0.12.24
Bump reqwest from 0.12.23 to 0.12.24
2025-11-04 12:56:42 +01:00
dependabot[bot]
b4b6c93e3d Bump openssl from 0.10.73 to 0.10.74
Bumps [openssl](https://github.com/rust-openssl/rust-openssl) from 0.10.73 to 0.10.74.
- [Release notes](https://github.com/rust-openssl/rust-openssl/releases)
- [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.73...openssl-v0.10.74)

---
updated-dependencies:
- dependency-name: openssl
  dependency-version: 0.10.74
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-01 14:17:28 +00:00
dependabot[bot]
b658ac5ae1 Bump reqwest from 0.12.23 to 0.12.24
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.12.23 to 0.12.24.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.23...v0.12.24)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-version: 0.12.24
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-01 14:17:19 +00:00
dependabot[bot]
57a3c315bf Bump rand from 0.9.1 to 0.9.2
Bumps [rand](https://github.com/rust-random/rand) from 0.9.1 to 0.9.2.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/rand_core-0.9.1...rand_core-0.9.2)

---
updated-dependencies:
- dependency-name: rand
  dependency-version: 0.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-01 14:17:09 +00:00
dependabot[bot]
3717f1315e Bump simple-log from 2.3.0 to 2.4.0
Bumps [simple-log](https://github.com/baoyachi/simple-log) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/baoyachi/simple-log/releases)
- [Commits](https://github.com/baoyachi/simple-log/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: simple-log
  dependency-version: 2.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-01 14:17:01 +00:00
9442c733f9 Merge pull request #22 from alterware/dependabot/cargo/serde_json-1.0.145
Bump serde_json from 1.0.142 to 1.0.145
2025-10-09 10:02:50 +02:00
71a3ccdf47 Merge pull request #21 from alterware/dependabot/cargo/reqwest-0.12.23
Bump reqwest from 0.12.22 to 0.12.23
2025-10-09 10:02:42 +02:00
2454b25d56 Merge pull request #23 from alterware/dependabot/cargo/semver-1.0.27
Bump semver from 1.0.26 to 1.0.27
2025-10-09 10:02:34 +02:00
c8155761f2 Merge pull request #24 from alterware/dependabot/cargo/tokio-1.47.1
Bump tokio from 1.45.1 to 1.47.1
2025-10-09 10:02:26 +02:00
ab872bd2ab Merge pull request #25 from alterware/dependabot/github_actions/actions/checkout-5
Bump actions/checkout from 4 to 5
2025-10-09 10:02:16 +02:00
dependabot[bot]
7f977ea680 Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-01 14:38:55 +00:00
dependabot[bot]
cfa3629fa0 Bump tokio from 1.45.1 to 1.47.1
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.45.1 to 1.47.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.45.1...tokio-1.47.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-version: 1.47.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-01 14:34:32 +00:00
dependabot[bot]
0b35a865b4 Bump semver from 1.0.26 to 1.0.27
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.26 to 1.0.27.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.26...1.0.27)

---
updated-dependencies:
- dependency-name: semver
  dependency-version: 1.0.27
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-01 14:34:22 +00:00
dependabot[bot]
cc62261b2f Bump serde_json from 1.0.142 to 1.0.145
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.142 to 1.0.145.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.142...v1.0.145)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-version: 1.0.145
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-01 14:34:11 +00:00
dependabot[bot]
cfc9826fb0 Bump reqwest from 0.12.22 to 0.12.23
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.12.22 to 0.12.23.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.22...v0.12.23)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-version: 0.12.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-01 14:34:00 +00:00
066311f7bb Merge pull request #20 from alterware/dependabot/cargo/reqwest-0.12.22
Bump reqwest from 0.12.21 to 0.12.22
2025-08-06 09:15:39 +02:00
d9b7f7fc07 Merge pull request #19 from alterware/dependabot/cargo/indicatif-0.18.0
Bump indicatif from 0.17.12 to 0.18.0
2025-08-06 09:15:30 +02:00
1f7142b30b Merge pull request #18 from alterware/dependabot/cargo/winresource-0.1.23
Bump winresource from 0.1.19 to 0.1.23
2025-08-06 09:15:24 +02:00
b69f2e3338 Merge pull request #17 from alterware/dependabot/cargo/serde_json-1.0.142
Bump serde_json from 1.0.140 to 1.0.142
2025-08-06 09:15:07 +02:00
dependabot[bot]
2cd227fec4 Bump reqwest from 0.12.21 to 0.12.22
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.12.21 to 0.12.22.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.21...v0.12.22)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-version: 0.12.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-01 15:05:55 +00:00
dependabot[bot]
c9cb2c3604 Bump indicatif from 0.17.12 to 0.18.0
Bumps [indicatif](https://github.com/console-rs/indicatif) from 0.17.12 to 0.18.0.
- [Release notes](https://github.com/console-rs/indicatif/releases)
- [Commits](https://github.com/console-rs/indicatif/compare/0.17.12...0.18.0)

---
updated-dependencies:
- dependency-name: indicatif
  dependency-version: 0.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-01 15:05:43 +00:00
dependabot[bot]
2c2184a8b3 Bump winresource from 0.1.19 to 0.1.23
Bumps [winresource](https://github.com/BenjaminRi/winresource) from 0.1.19 to 0.1.23.
- [Commits](https://github.com/BenjaminRi/winresource/commits)

---
updated-dependencies:
- dependency-name: winresource
  dependency-version: 0.1.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-01 15:05:34 +00:00
dependabot[bot]
609bfde418 Bump serde_json from 1.0.140 to 1.0.142
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.140 to 1.0.142.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.140...v1.0.142)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-version: 1.0.142
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-01 15:05:25 +00:00
alterware
a2e4f304dc chore: more linting 2025-07-03 10:32:57 +02:00
alterware
2dab50111b chore: some linting 2025-07-03 10:27:52 +02:00
27795f6680 Merge pull request #13 from alterware/dependabot/cargo/openssl-0.10.73
Bump openssl from 0.10.71 to 0.10.73
2025-07-03 09:41:24 +02:00
39db6099e4 Merge pull request #12 from alterware/dependabot/cargo/reqwest-0.12.21
Bump reqwest from 0.12.20 to 0.12.21
2025-07-03 09:41:00 +02:00
0493a7a4d8 Merge pull request #14 from alterware/dependabot/cargo/indicatif-0.17.12
Bump indicatif from 0.17.11 to 0.17.12
2025-07-03 09:40:49 +02:00
bb9ebcf830 Merge pull request #15 from alterware/dependabot/cargo/semver-1.0.26
Bump semver from 1.0.25 to 1.0.26
2025-07-03 09:40:32 +02:00
1e2dca0162 Merge pull request #16 from alterware/dependabot/github_actions/taiki-e/upload-rust-binary-action-1.27.0
Bump taiki-e/upload-rust-binary-action from 1.26.0 to 1.27.0
2025-07-03 09:40:21 +02:00
dependabot[bot]
d4e7cb1eb1 Bump taiki-e/upload-rust-binary-action from 1.26.0 to 1.27.0
Bumps [taiki-e/upload-rust-binary-action](https://github.com/taiki-e/upload-rust-binary-action) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/taiki-e/upload-rust-binary-action/releases)
- [Changelog](https://github.com/taiki-e/upload-rust-binary-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/upload-rust-binary-action/compare/v1.26.0...v1.27.0)

---
updated-dependencies:
- dependency-name: taiki-e/upload-rust-binary-action
  dependency-version: 1.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 14:48:32 +00:00
dependabot[bot]
cb2f433c39 Bump semver from 1.0.25 to 1.0.26
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.25 to 1.0.26.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.25...1.0.26)

---
updated-dependencies:
- dependency-name: semver
  dependency-version: 1.0.26
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 14:44:26 +00:00
dependabot[bot]
764a892f71 Bump indicatif from 0.17.11 to 0.17.12
Bumps [indicatif](https://github.com/console-rs/indicatif) from 0.17.11 to 0.17.12.
- [Release notes](https://github.com/console-rs/indicatif/releases)
- [Commits](https://github.com/console-rs/indicatif/compare/0.17.11...0.17.12)

---
updated-dependencies:
- dependency-name: indicatif
  dependency-version: 0.17.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 14:44:19 +00:00
dependabot[bot]
66554a0374 Bump openssl from 0.10.71 to 0.10.73
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.71 to 0.10.73.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.71...openssl-v0.10.73)

---
updated-dependencies:
- dependency-name: openssl
  dependency-version: 0.10.73
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 14:44:12 +00:00
dependabot[bot]
e96e0ca630 Bump reqwest from 0.12.20 to 0.12.21
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.12.20 to 0.12.21.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/commits)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-version: 0.12.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 14:44:04 +00:00
alterware
a30d6950c8 chore: remove more iw4x stuff 2025-06-30 18:27:03 +02:00
alterware
6f241dffe2 v0.11.2 2025-06-13 08:35:26 +02:00
Spencer
806758088d maint: use UMU if found (#11) 2025-06-13 08:30:55 +02:00
16 changed files with 196 additions and 560 deletions

View File

@@ -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

View File

@@ -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
View File

@@ -19,7 +19,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "alterware-launcher"
version = "0.11.1"
version = "0.11.4"
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",

View File

@@ -1,6 +1,6 @@
[package]
name = "alterware-launcher"
version = "0.11.1"
version = "0.11.4"
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]

View File

@@ -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`
---

View File

@@ -15,7 +15,7 @@ pub fn save_cache(dir: &Path, cache: Cache) {
let cache_path = dir.join("awcache.json");
let cache_serialized = serde_json::to_string_pretty(&cache).unwrap();
fs::write(cache_path, cache_serialized).unwrap_or_else(|e| {
error!("Failed to save cache: {}", e);
error!("Failed to save cache: {e}");
});
}

View File

@@ -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(&region_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(&region_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());
}
}

View File

@@ -17,17 +17,13 @@ pub async fn latest_tag_full(
repo: &str,
) -> Result<String, Box<dyn std::error::Error>> {
let github_body = crate::http_async::get_body_string(
format!(
"https://api.github.com/repos/{}/{}/releases/latest",
owner, repo
)
.as_str(),
format!("https://api.github.com/repos/{owner}/{repo}/releases/latest").as_str(),
)
.await
.map_err(|e| format!("Failed to fetch GitHub API: {}", e))?;
.map_err(|e| format!("Failed to fetch GitHub API: {e}"))?;
let github_json: serde_json::Value = serde_json::from_str(&github_body)
.map_err(|e| format!("Failed to parse GitHub API response: {}", e))?;
.map_err(|e| format!("Failed to parse GitHub API response: {e}"))?;
let tag_name = github_json
.get("tag_name")
@@ -43,13 +39,13 @@ pub async fn latest_tag_prerelease(
repo: &str,
) -> Result<String, Box<dyn std::error::Error>> {
let github_body = crate::http_async::get_body_string(
format!("https://api.github.com/repos/{}/{}/releases", owner, repo).as_str(),
format!("https://api.github.com/repos/{owner}/{repo}/releases").as_str(),
)
.await
.map_err(|e| format!("Failed to fetch GitHub API: {}", e))?;
.map_err(|e| format!("Failed to fetch GitHub API: {e}"))?;
let github_json: serde_json::Value = serde_json::from_str(&github_body)
.map_err(|e| format!("Failed to parse GitHub API response: {}", e))?;
.map_err(|e| format!("Failed to parse GitHub API response: {e}"))?;
let latest_release = github_json.get(0).ok_or("No releases found")?;
@@ -70,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 {

View File

@@ -6,21 +6,17 @@ 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 GH_IW4X_OWNER: &str = "iw4x";
pub const GH_IW4X_REPO: &str = "iw4x-client";
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),
Server::new("cdn.alterware.ovh"),
Server::new("us-cdn.alterware.ovh"),
];
pub const IP2ASN: &str = "https://ip2asn.getserve.rs/v1/as/ip/self";
pub static USER_AGENT: Lazy<String> = Lazy::new(|| {
format!(
"AlterWare Launcher v{} on {} | github.com/{}/{}",
@@ -33,8 +29,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([
(
@@ -81,54 +75,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
}
})
}

View File

@@ -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())
}

View File

@@ -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}"))
}

View File

@@ -1,46 +0,0 @@
use crate::extend::*;
use crate::github;
use crate::global::*;
use crate::http_async;
use crate::misc;
use crate::structs;
use std::path::Path;
pub async fn remote_revision(prerelease: Option<bool>) -> u16 {
match github::latest_tag(GH_IW4X_OWNER, GH_IW4X_REPO, prerelease).await {
Ok(tag) => misc::rev_to_int(&tag),
Err(_) => {
crate::println_error!("Failed to get latest version for {GH_IW4X_OWNER}/{GH_IW4X_REPO}, assuming we are up to date.");
0
}
}
}
pub async fn update(dir: &Path, cache: &mut structs::Cache, prerelease: Option<bool>) {
let remote = remote_revision(prerelease).await;
let local = misc::rev_to_int(&cache.iw4x_revision);
if remote <= local && dir.join("iw4x.dll").exists() {
crate::println_info!("No files to download for IW4x");
return;
}
crate::println_info!("Downloading outdated or missing files for IW4x",);
println!(
"{}{}",
misc::prefix("downloading"),
dir.join("iw4x.dll").cute_path()
);
http_async::download_file(
&format!(
"{}/iw4x.dll",
github::download_url(GH_IW4X_OWNER, GH_IW4X_REPO, Some(&format!("r{remote}")))
),
&dir.join("iw4x.dll"),
)
.await
.unwrap();
cache.iw4x_revision = format!("r{remote}");
}

View File

@@ -6,7 +6,6 @@ mod github;
mod global;
mod http;
mod http_async;
mod iw4x;
mod misc;
mod self_update;
mod structs;
@@ -28,7 +27,7 @@ use mslnk::ShellLink;
use simple_log::LogConfigBuilder;
use std::{
borrow::Cow,
collections::{HashMap, HashSet},
collections::HashMap,
env, fs,
path::{Path, PathBuf},
};
@@ -117,7 +116,7 @@ fn setup_desktop_links(path: &Path, game: &Game) {
async fn auto_install(path: &Path, game: &Game<'_>) {
setup_client_links(game, path);
setup_desktop_links(path, game);
update(game, path, false, false, None, None, None).await;
update(game, path, false, false, None).await;
}
#[cfg(windows)]
@@ -187,7 +186,7 @@ fn total_download_size(cdn_info: &Vec<CdnFile>, remote_dir: &str) -> u64 {
let remote_dir = format!("{remote_dir}/");
let mut size: u64 = 0;
for file in cdn_info {
if !file.name.starts_with(&remote_dir) || file.name == "iw4/iw4x.dll" {
if !file.name.starts_with(&remote_dir) {
continue;
}
size += file.size as u64;
@@ -201,7 +200,6 @@ async fn update_dir(
dir: &Path,
hashes: &mut HashMap<String, String>,
pb: &ProgressBar,
skip_iw4x_sp: bool,
) {
misc::pb_style_download(pb, false);
@@ -210,10 +208,7 @@ async fn update_dir(
let mut files_to_download: Vec<CdnFile> = vec![];
for file in cdn_info {
if !file.name.starts_with(&remote_dir_pre) || file.name == "iw4/iw4x.dll" {
continue;
}
if skip_iw4x_sp && file.name == "iw4/iw4x-sp.exe" {
if !file.name.starts_with(&remote_dir_pre) {
continue;
}
@@ -337,15 +332,12 @@ async fn update(
dir: &Path,
bonus_content: bool,
force: bool,
skip_iw4x_sp: Option<bool>,
ignore_required_files: Option<bool>,
prerelease: 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 ignore_required_files = ignore_required_files.unwrap_or(false);
let res =
@@ -405,66 +397,12 @@ async fn update(
}
}
if game.engine == "iw4" {
iw4x::update(dir, &mut cache, prerelease).await;
let scan_dirs = ["iw4x", "zone/patch"];
let valid_files: HashSet<_> = cdn_info
.iter()
.filter_map(|cdn_file| {
if cdn_file.name.starts_with("iw4/") || cdn_file.name.starts_with("iw4-dlc/") {
Some(Path::new(&cdn_file.name).to_path_buf())
} else {
None
}
})
.collect();
for scan_dir in scan_dirs.iter() {
let full_scan_dir = dir.join(scan_dir);
if !full_scan_dir.exists() || !full_scan_dir.is_dir() {
continue;
}
for entry in walkdir::WalkDir::new(&full_scan_dir)
.into_iter()
.filter_map(Result::ok)
.filter(|e| e.file_type().is_file())
{
let rel_path = entry.path().strip_prefix(dir).unwrap_or(entry.path());
let cdn_paths = [
Path::new("iw4").join(rel_path),
Path::new("iw4-dlc").join(rel_path),
];
if !cdn_paths.iter().any(|path| valid_files.contains(path)) {
crate::println_info!("{}{}", misc::prefix("removed"), entry.path().cute_path());
if std::fs::remove_file(entry.path()).is_err() {
crate::println_error!(
"{}Couldn't delete {}",
misc::prefix("error"),
entry.path().cute_path()
);
}
}
}
}
}
let pb = ProgressBar::new(0);
update_dir(
&cdn_info,
game.engine,
dir,
&mut cache.hashes,
&pb,
skip_iw4x_sp,
)
.await;
update_dir(&cdn_info, game.engine, dir, &mut cache.hashes, &pb).await;
if bonus_content && !game.bonus.is_empty() {
for bonus in game.bonus.iter() {
update_dir(&cdn_info, bonus, dir, &mut cache.hashes, &pb, skip_iw4x_sp).await;
update_dir(&cdn_info, bonus, dir, &mut cache.hashes, &pb).await;
}
}
@@ -549,9 +487,18 @@ fn launch(file_path: &PathBuf, args: &str) {
fn launch(file_path: &PathBuf, args: &str) {
println!("\n\nJoin the AlterWare Discord server:\nhttps://discord.gg/2ETE8engZM\n\n");
crate::println_info!("Launching {} {args}", file_path.display());
let exit_status = if misc::is_program_in_path("wine") {
println!("Found wine, launching game using wine.\nIf you run into issues or want to launch a different way, run {} manually.", file_path.display());
std::process::Command::new("wine")
let launcher = if misc::is_program_in_path("umu-run") {
Some("umu-run")
} else if misc::is_program_in_path("wine") {
Some("wine")
} else {
None
};
let exit_status = if let Some(launcher) = launcher {
println!("Found {launcher}, launching game using {launcher}.\nIf you run into issues or want to launch a different way, run {} manually.", file_path.display());
std::process::Command::new(launcher)
.args([file_path.to_str().unwrap(), args.trim()])
.current_dir(file_path.parent().unwrap())
.spawn()
@@ -627,7 +574,7 @@ fn show_iw4x_info() {
"{}",
"IW4x is not provided through AlterWare anymore.".bright_red()
);
println!("Please use iw4x-launcher.exe instead or visit www.iw4x.dev/install");
println!("Please visit https://aka.alterware.dev/iw4x for more information");
misc::stdin();
std::process::exit(0);
}
@@ -679,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;
}
@@ -716,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") {
@@ -733,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())
@@ -745,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();
@@ -816,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;
}
@@ -944,14 +871,6 @@ async fn main() {
"engine",
cfg.engine.clone(),
);
if cfg.engine == "iw4" && cfg.args.is_empty() {
cfg.args = String::from("-stdout");
config::save_value_s(
install_path.join("alterware-launcher.json"),
"args",
cfg.args.clone(),
);
}
#[cfg(windows)]
if !cfg.skip_redist {
@@ -980,9 +899,7 @@ async fn main() {
install_path.as_path(),
cfg.download_bonus_content,
cfg.force_update,
Some(&game != "iw4x-sp"),
Some(ignore_required_files),
Some(cfg.prerelease),
)
.await;
if !cfg.update_only {

View File

@@ -12,13 +12,6 @@ pub fn stdin() -> String {
input.trim().to_string()
}
pub fn rev_to_int(rev: &str) -> u16 {
rev.strip_prefix('r')
.unwrap_or("0")
.parse::<u16>()
.unwrap_or(0)
}
pub fn human_readable_bytes(bytes: u64) -> String {
let mut bytes = bytes as f64;
let mut i = 0;
@@ -48,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)
@@ -60,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()
})
})
})

View File

@@ -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;
}
};

View File

@@ -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,
}
}
}