265 Commits

Author SHA1 Message Date
dc6a61b8fc v0.6.10 2024-03-01 10:38:19 +01:00
87535fb839 add delete support for dirs 2024-03-01 10:37:56 +01:00
4d6f056d7b use_https default true 2024-02-29 10:33:31 +01:00
c9ead57ee5 Merge pull request #82 from mxve/dependabot/cargo/serde-1.0.197
Bump serde from 1.0.196 to 1.0.197
2024-02-27 05:53:24 +01:00
d441eeaa36 Bump serde from 1.0.196 to 1.0.197
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.196 to 1.0.197.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.196...v1.0.197)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-27 04:47:07 +00:00
2143b86d07 Merge pull request #81 from mxve/dependabot/cargo/serde_json-1.0.114
Bump serde_json from 1.0.113 to 1.0.114
2024-02-27 05:46:08 +01:00
5372fba0d6 Merge pull request #80 from mxve/dependabot/cargo/openssl-0.10.64
Bump openssl from 0.10.63 to 0.10.64
2024-02-27 05:45:59 +01:00
b0e445400a Bump serde_json from 1.0.113 to 1.0.114
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.113 to 1.0.114.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.113...v1.0.114)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-26 16:01:59 +00:00
a71c789e29 Bump openssl from 0.10.63 to 0.10.64
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.63 to 0.10.64.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.63...openssl-v0.10.64)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-26 16:01:49 +00:00
a561839fd0 Merge pull request #79 from mxve/feat/aarch-macos-release
build: add macos and aarc64 release builds
2024-02-25 22:07:43 +01:00
Edo
4ddd3c3ca7 build: add macos and aarc64 release builds
WINE should run on macOS and ARM64 because why not
2024-02-25 16:31:11 +01:00
bb66366f41 write games.json content to file on error 2024-02-20 19:54:16 +01:00
bd26533ae2 add debug print to get_body 2024-02-20 19:44:11 +01:00
1452dfb265 v0.6.8 2024-02-20 02:00:20 +01:00
55328a969b remove unused imports 2024-02-20 01:56:23 +01:00
512a073b07 remove debug print 2024-02-20 01:47:35 +01:00
99010664bf fix unix self_update::run 2024-02-20 01:37:46 +01:00
c93fcba652 Merge pull request #78 from mxve/dependabot/cargo/semver-1.0.22
Bump semver from 1.0.21 to 1.0.22
2024-02-20 01:33:09 +01:00
5450109cf2 remove http_req from deps 2024-02-20 01:28:49 +01:00
02c3004231 fully replace http_req with reqwest
close #43
Should also help to either resolve or at least investigate seemingly random TLS & IO errors #64 #77
2024-02-20 01:28:31 +01:00
6bb96006de Bump semver from 1.0.21 to 1.0.22
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.21 to 1.0.22.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.21...1.0.22)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 15:21:09 +00:00
9de8543590 Merge branch 'main' of github.com:mxve/alterware-launcher 2024-02-15 01:05:46 +01:00
dba849e3be add --ignore-required-files to --help 2024-02-15 01:05:42 +01:00
399d7da9aa Merge pull request #76 from mxve/dependabot/cargo/indicatif-0.17.8
Bump indicatif from 0.17.7 to 0.17.8
2024-02-12 17:17:21 +01:00
2454547c8f Bump indicatif from 0.17.7 to 0.17.8
Bumps [indicatif](https://github.com/console-rs/indicatif) from 0.17.7 to 0.17.8.
- [Release notes](https://github.com/console-rs/indicatif/releases)
- [Commits](https://github.com/console-rs/indicatif/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 15:22:11 +00:00
3d0a47ec60 prepare v0.6.7 2024-02-09 19:13:11 +01:00
5ef075d4c3 add --ignore-required-files 2024-02-09 18:45:19 +01:00
e8aee89f45 check for required files 2024-02-07 12:53:43 +01:00
2760e2ab1e keep console open & exit process when game not found 2024-02-07 12:29:58 +01:00
d44ae36f86 whoopsie 2024-02-07 12:23:31 +01:00
6e3c06af86 remove unused src files 2024-02-07 12:06:11 +01:00
fcdc875272 add use_https
close #70
2024-02-07 12:05:57 +01:00
32d1b129c8 only download iw4x-sp if selected
close #63
2024-02-07 11:52:21 +01:00
1dd18317cf require references
close #67
2024-02-07 11:37:34 +01:00
ccdde3d99f Merge pull request #73 from mxve/dependabot/cargo/serde-1.0.196
Bump serde from 1.0.195 to 1.0.196
2024-02-07 11:29:14 +01:00
d5973b0aff Bump serde from 1.0.195 to 1.0.196
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.195 to 1.0.196.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.195...v1.0.196)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-07 10:15:01 +00:00
652b908a39 Merge pull request #75 from mxve/dependabot/cargo/tokio-1.36.0
Bump tokio from 1.35.1 to 1.36.0
2024-02-07 11:14:44 +01:00
f387a34b35 Merge pull request #74 from mxve/dependabot/cargo/reqwest-0.11.24
Bump reqwest from 0.11.23 to 0.11.24
2024-02-07 11:14:35 +01:00
ea69e6d964 Merge pull request #72 from mxve/dependabot/cargo/serde_json-1.0.113
Bump serde_json from 1.0.111 to 1.0.113
2024-02-07 11:14:24 +01:00
9cbfed8bf3 Bump tokio from 1.35.1 to 1.36.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.35.1 to 1.36.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.35.1...tokio-1.36.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 15:46:38 +00:00
9f789ba556 Bump reqwest from 0.11.23 to 0.11.24
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.23 to 0.11.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.11.23...v0.11.24)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 15:46:31 +00:00
7fc39f24bc Bump serde_json from 1.0.111 to 1.0.113
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.111 to 1.0.113.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.111...v1.0.113)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 15:13:01 +00:00
Edo
1dd2e898d9 Merge pull request #71 from mxve/dependabot/cargo/openssl-0.10.63
Bump openssl from 0.10.62 to 0.10.63
2024-01-27 10:12:30 +01:00
006ca15232 Bump openssl from 0.10.62 to 0.10.63
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.62 to 0.10.63.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.62...openssl-v0.10.63)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-22 15:46:30 +00:00
Edo
1730bf40be Merge pull request #69 from mxve/dependabot/cargo/serde_json-1.0.111
Bump serde_json from 1.0.109 to 1.0.111
2024-01-21 10:29:41 +01:00
f40448b6fc Bump serde_json from 1.0.109 to 1.0.111
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.109 to 1.0.111.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.109...v1.0.111)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-15 15:37:54 +00:00
Edo
b418732ddf Merge pull request #65 from mxve/dependabot/cargo/serde-1.0.195
Bump serde from 1.0.193 to 1.0.195
2024-01-10 22:22:07 +01:00
Edo
bef7a88db0 Merge pull request #66 from mxve/dependabot/cargo/semver-1.0.21
Bump semver from 1.0.20 to 1.0.21
2024-01-10 22:22:00 +01:00
9f95397bd2 Bump semver from 1.0.20 to 1.0.21
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.20...1.0.21)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 15:51:12 +00:00
c2ec4f6a45 Bump serde from 1.0.193 to 1.0.195
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.193 to 1.0.195.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.193...v1.0.195)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 15:50:50 +00:00
cab26cfa16 v0.6.6 2024-01-04 18:55:05 +01:00
1147e0673b use new cdn 2024-01-04 18:53:44 +01:00
Edo
4fec555c1f Merge pull request #62 from mxve/dependabot/cargo/serde_json-1.0.109
Bump serde_json from 1.0.107 to 1.0.109
2024-01-04 13:18:43 +01:00
48fe7a4780 set fix steamlocate version until stable release 2024-01-02 11:52:42 +01:00
0e8b9285c9 fix steamlocate beta.2 2024-01-02 11:44:34 +01:00
725ec09e5e v0.6.5 2024-01-02 11:22:33 +01:00
caaf73e9f3 add support for Game.delete 2024-01-02 11:22:18 +01:00
458cd6d8bc Bump serde_json from 1.0.107 to 1.0.109
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.107 to 1.0.109.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.107...v1.0.109)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 15:14:18 +00:00
2261a9a655 Merge pull request #57 from mxve/dependabot/cargo/openssl-0.10.62
Bump openssl from 0.10.61 to 0.10.62
2023-12-27 22:14:13 +01:00
25a781df8e Merge pull request #59 from mxve/dependabot/cargo/futures-util-0.3.30
Bump futures-util from 0.3.29 to 0.3.30
2023-12-27 21:58:03 +01:00
637fa0a504 Bump openssl from 0.10.61 to 0.10.62
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.61 to 0.10.62.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.61...openssl-v0.10.62)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-27 20:56:47 +00:00
23df31735d Merge pull request #58 from mxve/dependabot/cargo/steamlocate-2.0.0-beta.2
Bump steamlocate from 2.0.0-alpha.0 to 2.0.0-beta.2
2023-12-27 21:55:58 +01:00
6ae5ff66f0 Bump futures-util from 0.3.29 to 0.3.30
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.29 to 0.3.30.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.29...0.3.30)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-27 20:55:08 +00:00
11f49cca32 Merge pull request #60 from mxve/dependabot/cargo/reqwest-0.11.23
Bump reqwest from 0.11.22 to 0.11.23
2023-12-27 21:54:40 +01:00
ad024ab997 Merge pull request #61 from mxve/dependabot/cargo/tokio-1.35.1
Bump tokio from 1.35.0 to 1.35.1
2023-12-27 21:54:30 +01:00
2db8e83502 Bump tokio from 1.35.0 to 1.35.1
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.35.0 to 1.35.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.35.0...tokio-1.35.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 15:46:03 +00:00
8f674ef4e5 Bump reqwest from 0.11.22 to 0.11.23
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.22 to 0.11.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.11.22...v0.11.23)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 15:45:55 +00:00
19484c8b79 Bump steamlocate from 2.0.0-alpha.0 to 2.0.0-beta.2
Bumps [steamlocate](https://github.com/WilliamVenner/steamlocate-rs) from 2.0.0-alpha.0 to 2.0.0-beta.2.
- [Commits](https://github.com/WilliamVenner/steamlocate-rs/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 15:45:41 +00:00
92c46a9d87 update readme 2023-12-22 21:29:04 +01:00
e4de326b41 v0.6.4 2023-12-18 16:51:20 +01:00
0728561eca remove iw4 files not present on remote 2023-12-18 16:49:57 +01:00
Edo
7178f2ed22 Merge pull request #51 from mxve/dependabot/cargo/tokio-1.35.0
Bump tokio from 1.34.0 to 1.35.0
2023-12-12 18:59:48 +01:00
Edo
ad4b5ca8aa Merge pull request #52 from mxve/dependabot/cargo/colored-2.1.0
Bump colored from 2.0.4 to 2.1.0
2023-12-12 18:59:33 +01:00
Edo
9945fd1b1f Merge pull request #53 from mxve/dependabot/cargo/openssl-0.10.61
Bump openssl from 0.10.60 to 0.10.61
2023-12-12 18:59:13 +01:00
3f8cadea8e Bump openssl from 0.10.60 to 0.10.61
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.60 to 0.10.61.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.60...openssl-v0.10.61)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 15:47:00 +00:00
08b04425a5 Bump colored from 2.0.4 to 2.1.0
Bumps [colored](https://github.com/mackwic/colored) from 2.0.4 to 2.1.0.
- [Release notes](https://github.com/mackwic/colored/releases)
- [Changelog](https://github.com/colored-rs/colored/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mackwic/colored/compare/v2.0.4...v2.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 15:46:49 +00:00
55fd51a1cc Bump tokio from 1.34.0 to 1.35.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.34.0 to 1.35.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.34.0...tokio-1.35.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 15:46:41 +00:00
Edo
22bac811fc Merge pull request #50 from mxve/dependabot/cargo/http_req-0.10.2
Bump http_req from 0.10.1 to 0.10.2
2023-12-05 11:33:54 +01:00
bb7786cb0a Bump http_req from 0.10.1 to 0.10.2
Bumps [http_req](https://github.com/jayjamesjay/http_req) from 0.10.1 to 0.10.2.
- [Release notes](https://github.com/jayjamesjay/http_req/releases)
- [Commits](https://github.com/jayjamesjay/http_req/compare/v0.10.1...v0.10.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 15:06:18 +00:00
e3775ef3dc Merge pull request #49 from mxve/dependabot/cargo/openssl-0.10.60
Bump openssl from 0.10.58 to 0.10.60
2023-11-27 19:03:41 +01:00
62e3569195 Bump openssl from 0.10.58 to 0.10.60
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.58 to 0.10.60.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.58...openssl-v0.10.60)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 17:59:24 +00:00
e48090a00c Merge pull request #48 from mxve/dependabot/cargo/serde-1.0.193
Bump serde from 1.0.190 to 1.0.193
2023-11-27 18:57:47 +01:00
168e8bc110 Merge pull request #45 from mxve/dependabot/cargo/tokio-1.34.0
Bump tokio from 1.33.0 to 1.34.0
2023-11-27 18:57:27 +01:00
8782642e4e Bump serde from 1.0.190 to 1.0.193
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.190 to 1.0.193.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.190...v1.0.193)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 15:13:31 +00:00
Edo
646c10d95a maint(cargo): undo addition of "symbols" option since it does nothing 2023-11-27 00:10:45 +01:00
25c3d25b10 Bump tokio from 1.33.0 to 1.34.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.33.0...tokio-1.34.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-24 14:13:08 +00:00
570150777d v0.6.3 2023-11-24 14:54:26 +01:00
0652f77355 fix: attempt fix on Linux by "vendoring" OpenSSL 2023-11-24 14:44:40 +01:00
6494af20de Merge branch 'main' of github.com:mxve/alterware-launcher 2023-11-13 15:26:32 +01:00
35a1d1866f iw4 default arg -stdout; add cfg.engine 2023-11-13 15:26:28 +01:00
3bbfc9bb81 remove rustls dep
reduces binary size by using os ssl/openssl for http_req and reqwest until #43 gets done
2023-11-10 00:04:00 +01:00
3f6de0350b set useragent header 2023-11-07 17:14:40 +01:00
73c45de4be Merge pull request #42 from mxve/selfrestart
Selfrestart
2023-11-07 00:20:32 +01:00
9fe9f58e70 fix linux 2023-11-06 22:33:58 +01:00
09cec3f1ad v0.6.2 2023-11-06 22:27:53 +01:00
1e62b5ffad cleanup 2023-11-06 22:27:09 +01:00
f582cdd625 self restart 2023-11-06 03:20:46 +01:00
8cc1047367 don't panic if cleaning up left over files fails 2023-11-06 02:08:29 +01:00
0c004b6f0f v0.6.1 2023-11-06 01:56:49 +01:00
f0a63a241a fix existing file hashes always being calculated 2023-11-06 01:56:26 +01:00
76896a22f9 v0.6.0 2023-11-05 17:20:59 +01:00
7c37334199 improve setup_env on Windows
(real)
935a72e05be1a213a12238f522c8b35f872ecf63
2023-11-04 11:48:04 +01:00
897c5dae4b lint 2023-11-04 11:35:19 +01:00
fdcf3d31bd import std::env 2023-11-04 07:48:40 +01:00
935a72e05b maint(win): improve setup_env on Windows 2023-11-04 07:27:58 +01:00
174333ff93 Merge pull request #40 from mxve/async
Async
2023-11-02 16:05:10 +01:00
17454d4dc8 update iw4x first
so we don't have to pass the progressbar to iw4x just to not have it break by a little println
2023-11-02 11:44:08 +01:00
9a6b7b531a only show filename in pb 2023-11-02 11:31:50 +01:00
806118862f use String::default() for empty strings
as suggested by diamante quality control ™️
2023-11-02 11:27:43 +01:00
9a9e64fb0e remove linux i686 2023-11-02 11:05:28 +01:00
8c407de8fb consume 2023-11-02 10:43:36 +01:00
7f6027fe2e Merge branch 'main' of github.com:mxve/alterware-launcher 2023-11-02 10:40:45 +01:00
dacaf322d4 stream files to disk
- Greatly reduced memory usage while downloading
- Added progressbar, download rate
- Added async runtime
- Tweaks to allow usage of async download function
2023-11-02 10:39:58 +01:00
78fa91ded4 Merge pull request #38 from mxve/dependabot/cargo/serde-1.0.190
Bump serde from 1.0.189 to 1.0.190
2023-10-30 22:00:19 +01:00
aa69a26f1f Merge pull request #39 from mxve/dependabot/cargo/http_req-0.10.1
Bump http_req from 0.10.0 to 0.10.1
2023-10-30 22:00:07 +01:00
f2f388e0bb Bump http_req from 0.10.0 to 0.10.1
Bumps [http_req](https://github.com/jayjamesjay/http_req) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/jayjamesjay/http_req/releases)
- [Commits](https://github.com/jayjamesjay/http_req/compare/v0.10.0...v0.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-30 15:31:10 +00:00
9cf7049aaa Bump serde from 1.0.189 to 1.0.190
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.189 to 1.0.190.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.189...v1.0.190)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-30 15:30:54 +00:00
f609a53377 dc 2023-10-28 20:14:39 +02:00
24a745abff typo 2023-10-28 19:49:21 +02:00
58b57f48ad clippy 2023-10-28 19:38:53 +02:00
9c26679a5a print download size 2023-10-28 19:35:28 +02:00
ca836bbda6 add av info on permission denied 2023-10-26 06:25:12 +02:00
360d2376e1 Merge pull request #36 from mxve/dependabot/cargo/serde-1.0.189
Bump serde from 1.0.188 to 1.0.189
2023-10-16 17:46:15 +02:00
0b60b2a893 Merge pull request #37 from mxve/dependabot/cargo/semver-1.0.20
Bump semver from 1.0.19 to 1.0.20
2023-10-16 17:46:08 +02:00
cddc697e89 Bump semver from 1.0.19 to 1.0.20
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.19 to 1.0.20.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.19...1.0.20)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-16 15:07:26 +00:00
ec1b580b21 Bump serde from 1.0.188 to 1.0.189
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.188 to 1.0.189.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.188...v1.0.189)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-16 15:07:20 +00:00
eeacb15d6f update actions 2023-10-16 16:11:56 +02:00
4273d00417 Merge pull request #35 from mxve/dependabot/cargo/http_req-0.10.0
Bump http_req from 0.9.3 to 0.10.0
2023-10-09 18:29:43 +02:00
9596c5d491 Bump http_req from 0.9.3 to 0.10.0
Bumps [http_req](https://github.com/jayjamesjay/http_req) from 0.9.3 to 0.10.0.
- [Release notes](https://github.com/jayjamesjay/http_req/releases)
- [Commits](https://github.com/jayjamesjay/http_req/compare/v0.9.3...v0.10.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-09 15:58:32 +00:00
123a8b7caf add client-args.md; document config file 2023-10-07 13:24:26 +02:00
141b60393a v0.5.3 2023-10-06 09:03:34 +02:00
4bdecabbe5 misc 2023-10-06 08:34:42 +02:00
6a8c11b101 add changelog link 2023-10-06 08:30:29 +02:00
12526d7f36 handle notfound; give tips to fix permission denied 2023-10-02 15:49:01 +02:00
f3e7a42043 Create config path if it doesn't exist; don't panic 2023-10-02 15:48:22 +02:00
fddd146361 improve logging of http errors 2023-10-02 04:39:49 +02:00
b86d252c4b handle shortcut creation errors 2023-10-01 00:36:12 +02:00
dee9011812 set matrix target 2023-09-25 18:57:51 +02:00
96bc7a73e5 v0.5.2 2023-09-25 18:52:35 +02:00
f756e818b6 Merge branch 'main' of github.com:mxve/alterware-launcher 2023-09-25 18:51:54 +02:00
686a6e6352 build i686 target 2023-09-25 18:51:43 +02:00
a56b7f12ee Merge pull request #34 from mxve/dependabot/cargo/semver-1.0.19
Bump semver from 1.0.18 to 1.0.19
2023-09-25 17:51:50 +02:00
e6cc1a9e34 self-replace 1.3.7 2023-09-25 17:51:21 +02:00
3e5c0cc4ed Bump semver from 1.0.18 to 1.0.19
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.18 to 1.0.19.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.18...1.0.19)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-25 15:28:54 +00:00
5fa3332266 don't ask if --bonus set 2023-09-23 01:29:04 +02:00
66b7187c0e Merge pull request #31 from mxve/dependabot/cargo/http_req-0.9.3
Bump http_req from 0.9.2 to 0.9.3
2023-09-18 20:12:38 +02:00
eb8ada5040 Merge pull request #32 from mxve/dependabot/cargo/serde_json-1.0.107
Bump serde_json from 1.0.106 to 1.0.107
2023-09-18 20:12:30 +02:00
e34939f303 Bump serde_json from 1.0.106 to 1.0.107
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.106 to 1.0.107.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.106...v1.0.107)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-18 15:05:36 +00:00
1e7f2f6514 Bump http_req from 0.9.2 to 0.9.3
Bumps [http_req](https://github.com/jayjamesjay/http_req) from 0.9.2 to 0.9.3.
- [Release notes](https://github.com/jayjamesjay/http_req/releases)
- [Commits](https://github.com/jayjamesjay/http_req/compare/v0.9.2...v0.9.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-18 15:05:29 +00:00
d50f3b83e9 pwettify comfig file :3 2023-09-18 16:29:37 +02:00
ce18aea5aa v0.5.1 2023-09-18 12:27:01 +02:00
93d1c9841a set current_dir when launching 2023-09-18 12:26:47 +02:00
d8beb754fa v0.5.0 2023-09-17 17:49:50 +02:00
af78ebfcaf print passed args when launching; trim args 2023-09-16 16:41:18 +02:00
Edo
79c48c240b Merge pull request #30 from diamante0018/main
maint(main): simply return out of the main function
2023-09-15 19:22:11 +02:00
Edo
fe6e3c227f maint(main): simply return out of the main function
instead of calling exit()
2023-09-15 19:19:04 +02:00
65f106541c update readme 2023-09-15 01:48:04 +02:00
428c75bbf2 add --help, --version/-v 2023-09-15 01:45:47 +02:00
d47ebbcb28 allow loading client args from config 2023-09-14 10:32:03 +02:00
a1004405ca 💩 2023-09-14 10:25:44 +02:00
3efecdad74 Merge pull request #29 from mxve/dependabot/cargo/serde_json-1.0.106
Bump serde_json from 1.0.105 to 1.0.106
2023-09-14 10:24:26 +02:00
be3c45b79d add --pass to allow passing args to the client 2023-09-14 10:23:48 +02:00
b830ab7085 remove debug print 2023-09-14 10:09:21 +02:00
be3e7c8ac1 strip value AND arg 😑 2023-09-14 10:08:26 +02:00
a5af98b0f3 add --path, -p 2023-09-14 09:44:35 +02:00
0b4c6325c7 prepend args with --, -, add short args 2023-09-14 09:37:35 +02:00
e1b76c8e04 update readme 2023-09-12 21:35:50 +02:00
26bb7567de store file hashes; added "force" arg
close #28
2023-09-12 21:28:53 +02:00
0814c99363 Bump serde_json from 1.0.105 to 1.0.106
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.105 to 1.0.106.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.105...v1.0.106)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 15:16:24 +00:00
f23acb6788 improve progress prints 2023-09-11 13:05:18 +02:00
813d0613c1 Show more progress 2023-09-10 20:00:04 +02:00
349efa4e43 download bonus content 2023-09-10 18:29:30 +02:00
86b0bb1b7a use config values 2023-09-10 17:36:01 +02:00
32b1272ff6 cfg 2023-09-10 16:58:42 +02:00
ab8461b6df v0.4.8 2023-09-10 12:39:44 +02:00
a7008ecbd5 check first dir when matching files to download 2023-09-10 12:38:21 +02:00
a76efc6e6f update readme 2023-09-03 19:03:46 +02:00
932c41d369 misc
- reduce github calls
- latest_tag returns full tag
- rev_to_int default to 0 on strip_prefix
- lint
2023-08-30 13:06:49 +02:00
0ec2a44082 github::latest -> latest_tag 2023-08-30 12:46:13 +02:00
94b6d26ddd steamlocate 2.0.0-alpha.0 2023-08-30 12:45:10 +02:00
7bc677cf81 v0.4.7 2023-08-29 22:13:05 +02:00
1f76f8529c update iw4x if dll doesn't exist 2023-08-29 22:12:42 +02:00
afda8902df whoops/v0.4.6 2023-08-29 22:00:31 +02:00
bb5b3f8bf9 v0.4.6 2023-08-29 21:57:35 +02:00
64c63bf24f obtain iw4x.dll from iw4x/iw4x-client 2023-08-29 21:53:47 +02:00
9dc569e646 update io::unzip 2023-08-29 06:59:04 +02:00
00c3740af0 Merge branch 'main' of github.com:mxve/alterware-launcher 2023-08-29 06:51:52 +02:00
42f48bbaf4 add io::unzip 2023-08-29 06:51:44 +02:00
63f160ff4a seperate into multiple source files 2023-08-29 06:51:40 +02:00
ff13d11934 Merge pull request #26 from mxve/dependabot/cargo/serde-1.0.188
Bump serde from 1.0.185 to 1.0.188
2023-08-28 22:38:55 +02:00
2cec22e170 Merge pull request #25 from mxve/dependabot/cargo/self-replace-1.3.6
Bump self-replace from 1.3.5 to 1.3.6
2023-08-28 22:38:47 +02:00
7a2c6c7e37 Bump serde from 1.0.185 to 1.0.188
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.185 to 1.0.188.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.185...v1.0.188)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-28 15:52:58 +00:00
416de17876 Bump self-replace from 1.3.5 to 1.3.6
Bumps [self-replace](https://github.com/mitsuhiko/self-replace) from 1.3.5 to 1.3.6.
- [Changelog](https://github.com/mitsuhiko/self-replace/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/self-replace/compare/1.3.5...1.3.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-28 15:52:49 +00:00
ced346f776 v0.4.5 2023-08-26 21:17:01 +02:00
030c869fec linting 2023-08-26 20:59:38 +02:00
5ad73dcc1c feat: manual client selection
fix: crash if steam not installed/steamdir is none
2023-08-26 20:53:41 +02:00
32f9fc2afe restart required ex.code 101->201
rust panic returns 101, so this wasn't a good choice
2023-08-22 11:37:34 +02:00
d8609fd7b1 Merge pull request #23 from mxve/dependabot/cargo/serde-1.0.185
Bump serde from 1.0.183 to 1.0.185
2023-08-21 17:31:09 +02:00
7ea4db486b Bump serde from 1.0.183 to 1.0.185
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.183 to 1.0.185.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.183...v1.0.185)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 15:26:04 +00:00
31d9f5497e Merge pull request #24 from mxve/dependabot/cargo/serde_json-1.0.105
Bump serde_json from 1.0.104 to 1.0.105
2023-08-21 17:25:29 +02:00
917aa5cf6f Bump serde_json from 1.0.104 to 1.0.105
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.104 to 1.0.105.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.104...v1.0.105)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 15:10:09 +00:00
c7da419866 v0.4.4 2023-08-18 14:38:15 +02:00
86b969fa26 Don't ask what client to launch if update is set 2023-08-18 13:36:06 +02:00
618227a484 v0.4.3 2023-08-18 12:53:28 +02:00
5c3bd72482 update after windows setup; match cur dir to steam dirs 2023-08-18 12:51:51 +02:00
2ccb17a342 v0.4.2 2023-08-17 20:26:25 +02:00
f98e9ffed2 fix: unix.. again 2023-08-17 20:26:08 +02:00
58423863f5 return 101 when restart is required after self-update 2023-08-17 18:32:32 +02:00
f787feed05 v0.4.1 2023-08-16 13:01:32 +02:00
c8abf1567f create release as draft 2023-08-16 13:01:25 +02:00
5847b6a28a don't copy if current & target path are the same 2023-08-16 13:00:15 +02:00
0dda3d295f remove cache busting 2023-08-16 12:57:27 +02:00
ea209776b3 Merge pull request #21 from mxve/build/symbols
build: add symbols
2023-08-15 19:05:22 +02:00
Edo
e3d13df76a build: add symbols 2023-08-15 19:03:38 +02:00
4c4da71f6a v0.4.0 2023-08-15 13:02:32 +02:00
d11326ffde fix: remove windows target from get_input 2023-08-15 11:13:59 +02:00
ed82e072d0 fix: don't run setup_client_links on unix 2023-08-15 11:10:40 +02:00
39039c842f Merge branch 'main' of github.com:mxve/alterware-launcher 2023-08-15 09:45:21 +02:00
35ebdd4118 feat: support multiple clients per game
- Game.client changed from str to Vec<str>
- Create launch shortcuts for multi-client games
- Add prompt if multiple clients available and none specified
2023-08-15 09:45:18 +02:00
1efe17dc9e bruh 2023-08-12 15:35:41 +02:00
b8dd271aec Update readme 2023-08-12 15:30:28 +02:00
e90255539a v0.3.1 2023-08-12 15:27:39 +02:00
35da7817d1 feat(flag): skip-launcher-update 2023-08-12 15:26:35 +02:00
02f98c732c v0.3.0 2023-08-12 15:09:26 +02:00
7fd9381629 fix: don't even look at it 2023-08-12 14:33:25 +02:00
0a3edba1ba fix: unix build 2023-08-12 14:31:58 +02:00
9205c0b12b feat: self-update
closes #17

- launcher updates itself (only on windows target for now)
- added cache buster to games.json request
- rearranged some functions
- file description is now "AlterWare Launcher" as it shows up in the task manager
2023-08-12 14:08:59 +02:00
5da40e87a5 mark get_input as windows target 2023-08-12 06:41:08 +02:00
dc36f83a9f Merge branch 'main' of github.com:mxve/alterware-launcher 2023-08-12 06:30:08 +02:00
bef4c64c81 feat(win): setup for installed steam games
steamlocate requires steamy-vdf which requires a in the future unsupported version of nom (1.2.4). This should get fixed with a future release of steamlocate
https://github.com/WilliamVenner/steamlocate-rs/issues/19
2023-08-12 06:30:02 +02:00
ff43574c87 Merge pull request #18 from mxve/dependabot/cargo/serde-1.0.183
Bump serde from 1.0.179 to 1.0.183
2023-08-08 02:29:59 +02:00
e296609ff3 Bump serde from 1.0.179 to 1.0.183
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.179 to 1.0.183.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.179...v1.0.183)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 15:23:26 +00:00
bb1ab05588 check for launcher update 2023-08-03 02:49:55 +02:00
f5216d7e29 Merge pull request #14 from mxve/dependabot/cargo/serde_json-1.0.104
Bump serde_json from 1.0.103 to 1.0.104
2023-07-31 22:44:19 +02:00
a389b6d9fa Bump serde_json from 1.0.103 to 1.0.104
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.103 to 1.0.104.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.103...v1.0.104)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 20:10:02 +00:00
97f24c27bb Merge pull request #13 from mxve/dependabot/cargo/serde-1.0.179
Bump serde from 1.0.175 to 1.0.179
2023-07-31 22:09:28 +02:00
66f905e8d7 Bump serde from 1.0.175 to 1.0.179
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.175 to 1.0.179.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.175...v1.0.179)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 15:37:10 +00:00
b46065a800 minor cleanup 2023-07-25 03:24:52 +02:00
a5d3d9162e Merge pull request #12 from mxve/dependabot/cargo/serde-1.0.175
Bump serde from 1.0.171 to 1.0.175
2023-07-24 18:14:48 +02:00
b2efdfd4b2 Bump serde from 1.0.171 to 1.0.175
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.171 to 1.0.175.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.171...v1.0.175)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-24 15:40:30 +00:00
bc3eb8e5ba dependabot daily -> weekly 2023-07-19 08:54:07 +02:00
c7d8035eab Merge pull request #11 from mxve/dependabot/cargo/serde_json-1.0.103
Bump serde_json from 1.0.102 to 1.0.103
2023-07-19 08:52:21 +02:00
753f60b83d Bump serde_json from 1.0.102 to 1.0.103
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.102 to 1.0.103.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.102...v1.0.103)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-17 15:12:34 +00:00
Edo
21acf7893d fix: remove return statement 2023-07-13 11:18:45 +02:00
389643078d Merge pull request #10 from diamante0018/main
feat: use current time as cache busting method
2023-07-13 10:39:16 +02:00
e95e31610e Merge pull request #9 from mxve/dependabot/cargo/serde_json-1.0.102
Bump serde_json from 1.0.100 to 1.0.102
2023-07-13 10:39:06 +02:00
06904102a4 Bump serde_json from 1.0.100 to 1.0.102
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.100 to 1.0.102.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.100...v1.0.102)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-13 08:37:53 +00:00
e89f70e399 Merge pull request #8 from mxve/dependabot/cargo/serde-1.0.171
Bump serde from 1.0.167 to 1.0.171
2023-07-13 10:36:56 +02:00
4620de247c Merge pull request #7 from mxve/dependabot/cargo/http_req-0.9.2
Bump http_req from 0.9.1 to 0.9.2
2023-07-13 10:36:48 +02:00
27102f810a feat: use current time as cache busting method 2023-07-13 10:31:23 +02:00
12550fd524 Bump serde from 1.0.167 to 1.0.171
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.167 to 1.0.171.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.167...v1.0.171)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 16:08:19 +00:00
53bad9c7c4 Bump http_req from 0.9.1 to 0.9.2
Bumps [http_req](https://github.com/jayjamesjay/http_req) from 0.9.1 to 0.9.2.
- [Release notes](https://github.com/jayjamesjay/http_req/releases)
- [Commits](https://github.com/jayjamesjay/http_req/compare/v0.9.1...v0.9.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 16:08:13 +00:00
dd3d1fd82b Merge pull request #6 from mxve/dependabot/cargo/serde-1.0.167
Bump serde from 1.0.166 to 1.0.167
2023-07-07 22:09:54 +02:00
ee52e616c0 Bump serde from 1.0.166 to 1.0.167
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.166 to 1.0.167.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.166...v1.0.167)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-07 15:26:08 +00:00
3a393776a3 Merge pull request #5 from mxve/dependabot/cargo/serde_json-1.0.100
Bump serde_json from 1.0.99 to 1.0.100
2023-07-05 18:34:45 +02:00
62e8fc02ed Bump serde_json from 1.0.99 to 1.0.100
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.99 to 1.0.100.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.99...v1.0.100)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 16:05:39 +00:00
8184d468bc Merge pull request #4 from mxve/dependabot/cargo/serde-1.0.166
Bump serde from 1.0.164 to 1.0.166
2023-07-05 03:57:07 +02:00
58b361ed45 Bump serde from 1.0.164 to 1.0.166
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.164 to 1.0.166.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.164...v1.0.166)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-04 15:32:28 +00:00
2289bcaa87 Revert "windows self-update"
This reverts commit cee51300b27998da0e2351f6f011980d436286e6.
2023-06-28 15:13:41 +02:00
23dc1c085c Merge pull request #2 from mxve/dependabot/cargo/serde_json-1.0.99
Bump serde_json from 1.0.97 to 1.0.99
2023-06-28 13:09:40 +02:00
13052d6727 Bump serde_json from 1.0.97 to 1.0.99
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.97 to 1.0.99.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.97...v1.0.99)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 16:06:00 +00:00
f07a5684d3 delete update.bat 2023-06-22 16:48:43 +02:00
cee51300b2 windows self-update 2023-06-22 16:45:00 +02:00
a2be263a7b Merge pull request #1 from mxve/dependabot/cargo/serde_json-1.0.97
Bump serde_json from 1.0.96 to 1.0.97
2023-06-16 18:13:57 +02:00
000ebd466a Bump serde_json from 1.0.96 to 1.0.97
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.96 to 1.0.97.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.96...v1.0.97)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-16 16:04:00 +00:00
15 changed files with 1409 additions and 635 deletions

View File

@ -21,12 +21,14 @@ jobs:
include: include:
- target: x86_64-unknown-linux-gnu - target: x86_64-unknown-linux-gnu
os: ubuntu-20.04 os: ubuntu-20.04
- target: i686-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
os: ubuntu-20.04 os: ubuntu-20.04
- target: x86_64-pc-windows-msvc - target: x86_64-pc-windows-msvc
os: windows-latest os: windows-latest
- target: i686-pc-windows-msvc - target: i686-pc-windows-msvc
os: windows-latest os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

1231
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,33 @@
[package] [package]
name = "alterware-launcher" name = "alterware-launcher"
version = "0.5.4" version = "0.6.10"
edition = "2021" edition = "2021"
build = "res/build.rs" build = "res/build.rs"
[profile.release] [profile.release]
opt-level = "s" opt-level = "s"
# Symbols are a nice thing
debug = true
panic = "abort" panic = "abort"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
http_req = { version = "0.10.0", default-features = false, features = [
"rust-tls",
] }
sha1_smol = "1.0.0" sha1_smol = "1.0.0"
serde = { version = "1.0.189", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.107" serde_json = "1.0.114"
rand = "0.8.5" rand = "0.8.5"
semver = "1.0.20" semver = "1.0.22"
zip = "0.6.6" colored = "2.1.0"
colored = "2.0.4" reqwest = { version = "0.11.24", features = ["stream"] }
futures-util = "0.3.30"
indicatif = "0.17.8"
tokio = {version="1.36.0", features = ["rt-multi-thread", "macros"]}
[target.'cfg(unix)'.dependencies]
openssl = { version = "0.10.64", default-features = false, features = ["vendored"] }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
steamlocate = "2.0.0-alpha.0" steamlocate = "=2.0.0-beta.2"
mslnk = "0.1.8" mslnk = "0.1.8"
self-replace = "1.3.7" self-replace = "1.3.7"

View File

@ -4,13 +4,16 @@
##### IW4x | IW4-SP | IW5-Mod | IW6-Mod | S1-Mod ##### IW4x | IW4-SP | IW5-Mod | IW6-Mod | S1-Mod
![GitHub tag (with filter)](https://img.shields.io/github/v/tag/mxve/alterware-launcher?filter=!v*-pre&style=flat-square&label=Latest%20release&labelColor=F3F8FF&color=E26EE5) ![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/mxve/alterware-launcher?style=flat-square&label=Release%20date&labelColor=F3F8FF&color=E26EE5) ![GitHub all releases](https://img.shields.io/github/downloads/mxve/alterware-launcher/total?style=flat-square&label=Total%20downloads&labelColor=F3F8FF&color=E26EE5)
--- ---
#### Installation ## Installation
1. Download the [latest alterware-launcher.exe](https://github.com/mxve/alterware-launcher/releases/latest/download/alterware-launcher.exe) 1. Download the game from [Steam](https://store.steampowered.com/)
2. Place alterware-launcher.exe in the game directory 2. Download the [latest alterware-launcher.exe](https://github.com/mxve/alterware-launcher/releases/latest/download/alterware-launcher.exe)
3. Run alterware-launcher.exe, after updating the game will launch automatically 3. Place alterware-launcher.exe in the game directory
4. Run alterware-launcher.exe, after updating the game will launch automatically
--- ---
@ -35,6 +38,8 @@
- See [client-args.md](client-args.md) - See [client-args.md](client-args.md)
- ```--version```, ```-v``` - ```--version```, ```-v```
- Print the launcher version - Print the launcher version
- ```--ignore-required-files```
- Install client even if required files are missing
Example: ```alterware-launcher.exe iw4x --bonus -u --path "C:\Games\IW4x" --pass "-console"``` Example: ```alterware-launcher.exe iw4x --bonus -u --path "C:\Games\IW4x" --pass "-console"```
@ -63,6 +68,9 @@ alterware-launcher.json
- ```args``` - ```args```
- See --pass - See --pass
- Default: "" - Default: ""
- ```use_https```
- Use HTTPS for downloads
- Default: false
--- ---
@ -82,13 +90,6 @@ Visit the [AlterWare Forum](https://forum.alterware.dev/) or [Discord](https://d
--- ---
### Note for server owners: ### Note for server owners:
When the launcher updates itself it needs to be restarted. It will return exit code 201 in this case. When the launcher updates itself __on Windows__ it will restart by spawning a new console. If you are automating this process, you should probably use ```--skip-launcher-update``` and download the latest launcher yourself from [here](https://github.com/mxve/alterware-launcher/releases/latest/download/alterware-launcher.exe).
``` The linux build does __not__ update itself.
@echo off
:loop
start /wait alterware-launcher.exe --update
if %errorlevel% equ 201 (
goto loop
)
```

View File

@ -36,6 +36,17 @@ pub fn save_value(config_path: PathBuf, key: &str, value: bool) {
"download_bonus_content" => config.download_bonus_content = value, "download_bonus_content" => config.download_bonus_content = value,
"ask_bonus_content" => config.ask_bonus_content = value, "ask_bonus_content" => config.ask_bonus_content = value,
"force_update" => config.force_update = value, "force_update" => config.force_update = value,
"use_https" => config.use_https = value,
_ => (),
}
save(config_path, config);
}
pub fn save_value_s(config_path: PathBuf, key: &str, value: String) {
let mut config = load(config_path.clone());
match key {
"args" => config.args = value.to_string(),
"engine" => config.engine = value.to_string(),
_ => (), _ => (),
} }
save(config_path, config); save(config_path, config);

View File

@ -1,19 +1,21 @@
use semver::Version; use semver::Version;
pub fn latest_tag(owner: &str, repo: &str) -> String { pub async fn latest_tag(owner: &str, repo: &str) -> String {
let github_body = crate::http::get_body_string( let github_body = crate::http_async::get_body_string(
format!( format!(
"https://api.github.com/repos/{}/{}/releases/latest", "https://api.github.com/repos/{}/{}/releases/latest",
owner, repo owner, repo
) )
.as_str(), .as_str(),
); )
.await
.unwrap();
let github_json: serde_json::Value = serde_json::from_str(&github_body).unwrap(); let github_json: serde_json::Value = serde_json::from_str(&github_body).unwrap();
github_json["tag_name"].to_string().replace('"', "") github_json["tag_name"].to_string().replace('"', "")
} }
pub fn latest_version(owner: &str, repo: &str) -> Version { pub async fn latest_version(owner: &str, repo: &str) -> Version {
let tag = latest_tag(owner, repo).replace('v', ""); let tag = latest_tag(owner, repo).await.replace('v', "");
Version::parse(&tag).unwrap() Version::parse(&tag).unwrap()
} }

View File

@ -1,4 +1,4 @@
pub const MASTER: &str = "https://master.alterware.dev"; pub const MASTER: &str = "cdn.alterware.ovh";
pub const GH_OWNER: &str = "mxve"; pub const GH_OWNER: &str = "mxve";
pub const GH_REPO: &str = "alterware-launcher"; pub const GH_REPO: &str = "alterware-launcher";
pub const GH_IW4X_OWNER: &str = "iw4x"; pub const GH_IW4X_OWNER: &str = "iw4x";

View File

@ -1,84 +0,0 @@
use crate::global;
use crate::misc;
use std::{fs, io::Write, path::Path, str};
pub fn get_body(url: &str) -> Vec<u8> {
let mut res: Vec<u8> = Vec::new();
match http_req::request::Request::new(&url.try_into().unwrap())
.header(
"User-Agent",
&format!(
"AlterWare Launcher | github.com/{}/{}",
global::GH_OWNER,
global::GH_REPO
),
)
.send(&mut res)
{
Ok(req) => {
if req.status_code() == http_req::response::StatusCode::new(302)
|| req.status_code() == http_req::response::StatusCode::new(301)
{
let location = req.headers().get("Location").unwrap().as_str();
return get_body(location);
}
if req.status_code() != http_req::response::StatusCode::new(200) {
misc::fatal_error(&format!(
"Could not get body from {}, got {}",
url,
req.status_code()
));
}
}
Err(e) => {
misc::fatal_error(&format!("Could not get body from {}, got:\n{}", url, e));
}
}
res
}
pub fn get_body_string(url: &str) -> String {
String::from_utf8(get_body(url)).unwrap()
}
pub fn download_file(url: &str, file_path: &Path) {
let body = get_body(url);
match fs::File::create(file_path) {
Ok(mut file) => match file.write_all(&body) {
Ok(_) => (),
Err(e) => {
misc::fatal_error(&format!(
"Could not write to file {}, got:\n{}",
file_path.to_str().unwrap(),
e
));
}
},
Err(e) => {
match e.kind() {
std::io::ErrorKind::NotFound => {
fs::create_dir_all(file_path.parent().unwrap()).unwrap();
return download_file(url, file_path);
}
std::io::ErrorKind::PermissionDenied => {
misc::fatal_error(&format!(
"Permission to {} denied.\n Please try:\n 1. Running the launcher as administrator.\n 2. Manually deleting the last downloaded file.\n 3. If your game is in the program files directory try moving it to another location.\n 4. Create an exception/exclusion in your Anti-Virus Software for either the last downloaded file or the entire game directory.\n\n\n{}",
file_path.to_str().unwrap(),
e
));
}
_ => (),
}
misc::fatal_error(&format!(
"Could not create file {}, got:\n{}",
file_path.to_str().unwrap(),
e
));
}
}
}

127
src/http_async.rs Normal file
View File

@ -0,0 +1,127 @@
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use colored::*;
use futures_util::StreamExt;
use indicatif::ProgressBar;
use reqwest::Client;
use crate::misc;
pub async fn download_file_progress(
client: &Client,
pb: &ProgressBar,
url: &str,
path: &PathBuf,
size: u64,
) -> Result<(), String> {
let res = client
.get(url)
.header(
"User-Agent",
&format!(
"AlterWare Launcher | github.com/{}/{}",
crate::global::GH_OWNER,
crate::global::GH_REPO
),
)
.send()
.await
.or(Err(format!("Failed to GET from '{}'", &url)))?;
// Fix for CF shenanigans
let total_size = res.content_length().unwrap_or(size);
pb.set_length(total_size);
pb.println(format!(
"[{}] {} ({})",
"Downloading".bright_yellow(),
misc::cute_path(path),
misc::human_readable_bytes(total_size)
));
pb.set_message(path.file_name().unwrap().to_str().unwrap().to_string());
let mut file =
File::create(path).or(Err(format!("Failed to create file '{}'", path.display())))?;
let mut downloaded: u64 = 0;
let mut stream = res.bytes_stream();
while let Some(item) = stream.next().await {
let chunk = item.or(Err("Error while downloading file"))?;
file.write_all(&chunk)
.or(Err("Error while writing to file"))?;
let new = min(downloaded + (chunk.len() as u64), total_size);
downloaded = new;
pb.set_position(new);
}
pb.set_message(String::default());
Ok(())
}
pub async fn download_file(url: &str, path: &PathBuf) -> Result<(), String> {
let client = Client::new();
match client
.get(url)
.header(
"User-Agent",
&format!(
"AlterWare Launcher | github.com/{}/{}",
crate::global::GH_OWNER,
crate::global::GH_REPO
),
)
.send()
.await
{
Ok(res) => {
let body = res.bytes().await.or(Err("Failed to download file"))?;
let mut file = File::create(path).or(Err("Failed to create file"))?;
file.write_all(&body).or(Err("Failed to write to file"))?;
Ok(())
}
Err(e) => {
misc::fatal_error(&format!(
"Could not download file from {}, got:\n{}",
url, e
));
Err("Could not download file".to_string())
}
}
}
pub async fn get_body(url: &str) -> Result<Vec<u8>, String> {
let client = Client::new();
match client
.get(url)
.header(
"User-Agent",
&format!(
"AlterWare Launcher | github.com/{}/{}",
crate::global::GH_OWNER,
crate::global::GH_REPO
),
)
.send()
.await
{
Ok(res) => {
println!(
"[DEBUG] {} {}",
res.status().to_string().bright_yellow(),
url.bright_yellow()
);
let body = res.bytes().await.or(Err("Failed to get body"))?;
Ok(body.to_vec())
}
Err(e) => {
misc::fatal_error(&format!("Could not get body from {}, got:\n{}", url, e));
Err("Could not get body".to_string())
}
}
}
pub async fn get_body_string(url: &str) -> Result<String, String> {
let body = get_body(url).await?;
Ok(String::from_utf8(body).unwrap())
}

View File

@ -1,22 +0,0 @@
use std::{fs, path::Path};
pub fn unzip(zip_path: &Path, out_path: &Path) {
let mut archive = zip::ZipArchive::new(fs::File::open(zip_path).unwrap()).unwrap();
for i in 0..archive.len() {
let mut file = archive.by_index(i).unwrap();
let outpath = out_path.join(file.name());
if (*file.name()).ends_with('/') {
fs::create_dir_all(outpath).unwrap();
} else {
println!("Unpacking {}", file.name());
if let Some(p) = outpath.parent() {
if !p.exists() {
fs::create_dir_all(p).unwrap();
}
}
let mut outfile = fs::File::create(&outpath).unwrap();
std::io::copy(&mut file, &mut outfile).unwrap();
}
}
}

View File

@ -1,6 +1,6 @@
use crate::github; use crate::github;
use crate::global::*; use crate::global::*;
use crate::http; use crate::http_async;
use crate::misc; use crate::misc;
use colored::*; use colored::*;
@ -14,29 +14,39 @@ pub fn local_revision(dir: &Path) -> u16 {
} }
} }
pub fn remote_revision() -> u16 { pub async fn remote_revision() -> u16 {
misc::rev_to_int(&github::latest_tag(GH_IW4X_OWNER, GH_IW4X_REPO)) misc::rev_to_int(&github::latest_tag(GH_IW4X_OWNER, GH_IW4X_REPO).await)
} }
pub fn update(dir: &Path) { pub async fn update(dir: &Path) {
let remote = remote_revision(); let remote = remote_revision().await;
let local = local_revision(dir); let local = local_revision(dir);
if remote <= local && dir.join("iw4x.dll").exists() { if remote <= local && dir.join("iw4x.dll").exists() {
println!(
"[{}] No files to download for IW4x",
"Info".bright_magenta(),
);
return; return;
} }
println!(
"[{}] Downloading outdated or missing files for IW4x",
"Info".bright_magenta()
);
println!( println!(
"[{}] {}", "[{}] {}",
"Downloading".bright_yellow(), "Downloading".bright_yellow(),
dir.join("iw4x.dll").display() misc::cute_path(&dir.join("iw4x.dll"))
); );
http::download_file( http_async::download_file(
&format!( &format!(
"{}/download/iw4x.dll", "{}/download/iw4x.dll",
github::latest_release_url(GH_IW4X_OWNER, GH_IW4X_REPO) github::latest_release_url(GH_IW4X_OWNER, GH_IW4X_REPO)
), ),
&dir.join("iw4x.dll"), &dir.join("iw4x.dll"),
); )
.await
.unwrap();
fs::write(dir.join(".iw4xrevision"), format!("r{}", remote)).unwrap(); fs::write(dir.join(".iw4xrevision"), format!("r{}", remote)).unwrap();
} }

View File

@ -1,7 +1,7 @@
mod config; mod config;
mod github; mod github;
mod global; mod global;
mod http; mod http_async;
mod iw4x; mod iw4x;
mod misc; mod misc;
mod self_update; mod self_update;
@ -11,26 +11,34 @@ use global::*;
use structs::*; use structs::*;
use colored::*; use colored::*;
use indicatif::ProgressBar;
#[cfg(windows)] #[cfg(windows)]
use mslnk::ShellLink; use mslnk::ShellLink;
use std::{borrow::Cow, collections::HashMap, fs, path::Path, path::PathBuf}; use std::{borrow::Cow, collections::HashMap, env, fs, path::Path, path::PathBuf};
#[cfg(windows)] #[cfg(windows)]
use steamlocate::SteamDir; use steamlocate::SteamDir;
#[cfg(windows)] #[cfg(windows)]
fn get_installed_games(games: &Vec<Game>) -> Vec<(u32, PathBuf)> { fn get_installed_games(games: &Vec<Game>) -> Vec<(u32, PathBuf)> {
let mut installed_games = Vec::new(); let mut installed_games = Vec::new();
let mut steamdir = match SteamDir::locate() { let steamdir_result = SteamDir::locate();
Some(steamdir) => steamdir,
None => { let steamdir = match steamdir_result {
println!("{}", "Steam not found!".yellow()); Ok(steamdir) => steamdir,
Err(error) => {
println!("Error locating Steam: {}", error);
return installed_games; return installed_games;
} }
}; };
for game in games { for game in games {
if let Some(app) = steamdir.app(&game.app_id) { if let Ok(Some((app, library))) = steamdir.find_app(game.app_id) {
installed_games.push((game.app_id, PathBuf::from(&app.path))); let game_path = library
.path()
.join("steamapps")
.join("common")
.join(&app.install_dir);
installed_games.push((game.app_id, game_path));
} }
} }
@ -75,10 +83,7 @@ fn setup_desktop_links(path: &Path, game: &Game) {
let input = misc::stdin().to_ascii_lowercase(); let input = misc::stdin().to_ascii_lowercase();
if input == "y" || input.is_empty() { if input == "y" || input.is_empty() {
let desktop = PathBuf::from(&format!( let desktop = PathBuf::from(&format!("{}\\Desktop", env::var("USERPROFILE").unwrap()));
"{}\\Desktop",
std::env::var("USERPROFILE").unwrap()
));
for c in game.client.iter() { for c in game.client.iter() {
create_shortcut( create_shortcut(
@ -94,14 +99,14 @@ fn setup_desktop_links(path: &Path, game: &Game) {
} }
#[cfg(windows)] #[cfg(windows)]
fn auto_install(path: &Path, game: &Game) { async fn auto_install(path: &Path, game: &Game<'_>, master_url: &String) {
setup_client_links(game, path); setup_client_links(game, path);
setup_desktop_links(path, game); setup_desktop_links(path, game);
update(game, path, false, false); update(game, path, false, false, None, master_url, None).await;
} }
#[cfg(windows)] #[cfg(windows)]
fn windows_launcher_install(games: &Vec<Game>) { async fn windows_launcher_install(games: &Vec<Game<'_>>, master_url: &String) {
println!( println!(
"{}", "{}",
"No game specified/found. Checking for installed Steam games..".yellow() "No game specified/found. Checking for installed Steam games..".yellow()
@ -109,13 +114,13 @@ fn windows_launcher_install(games: &Vec<Game>) {
let installed_games = get_installed_games(games); let installed_games = get_installed_games(games);
if !installed_games.is_empty() { if !installed_games.is_empty() {
let current_dir = std::env::current_dir().unwrap(); let current_dir = env::current_dir().unwrap();
for (id, path) in installed_games.iter() { for (id, path) in installed_games.iter() {
if current_dir.starts_with(path) { if current_dir.starts_with(path) {
println!("Found game in current directory."); println!("Found game in current directory.");
println!("Installing AlterWare client for {}.", id); println!("Installing AlterWare client for {}.", id);
let game = games.iter().find(|&g| g.app_id == *id).unwrap(); let game = games.iter().find(|&g| g.app_id == *id).unwrap();
auto_install(path, game); auto_install(path, game, master_url).await;
println!("Installation complete. Please run the launcher again or use a shortcut to launch the game."); println!("Installation complete. Please run the launcher again or use a shortcut to launch the game.");
std::io::stdin().read_line(&mut String::new()).unwrap(); std::io::stdin().read_line(&mut String::new()).unwrap();
std::process::exit(0); std::process::exit(0);
@ -128,25 +133,21 @@ fn windows_launcher_install(games: &Vec<Game>) {
println!("{}: {}", id, path.display()); println!("{}: {}", id, path.display());
} }
println!("Enter the ID of the game you want to install the AlterWare client for, enter 0 for manual selection:"); println!("Enter the ID of the game you want to install the AlterWare client for:");
let input: u32 = misc::stdin().parse().unwrap(); let input: u32 = misc::stdin().parse().unwrap();
if input == 0 {
return manual_install(games);
}
for (id, path) in installed_games.iter() { for (id, path) in installed_games.iter() {
if *id == input { if *id == input {
let game = games.iter().find(|&g| g.app_id == input).unwrap(); let game = games.iter().find(|&g| g.app_id == input).unwrap();
let launcher_path = std::env::current_exe().unwrap(); let launcher_path = env::current_exe().unwrap();
let target_path = path.join("alterware-launcher.exe"); let target_path = path.join("alterware-launcher.exe");
if launcher_path != target_path { if launcher_path != target_path {
fs::copy(launcher_path, target_path).unwrap(); fs::copy(launcher_path, target_path).unwrap();
println!("Launcher copied to {}", path.display()); println!("Launcher copied to {}", path.display());
} }
auto_install(path, game); auto_install(path, game, master_url).await;
println!("Installation complete. Please run the launcher again or use a shortcut to launch the game."); println!("Installation complete. Please run the launcher again or use a shortcut to launch the game.");
std::io::stdin().read_line(&mut String::new()).unwrap(); std::io::stdin().read_line(&mut String::new()).unwrap();
break; break;
@ -154,32 +155,36 @@ fn windows_launcher_install(games: &Vec<Game>) {
} }
std::process::exit(0); std::process::exit(0);
} else { } else {
manual_install(games);
}
}
fn prompt_client_selection(games: &[Game]) -> String {
println!( println!(
"Couldn't detect any games, please select a client to install in the current directory:" "No installed games found. Make sure to place the launcher in the game directory."
); );
for (i, g) in games.iter().enumerate() {
for c in g.client.iter() {
println!("{}: {}", i, c);
}
}
let input: usize = misc::stdin().parse().unwrap();
String::from(games[input].client[0])
}
fn manual_install(games: &[Game]) {
let selection = prompt_client_selection(games);
let game = games.iter().find(|&g| g.client[0] == selection).unwrap();
update(game, &std::env::current_dir().unwrap(), false, false);
println!("Installation complete. Please run the launcher again or use a shortcut to launch the game.");
std::io::stdin().read_line(&mut String::new()).unwrap(); std::io::stdin().read_line(&mut String::new()).unwrap();
std::process::exit(0); std::process::exit(0);
}
} }
// fn prompt_client_selection(games: &[Game]) -> String {
// println!(
// "Couldn't detect any games, please select a client to install in the current directory:"
// );
// for (i, g) in games.iter().enumerate() {
// for c in g.client.iter() {
// println!("{}: {}", i, c);
// }
// }
// let input: usize = misc::stdin().parse().unwrap();
// String::from(games[input].client[0])
// }
// async fn manual_install(games: &[Game<'_>]) {
// let selection = prompt_client_selection(games);
// let game = games.iter().find(|&g| g.client[0] == selection).unwrap();
// update(game, &env::current_dir().unwrap(), false, false).await;
// println!("Installation complete. Please run the launcher again or use a shortcut to launch the game.");
// std::io::stdin().read_line(&mut String::new()).unwrap();
// std::process::exit(0);
// }
fn total_download_size(cdn_info: &Vec<CdnFile>, remote_dir: &str) -> u64 { fn total_download_size(cdn_info: &Vec<CdnFile>, remote_dir: &str) -> u64 {
let remote_dir = format!("{}/", remote_dir); let remote_dir = format!("{}/", remote_dir);
let mut size: u64 = 0; let mut size: u64 = 0;
@ -192,12 +197,17 @@ fn total_download_size(cdn_info: &Vec<CdnFile>, remote_dir: &str) -> u64 {
size size
} }
fn update_dir( async fn update_dir(
cdn_info: &Vec<CdnFile>, cdn_info: &Vec<CdnFile>,
remote_dir: &str, remote_dir: &str,
dir: &Path, dir: &Path,
hashes: &mut HashMap<String, String>, hashes: &mut HashMap<String, String>,
pb: &ProgressBar,
skip_iw4x_sp: bool,
master_url: &String,
) { ) {
misc::pb_style_download(pb, false);
let remote_dir_pre = format!("{}/", remote_dir); let remote_dir_pre = format!("{}/", remote_dir);
let mut files_to_download: Vec<CdnFile> = vec![]; let mut files_to_download: Vec<CdnFile> = vec![];
@ -206,6 +216,9 @@ fn update_dir(
if !file.name.starts_with(&remote_dir_pre) || file.name == "iw4/iw4x.dll" { if !file.name.starts_with(&remote_dir_pre) || file.name == "iw4/iw4x.dll" {
continue; continue;
} }
if skip_iw4x_sp && file.name == "iw4/iw4x-sp.exe" {
continue;
}
let sha1_remote = file.hash.to_lowercase(); let sha1_remote = file.hash.to_lowercase();
let file_name = &file.name.replace(remote_dir_pre.as_str(), ""); let file_name = &file.name.replace(remote_dir_pre.as_str(), "");
@ -220,7 +233,12 @@ fn update_dir(
if sha1_local != sha1_remote { if sha1_local != sha1_remote {
files_to_download.push(file.clone()); files_to_download.push(file.clone());
} else { } else {
println!("[{}] {}", "Checked".bright_blue(), file_path.display()); pb.println(format!(
"[{}] {}",
"Checked".bright_blue(),
misc::cute_path(&file_path)
));
hashes.insert(file_name.to_owned(), file.hash.to_lowercase());
} }
} else { } else {
files_to_download.push(file.clone()); files_to_download.push(file.clone());
@ -228,43 +246,69 @@ fn update_dir(
} }
if files_to_download.is_empty() { if files_to_download.is_empty() {
println!( pb.println(format!(
"[{}] No files to download for {}", "[{}] No files to download for {}",
"Info".bright_magenta(), "Info".bright_magenta(),
remote_dir remote_dir
); ));
return; return;
} }
println!( pb.println(format!(
"[{}] Downloading outdated or missing files for {}, {}", "[{}] Downloading outdated or missing files for {}, {}",
"Info".bright_magenta(), "Info".bright_magenta(),
remote_dir, remote_dir,
misc::human_readable_bytes(total_download_size(&files_to_download, remote_dir)) misc::human_readable_bytes(total_download_size(&files_to_download, remote_dir))
); ));
misc::pb_style_download(pb, true);
let client = reqwest::Client::new();
for file in files_to_download { for file in files_to_download {
let file_name = &file.name.replace(&remote_dir_pre, ""); let file_name = &file.name.replace(&remote_dir_pre, "");
let file_path = dir.join(file_name); let file_path = dir.join(file_name);
println!(
"[{}] {} ({})",
"Downloading".bright_yellow(),
file_path.display(),
misc::human_readable_bytes(file.size as u64)
);
if let Some(parent) = file_path.parent() { if let Some(parent) = file_path.parent() {
if !parent.exists() { if !parent.exists() {
fs::create_dir_all(parent).unwrap(); fs::create_dir_all(parent).unwrap();
} }
} }
http::download_file(&format!("{}/{}", MASTER, file.name), &file_path); http_async::download_file_progress(
&client,
pb,
&format!("{}/{}", master_url, file.name),
&file_path,
file.size as u64,
)
.await
.unwrap();
hashes.insert(file_name.to_owned(), file.hash.to_lowercase()); hashes.insert(file_name.to_owned(), file.hash.to_lowercase());
} }
misc::pb_style_download(pb, false);
} }
fn update(game: &Game, dir: &Path, bonus_content: bool, force: bool) { async fn update(
let cdn_info: Vec<CdnFile> = serde_json::from_str(&http::get_body_string( game: &Game<'_>,
format!("{}/files.json", MASTER).as_str(), dir: &Path,
)) bonus_content: bool,
force: bool,
skip_iw4x_sp: Option<bool>,
master_url: &String,
ignore_required_files: Option<bool>,
) {
let skip_iw4x_sp = skip_iw4x_sp.unwrap_or(false);
let ignore_required_files = ignore_required_files.unwrap_or(false);
let res = http_async::get_body_string(format!("{}/files.json", master_url).as_str())
.await
.unwrap(); .unwrap();
let cdn_info: Vec<CdnFile> = serde_json::from_str(&res).unwrap();
if !ignore_required_files && !game.required_files_exist(dir) {
println!(
"{}\nVerify game file integrity on Steam or reinstall the game.",
"Critical game files missing.".bright_red()
);
std::io::stdin().read_line(&mut String::new()).unwrap();
std::process::exit(0);
}
let mut hashes = HashMap::new(); let mut hashes = HashMap::new();
let hash_file = dir.join(".sha-sums"); let hash_file = dir.join(".sha-sums");
@ -278,15 +322,124 @@ fn update(game: &Game, dir: &Path, bonus_content: bool, force: bool) {
} }
} }
update_dir(&cdn_info, game.engine, dir, &mut hashes);
if game.engine == "iw4" { if game.engine == "iw4" {
iw4x::update(dir); iw4x::update(dir).await;
let iw4x_dirs = vec!["iw4x", "zone/patch"];
for d in &iw4x_dirs {
if let Ok(dir_iter) = dir.join(d).read_dir() {
'outer: for file in dir_iter.filter_map(|entry| entry.ok()) {
let file_path = file.path();
if file_path.is_dir() {
continue;
} }
let file_path_rel = match file_path.strip_prefix(dir) {
Ok(rel) => rel.to_path_buf(),
Err(_) => continue,
};
if iw4x_dirs
.iter()
.any(|prefix| file_path_rel.starts_with(Path::new(prefix)))
{
if !cdn_info
.iter()
.any(|cdn_file| cdn_file.name.starts_with("iw4"))
{
continue;
}
let should_continue = cdn_info.iter().any(|cdn_file| {
let path_rem = Path::new(&cdn_file.name)
.strip_prefix(Path::new("iw4"))
.unwrap_or_else(|_| Path::new(&cdn_file.name));
path_rem == file_path_rel
});
if should_continue {
continue 'outer;
}
println!(
"[{}] {}",
"Removed".bright_red(),
misc::cute_path(&file_path)
);
if fs::remove_file(&file_path).is_err() {
println!(
"[{}] Couldn't delete {}",
"Error".bright_red(),
misc::cute_path(&file_path)
);
}
}
}
}
}
}
let pb = ProgressBar::new(0);
update_dir(
&cdn_info,
game.engine,
dir,
&mut hashes,
&pb,
skip_iw4x_sp,
master_url,
)
.await;
if bonus_content && !game.bonus.is_empty() { if bonus_content && !game.bonus.is_empty() {
for bonus in game.bonus.iter() { for bonus in game.bonus.iter() {
update_dir(&cdn_info, bonus, dir, &mut hashes); update_dir(
&cdn_info,
bonus,
dir,
&mut hashes,
&pb,
skip_iw4x_sp,
master_url,
)
.await;
}
}
pb.finish();
for f in game.delete.iter() {
let file_path = dir.join(f);
if file_path.is_file() {
if fs::remove_file(&file_path).is_err() {
println!(
"[{}] Couldn't delete {}",
"Error".bright_red(),
misc::cute_path(&file_path)
);
} else {
println!(
"[{}] {}",
"Removed".bright_red(),
misc::cute_path(&file_path)
);
}
} else if file_path.is_dir() {
if fs::remove_dir_all(&file_path).is_err() {
println!(
"[{}] Couldn't delete {}",
"Error".bright_red(),
misc::cute_path(&file_path)
);
} else {
println!(
"[{}] {}",
"Removed".bright_red(),
misc::cute_path(&file_path)
);
}
} }
} }
@ -298,6 +451,7 @@ fn update(game: &Game, dir: &Path, bonus_content: bool, force: bool) {
} }
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");
println!("Launching {} {}", file_path.display(), args); println!("Launching {} {}", file_path.display(), args);
std::process::Command::new(file_path) std::process::Command::new(file_path)
.args(args.trim().split(' ')) .args(args.trim().split(' '))
@ -314,6 +468,22 @@ fn setup_env() {
println!("{:#?}", error); println!("{:#?}", error);
colored::control::SHOULD_COLORIZE.set_override(false); colored::control::SHOULD_COLORIZE.set_override(false);
}); });
if let Ok(system_root) = env::var("SystemRoot") {
if let Ok(current_dir) = env::current_dir() {
if current_dir.starts_with(system_root) {
if let Ok(current_exe) = env::current_exe() {
if let Some(parent) = current_exe.parent() {
if let Err(error) = env::set_current_dir(parent) {
eprintln!("{:#?}", error);
} else {
println!("Running from the system directory. Changed working directory to the executable location.");
}
}
}
}
}
}
} }
fn arg_value(args: &[String], arg: &str) -> Option<String> { fn arg_value(args: &[String], arg: &str) -> Option<String> {
@ -337,11 +507,11 @@ fn arg_remove_value(args: &mut Vec<String>, arg: &str) {
}; };
} }
fn main() { #[tokio::main]
async fn main() {
#[cfg(windows)] #[cfg(windows)]
setup_env(); setup_env();
let mut args: Vec<String> = env::args().collect();
let mut args: Vec<String> = std::env::args().collect();
if arg_bool(&args, "--help") { if arg_bool(&args, "--help") {
println!("CLI Args:"); println!("CLI Args:");
@ -354,6 +524,7 @@ fn main() {
println!(" --force/-f: Force file hash recheck"); println!(" --force/-f: Force file hash recheck");
println!(" --pass <args>: Pass arguments to the game"); println!(" --pass <args>: Pass arguments to the game");
println!(" --skip-launcher-update: Skip launcher self-update"); println!(" --skip-launcher-update: Skip launcher self-update");
println!(" --ignore-required-files: Skip required files check");
println!( println!(
"\nExample:\n alterware-launcher.exe iw4x --bonus --pass \"-console -nointro\"" "\nExample:\n alterware-launcher.exe iw4x --bonus --pass \"-console -nointro\""
); );
@ -388,13 +559,19 @@ fn main() {
install_path = PathBuf::from(path); install_path = PathBuf::from(path);
arg_remove_value(&mut args, "-p"); arg_remove_value(&mut args, "-p");
} else { } else {
install_path = std::env::current_dir().unwrap(); install_path = env::current_dir().unwrap();
} }
let mut cfg = config::load(install_path.join("alterware-launcher.json")); let mut cfg = config::load(install_path.join("alterware-launcher.json"));
let master_url = if cfg.use_https {
format!("https://{}", MASTER)
} else {
format!("http://{}", MASTER)
};
if !arg_bool(&args, "--skip-launcher-update") && !cfg.skip_self_update { if !arg_bool(&args, "--skip-launcher-update") && !cfg.skip_self_update {
self_update::run(cfg.update_only); self_update::run(cfg.update_only).await;
} else { } else {
arg_remove(&mut args, "--skip-launcher-update"); arg_remove(&mut args, "--skip-launcher-update");
} }
@ -417,15 +594,27 @@ fn main() {
arg_remove(&mut args, "-f"); arg_remove(&mut args, "-f");
} }
let ignore_required_files = arg_bool(&args, "--ignore-required-files");
if ignore_required_files {
arg_remove(&mut args, "--ignore-required-files");
}
if let Some(pass) = arg_value(&args, "--pass") { if let Some(pass) = arg_value(&args, "--pass") {
cfg.args = pass; cfg.args = pass;
arg_remove_value(&mut args, "--pass"); arg_remove_value(&mut args, "--pass");
} else if cfg.args.is_empty() { } else if cfg.args.is_empty() {
cfg.args = String::from(""); cfg.args = String::default();
} }
let games_json = http::get_body_string(format!("{}/games.json", MASTER).as_str()); let games_json = http_async::get_body_string(format!("{}/games.json", master_url).as_str())
let games: Vec<Game> = serde_json::from_str(&games_json).unwrap(); .await
.unwrap();
let games: Vec<Game> = serde_json::from_str(&games_json).unwrap_or_else(|error| {
println!("Error parsing games.json: {:#?}", error);
fs::write("alterware-launcher-error.txt", &games_json).unwrap();
misc::stdin();
std::process::exit(1);
});
let mut game: String = String::new(); let mut game: String = String::new();
if args.len() > 1 { if args.len() > 1 {
@ -441,7 +630,7 @@ fn main() {
} }
#[cfg(windows)] #[cfg(windows)]
setup_client_links(g, &std::env::current_dir().unwrap()); setup_client_links(g, &env::current_dir().unwrap());
#[cfg(not(windows))] #[cfg(not(windows))]
println!("Multiple clients installed, set the client as the first argument to launch a specific client."); println!("Multiple clients installed, set the client as the first argument to launch a specific client.");
@ -462,6 +651,23 @@ fn main() {
for g in games.iter() { for g in games.iter() {
for c in g.client.iter() { for c in g.client.iter() {
if c == &game { if c == &game {
if cfg.engine.is_empty() {
cfg.engine = String::from(g.engine);
config::save_value_s(
install_path.join("alterware-launcher.json"),
"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(),
);
}
}
if cfg.ask_bonus_content && !g.bonus.is_empty() { if cfg.ask_bonus_content && !g.bonus.is_empty() {
println!("Download bonus content? (Y/n)"); println!("Download bonus content? (Y/n)");
let input = misc::stdin().to_ascii_lowercase(); let input = misc::stdin().to_ascii_lowercase();
@ -483,7 +689,11 @@ fn main() {
install_path.as_path(), install_path.as_path(),
cfg.download_bonus_content, cfg.download_bonus_content,
cfg.force_update, cfg.force_update,
); Some(&game != "iw4x-sp"),
&master_url,
Some(ignore_required_files),
)
.await;
if !cfg.update_only { if !cfg.update_only {
launch(&install_path.join(format!("{}.exe", c)), &cfg.args); launch(&install_path.join(format!("{}.exe", c)), &cfg.args);
} }
@ -493,10 +703,7 @@ fn main() {
} }
#[cfg(windows)] #[cfg(windows)]
windows_launcher_install(&games); windows_launcher_install(&games, &master_url).await;
#[cfg(not(windows))]
manual_install(&games);
println!("{}", "Game not found!".bright_red()); println!("{}", "Game not found!".bright_red());
println!("Place the launcher in the game folder, if that doesn't work specify the client on the command line (ex. alterware-launcher.exe iw4-sp)"); println!("Place the launcher in the game folder, if that doesn't work specify the client on the command line (ex. alterware-launcher.exe iw4-sp)");

View File

@ -1,6 +1,10 @@
use std::{fs, path::PathBuf}; use std::{
fs,
path::{Path, PathBuf},
};
use colored::Colorize; use colored::Colorize;
use indicatif::{ProgressBar, ProgressStyle};
pub fn get_file_sha1(path: &PathBuf) -> String { pub fn get_file_sha1(path: &PathBuf) -> String {
let mut sha1 = sha1_smol::Sha1::new(); let mut sha1 = sha1_smol::Sha1::new();
@ -35,5 +39,20 @@ pub fn human_readable_bytes(bytes: u64) -> String {
bytes /= 1024.0; bytes /= 1024.0;
i += 1; i += 1;
} }
format!("{:.2} {}", bytes, units[i]) format!("{:.2}{}", bytes, units[i])
}
pub fn pb_style_download(pb: &ProgressBar, state: bool) {
if state {
pb.set_style(
ProgressStyle::with_template("{spinner:.magenta} {msg:.magenta} > {bytes}/{total_bytes} | {bytes_per_sec} | {eta}")
.unwrap(),
);
} else {
pb.set_style(ProgressStyle::with_template("{spinner:.magenta} {msg}").unwrap());
}
}
pub fn cute_path(path: &Path) -> String {
path.to_str().unwrap().replace('\\', "/")
} }

View File

@ -2,34 +2,45 @@ use crate::github;
use crate::global::*; use crate::global::*;
use semver::Version; use semver::Version;
#[cfg(not(windows))]
use std::{thread, time};
pub fn self_update_available() -> bool { pub async fn self_update_available() -> bool {
let current_version: Version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap(); let current_version: Version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
let latest_version = github::latest_version(GH_OWNER, GH_REPO); let latest_version = github::latest_version(GH_OWNER, GH_REPO).await;
current_version < latest_version current_version < latest_version
} }
#[cfg(not(windows))] #[cfg(not(windows))]
pub fn run(_update_only: bool) { pub async fn run(_update_only: bool) {
if self_update_available() { if self_update_available().await {
println!("A new version of the AlterWare launcher is available."); println!("A new version of the AlterWare launcher is available.");
println!( println!(
"Download it at {}", "Download it at {}",
github::latest_release_url(GH_OWNER, GH_REPO) github::latest_release_url(GH_OWNER, GH_REPO)
); );
println!("Launching in 10 seconds.."); println!("Launching in 10 seconds..");
thread::sleep(time::Duration::from_secs(10)); tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
} }
} }
#[cfg(windows)] #[cfg(windows)]
pub fn run(update_only: bool) { pub fn restart() -> std::io::Error {
use std::os::windows::process::CommandExt;
match std::process::Command::new(std::env::current_exe().unwrap())
.args(std::env::args().skip(1))
.creation_flags(0x00000010) // CREATE_NEW_CONSOLE
.spawn()
{
Ok(_) => std::process::exit(0),
Err(err) => err,
}
}
#[cfg(windows)]
pub async fn run(update_only: bool) {
use std::{fs, path::PathBuf}; use std::{fs, path::PathBuf};
use crate::http; use crate::http_async;
use crate::misc; use crate::misc;
let working_dir = std::env::current_dir().unwrap(); let working_dir = std::env::current_dir().unwrap();
@ -43,11 +54,13 @@ pub fn run(update_only: bool) {
&& (file_name.contains(".__relocated__.exe") && (file_name.contains(".__relocated__.exe")
|| file_name.contains(".__selfdelete__.exe")) || file_name.contains(".__selfdelete__.exe"))
{ {
fs::remove_file(file.path()).unwrap(); fs::remove_file(file.path()).unwrap_or_else(|_| {
println!("Failed to remove old launcher file.");
});
} }
} }
if self_update_available() { if self_update_available().await {
println!("Performing launcher self-update."); println!("Performing launcher self-update.");
println!( println!(
"If you run into any issues, please download the latest version at {}", "If you run into any issues, please download the latest version at {}",
@ -66,15 +79,17 @@ pub fn run(update_only: bool) {
} else { } else {
"alterware-launcher.exe" "alterware-launcher.exe"
}; };
println!("{}", launcher_name);
http::download_file( http_async::download_file(
&format!( &format!(
"{}/download/{}", "{}/download/{}",
github::latest_release_url(GH_OWNER, GH_REPO), github::latest_release_url(GH_OWNER, GH_REPO),
launcher_name launcher_name
), ),
&file_path, &file_path,
); )
.await
.unwrap();
if !file_path.exists() { if !file_path.exists() {
println!("Failed to download launcher update."); println!("Failed to download launcher update.");
@ -83,12 +98,12 @@ pub fn run(update_only: bool) {
self_replace::self_replace("alterware-launcher-update.exe").unwrap(); self_replace::self_replace("alterware-launcher-update.exe").unwrap();
fs::remove_file(&file_path).unwrap(); fs::remove_file(&file_path).unwrap();
println!(
"Launcher updated. View the changelog at https://github.com/{}/{}/releases/latest", // restarting spawns a new console, automation should manually restart on exit code 201
GH_OWNER, GH_REPO,
);
println!("Please restart the launcher.");
if !update_only { if !update_only {
let restart_error = restart().to_string();
println!("Failed to restart launcher: {}", restart_error);
println!("Please restart the launcher manually.");
misc::stdin(); misc::stdin();
} }
std::process::exit(201); std::process::exit(201);

View File

@ -1,3 +1,5 @@
use std::path::Path;
#[derive(serde::Deserialize, serde::Serialize, Clone)] #[derive(serde::Deserialize, serde::Serialize, Clone)]
pub struct CdnFile { pub struct CdnFile {
pub name: String, pub name: String,
@ -12,6 +14,21 @@ pub struct Game<'a> {
pub references: Vec<&'a str>, pub references: Vec<&'a str>,
pub app_id: u32, pub app_id: u32,
pub bonus: Vec<&'a str>, pub bonus: Vec<&'a str>,
pub delete: Vec<&'a str>,
pub required: Vec<&'a str>,
}
impl<'a> Game<'a> {
pub fn required_files_exist(&self, dir: &Path) -> bool {
for required_file in &self.required {
let file_path = dir.join(required_file);
if !file_path.exists() {
println!("Required file {} does not exist", file_path.display());
return false;
}
}
true
}
} }
#[derive(serde::Deserialize, serde::Serialize)] #[derive(serde::Deserialize, serde::Serialize)]
@ -22,6 +39,10 @@ pub struct Config {
pub ask_bonus_content: bool, pub ask_bonus_content: bool,
pub force_update: bool, pub force_update: bool,
pub args: String, pub args: String,
#[serde(default)]
pub engine: String,
#[serde(default)]
pub use_https: bool,
} }
impl Default for Config { impl Default for Config {
@ -32,7 +53,9 @@ impl Default for Config {
download_bonus_content: false, download_bonus_content: false,
ask_bonus_content: true, ask_bonus_content: true,
force_update: false, force_update: false,
args: String::from(""), args: String::default(),
engine: String::default(),
use_https: true,
} }
} }
} }