Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84c75173a0 | ||
|
|
7528ab6fa3 | ||
|
|
fa43459a78 | ||
|
|
252f07cbec | ||
|
|
a0f610ead7 | ||
|
|
ca4bcfc1a5 | ||
|
|
ac4892d4f0 | ||
|
|
240b660923 | ||
|
|
150dfbca72 | ||
|
|
4b78114174 | ||
|
|
d1bde9901d | ||
|
|
c5eba364d9 | ||
|
|
5460b53c26 | ||
|
|
99301b3312 | ||
|
|
8d30af9dee | ||
|
|
8a8109b7df | ||
|
|
e4eaf25c8f | ||
|
|
0daf6089b9 | ||
|
|
7e4197cdbc | ||
|
|
c0f9d8a508 | ||
|
|
2da2b19001 | ||
|
|
62936fa7b7 | ||
|
|
e9fecc7fb7 | ||
|
|
2d58bb491e | ||
|
|
2f123da63a | ||
|
|
7016edf7cd | ||
|
|
11c29112c2 | ||
|
|
b630cf4080 | ||
|
|
1034a5ac04 | ||
|
|
317f60eddd | ||
|
|
9fbe5029e1 | ||
|
|
ebc62b0b1b | ||
|
|
4b47ff1fe0 | ||
|
|
e3155ad7ee | ||
|
|
c45d9fb234 | ||
|
|
22e92e67a7 | ||
|
|
896802cd6f | ||
|
|
cb45ce7b9a | ||
|
|
9678d41b4c | ||
|
|
0daf567111 | ||
|
|
b75e99ffd7 | ||
|
|
5562c44320 | ||
|
|
236a5dd0a3 | ||
|
|
4c10958d10 | ||
|
|
23f7140c66 | ||
|
|
fbcfa1fb34 | ||
|
|
52f36e0d0a | ||
|
|
d90c069a73 | ||
|
|
d2f3eebd42 | ||
|
|
af64ebb12a | ||
|
|
203ca0d388 | ||
|
|
34ee8c6645 | ||
|
|
0cd561b62a | ||
|
|
b9c30b4f52 | ||
|
|
4bcf894704 | ||
|
|
c37800795b | ||
|
|
929f497b9f | ||
|
|
60aebe5eeb | ||
|
|
aef9a10c42 | ||
|
|
c6034bc6b9 | ||
|
|
005288371b | ||
|
|
53e50a5716 | ||
|
|
a50b11633f | ||
|
|
9c4541fe76 | ||
|
|
ac3e7ee128 | ||
|
|
1495ad386d | ||
|
|
4edf71aa0a | ||
|
|
113e5f885b | ||
|
|
a3092b1bf3 | ||
|
|
e28929bb70 | ||
|
|
4a820e3083 | ||
|
|
d866b4992b | ||
|
|
376c5294d9 | ||
|
|
71651bab6c | ||
|
|
1dba57af4b | ||
|
|
dabf5d4ef0 | ||
|
|
75f8c841df | ||
|
|
5bce8709af | ||
|
|
a418bcfb90 | ||
|
|
90d59cec97 | ||
|
|
a8ae07931d | ||
|
|
a4ce65fe57 | ||
|
|
d7e94eab90 | ||
|
|
a08c588df3 | ||
|
|
385b1a5af2 | ||
|
|
be02f086c7 | ||
|
|
cc35b2cd85 | ||
|
|
a419aad160 | ||
|
|
21d4601e41 | ||
|
|
adf8a62e8a | ||
|
|
a1d14669c7 | ||
|
|
46a54cef12 | ||
|
|
a94f8f0e32 | ||
|
|
0da098afb6 | ||
|
|
c8e9f8f1fc | ||
|
|
506c82e86a | ||
|
|
7e45cb0fa2 | ||
|
|
3729d3c656 | ||
|
|
773d24a00c | ||
|
|
661329877f | ||
|
|
08f1f9f4d1 | ||
|
|
dccdffe761 | ||
|
|
957ad47b4d | ||
|
|
16d8f567a4 | ||
|
|
c883fc586c | ||
|
|
cc73f23c1c | ||
|
|
ec7daf7f6b | ||
|
|
d0de2974d8 | ||
|
|
5a54d43601 | ||
|
|
cbc131028f | ||
|
|
239a82876e | ||
|
|
1dfe9cd9df | ||
|
|
f2124218e4 | ||
|
|
cf087d96c7 | ||
|
|
6bb59f4060 | ||
|
|
d53476399d | ||
|
|
d34293e2c8 | ||
|
|
f82df9eacf | ||
|
|
e73617c2f4 | ||
|
|
67b0559058 | ||
|
|
dfe65aacd4 | ||
|
|
6aa1ec4201 | ||
|
|
d6223e54b0 | ||
|
|
83552f833c | ||
|
|
f0657be289 | ||
|
|
23fb10f48e | ||
|
|
eeca71fc25 | ||
|
|
89f37ab70d | ||
|
|
9d1ee7e130 | ||
|
|
9a37cebe47 | ||
|
|
239f806f7e | ||
|
|
54e2d2feaa | ||
|
|
796dcd5588 | ||
|
|
35f1f180d2 | ||
|
|
fe40a5e54f | ||
|
|
936dfe8d02 | ||
|
|
9db40fe664 | ||
|
|
5bcc4ec76d | ||
|
|
155306b1ab | ||
|
|
cff7b1c2e9 | ||
|
|
38203a9530 | ||
|
|
01c8a5276b | ||
|
|
17229c1cba | ||
|
|
adc617730b | ||
|
|
8acd359028 | ||
|
|
a03971ce70 | ||
|
|
054486dfef | ||
|
|
3043005977 | ||
|
|
998b15d5e8 | ||
|
|
9d8bbec03a | ||
|
|
6425f3d8e3 | ||
|
|
ad64ba75c9 | ||
|
|
47f7622606 | ||
|
|
81c2d19a09 | ||
|
|
b500806815 | ||
|
|
60ce184d8f | ||
|
|
2edb81247b | ||
|
|
7b67222885 | ||
|
|
4ddb33cabb | ||
|
|
364f0b3482 | ||
|
|
5482f296a5 | ||
|
|
0d52c83ed9 | ||
|
|
b92e337016 | ||
|
|
ee73c2cfa3 | ||
|
|
8ffb1c7ea6 | ||
|
|
9040977447 | ||
|
|
da6cc9c5c3 | ||
|
|
c40d767dcc | ||
|
|
6f3b272bfe | ||
|
|
ffe3dac3a8 | ||
|
|
5fa8498c56 | ||
|
|
c0b5c5bd89 | ||
|
|
6d428ebb0d | ||
|
|
479be05452 | ||
|
|
95a775cd74 | ||
|
|
1bfb054be2 | ||
|
|
6b31bb3ab3 | ||
|
|
c5b13ff0f3 | ||
|
|
5a33591d6a | ||
|
|
62b00507e5 | ||
|
|
d56bc5a57d | ||
|
|
0b433af230 | ||
|
|
61f3fd9821 | ||
|
|
c7bd8d3809 | ||
|
|
0d3a3debf9 | ||
|
|
8e492095d9 | ||
|
|
6a554b4e88 | ||
|
|
e2848b3fed | ||
|
|
a5be4d9d31 | ||
|
|
da5a5999f0 | ||
|
|
f4f3e61b83 | ||
|
|
3d91e07d25 | ||
|
|
cff4a2e1e7 | ||
|
|
4f3f17450c | ||
|
|
5d8741edfa | ||
|
|
94cabc9d70 | ||
|
|
9508bfd416 | ||
|
|
3ace15d78a | ||
|
|
2bb575cd97 | ||
|
|
5dfa51dc15 | ||
|
|
5dd0cd416b | ||
|
|
6f5f9ecb7b | ||
|
|
5b9309a6bd | ||
|
|
9c6847ba39 | ||
|
|
8f3238e4de | ||
|
|
8c7ae8acee | ||
|
|
9d94b4ff09 | ||
|
|
4795aeb3f9 | ||
|
|
12d971a5cf | ||
|
|
ff0c5caf30 | ||
|
|
63beb61878 | ||
|
|
6c192741ec | ||
|
|
437ea2a218 | ||
|
|
ee0fd7b78c | ||
|
|
562f6453dc | ||
|
|
51308e788e | ||
|
|
acc356d3a0 | ||
|
|
eaedde7ee5 | ||
|
|
43f32638f8 | ||
|
|
12b82cd1dd | ||
|
|
6081e6d2a7 | ||
|
|
f7af8ff35a | ||
|
|
51a5f4b8ef | ||
|
|
f9ba990142 | ||
|
|
09fdbf3a6f | ||
|
|
c57af3086c | ||
|
|
4e5f988ef7 | ||
|
|
e8c51cbadf | ||
|
|
495e7c14be | ||
|
|
b4ae6a9e8b | ||
|
|
99e13be3e8 | ||
|
|
760634d3d8 | ||
|
|
ae67124c10 | ||
|
|
235f4bca37 | ||
|
|
8ae6d67cca | ||
|
|
50b4ad8e3c | ||
|
|
bc712e926d | ||
|
|
321384dc7b | ||
|
|
e02f02b775 | ||
|
|
de524bd2a5 | ||
|
|
edee9b6234 | ||
|
|
cefd041e08 | ||
|
|
881b0b3008 | ||
|
|
2a59441dbc | ||
|
|
5ab18d0796 | ||
|
|
23e3d34947 | ||
|
|
b86dd37b50 | ||
|
|
59fdd30236 | ||
|
|
a35bfda5f1 | ||
|
|
5393bf1f5f | ||
|
|
90b3aa8663 | ||
|
|
728e4daf7c | ||
|
|
7a210c7f39 | ||
|
|
459dd69359 | ||
|
|
fbd1a355d5 | ||
|
|
82d2afb1f2 | ||
|
|
8193980878 | ||
|
|
acdb34d36a | ||
|
|
d6d0b241e0 | ||
|
|
f75ef947c9 | ||
|
|
6dc9a719ee | ||
|
|
785df28f66 | ||
|
|
66e114a400 | ||
|
|
2ba07bbba8 | ||
|
|
65eda05d9f | ||
|
|
f3b3f79bfb | ||
|
|
28c7d7f949 | ||
|
|
d072c8107e | ||
|
|
0629c8a6ba | ||
|
|
8aea4af687 | ||
|
|
0562d8230d | ||
|
|
759327e932 | ||
|
|
36753e02f1 | ||
|
|
2ab2e23736 | ||
|
|
34e7b2e480 | ||
|
|
540d0ad7e4 | ||
|
|
47bea45111 | ||
|
|
d03346b56a | ||
|
|
54e0762882 | ||
|
|
0834a86d33 | ||
|
|
c6a8841614 | ||
|
|
df92acb7dc | ||
|
|
a333571f94 | ||
|
|
05f88b6019 | ||
|
|
1f31c43fe4 | ||
|
|
0763416903 | ||
|
|
3b384c5a4d | ||
|
|
3ab666a807 | ||
|
|
c8f7a32284 | ||
|
|
a070e9fc65 | ||
|
|
5f55e3c664 | ||
|
|
07606d8852 | ||
|
|
afffc90abc | ||
|
|
70db7b45b3 | ||
|
|
aac8558079 | ||
|
|
ac8ff2febf | ||
|
|
6369d895fd | ||
|
|
7413f7c029 | ||
|
|
3f1d8cb24f | ||
|
|
4df12605fc | ||
|
|
2c5da88e06 | ||
|
|
3cb6175436 | ||
|
|
3739f19ab2 | ||
|
|
2da4d001d6 | ||
|
|
5d61a1f513 | ||
|
|
56c80d187b | ||
|
|
e08f66cdcb | ||
|
|
48fee301bb | ||
|
|
20511f5661 | ||
|
|
d2e8333ba9 | ||
|
|
5d37039064 | ||
|
|
ce44cdbc54 | ||
|
|
5b2738420e | ||
|
|
1e29288e2a | ||
|
|
745cc06091 | ||
|
|
0311cc8a95 | ||
|
|
7c3521cf97 | ||
|
|
bb0eefadd2 | ||
|
|
7eb5a4fac5 | ||
|
|
ebce329c3d | ||
|
|
23464d3b51 | ||
|
|
602a7b8edc | ||
|
|
59c58a1df5 | ||
|
|
830318d98e | ||
|
|
271c3e6197 | ||
|
|
1ab9634069 | ||
|
|
8666b0055a | ||
|
|
406554e011 | ||
|
|
5334d07f7f | ||
|
|
6cab96d1f8 | ||
|
|
bc94d989d4 | ||
|
|
e4fff5f242 | ||
|
|
53f2fe922a | ||
|
|
800f68a1b7 | ||
|
|
c6c377e8b9 | ||
|
|
7a68d7e097 | ||
|
|
f60a6edf2b | ||
|
|
8c33a1b371 | ||
|
|
e5f7391b89 | ||
|
|
a8f51280e8 | ||
|
|
c19346529b | ||
|
|
85451f765b | ||
|
|
5a144f7815 | ||
|
|
2370e81403 | ||
|
|
c11511abff | ||
|
|
bda7223ac8 | ||
|
|
6b48ee127d | ||
|
|
aa8a52bfc0 | ||
|
|
8ea62434ee | ||
|
|
baeaeb1b64 | ||
|
|
32b424da5c | ||
|
|
d71110d0a1 | ||
|
|
bc9178d2de | ||
|
|
1533febf9a | ||
|
|
c3c8872fad | ||
|
|
bae6a57e1e | ||
|
|
3bdc0057a2 | ||
|
|
5496f914f2 | ||
|
|
cb9db55bcb | ||
|
|
c0ab8111fd | ||
|
|
10c6a79b17 | ||
|
|
2b4b533a5b | ||
|
|
dcb8be9132 | ||
|
|
278aa8c28a | ||
|
|
32e5bafb33 | ||
|
|
59e19510e3 | ||
|
|
45ab112970 | ||
|
|
ed07fd0343 | ||
|
|
c2c7b37b90 | ||
|
|
23798c91d3 | ||
|
|
659cbb83a3 | ||
|
|
32c467fc6d | ||
|
|
d01add3573 | ||
|
|
0de89a3ef1 | ||
|
|
5686ea76c2 | ||
|
|
5fda598173 | ||
|
|
049fb47019 | ||
|
|
81f269b71b | ||
|
|
c97a7a260f | ||
|
|
b715eb5a3e | ||
|
|
8e6cf7e792 | ||
|
|
98868073a5 |
No files matched your search
@@ -5,6 +5,10 @@ labels: ["bug"]
|
|||||||
assignees:
|
assignees:
|
||||||
- aclist
|
- aclist
|
||||||
body:
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
### WARNING: When posting log/config data, redact any sensitive information like API keys.
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: kb
|
id: kb
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ labels: ["troubleshooting"]
|
|||||||
assignees:
|
assignees:
|
||||||
- aclist
|
- aclist
|
||||||
body:
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
### WARNING: When posting log/config data, redact any sensitive information like API keys.
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: device
|
id: device
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ jobs:
|
|||||||
mirror-to-codeberg:
|
mirror-to-codeberg:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: pixta-dev/repository-mirroring-action@v1
|
- uses: pixta-dev/repository-mirroring-action@v1
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
tags
|
tags
|
||||||
|
__pycache__
|
||||||
|
pre-commit
|
||||||
|
tests/
|
||||||
@@ -1,5 +1,216 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [6.0.6-beta.1] 2026-05-17
|
||||||
|
## Changed
|
||||||
|
- Update symlink hash logic to align with DZGUI 7 beta
|
||||||
|
- Update A2S helper to latest commit
|
||||||
|
|
||||||
|
## [6.0.5-beta.2] 2026-04-17
|
||||||
|
## Changed
|
||||||
|
- During server connection attempts, only download mods local to specific server
|
||||||
|
|
||||||
|
## [6.0.5-beta.1] 2026-04-13
|
||||||
|
## Fixed
|
||||||
|
- Update A2S module checksums to support servers with missing description field
|
||||||
|
## Changed
|
||||||
|
- Bump version to reflect hotfixes on stable branch
|
||||||
|
|
||||||
|
## [6.0.2-beta.5] 2026-04-12
|
||||||
|
## Fixed
|
||||||
|
- Use conditional logic when testing GLibUnix namespaces
|
||||||
|
|
||||||
|
## [6.0.2-beta.4] 2026-04-10
|
||||||
|
## Fixed
|
||||||
|
- Use GLibUnix namespace when setting up SIGINT handling
|
||||||
|
|
||||||
|
## [6.0.2-beta.3] 2026-01-26
|
||||||
|
## Fixed
|
||||||
|
- Raise error correctly from module
|
||||||
|
|
||||||
|
## [6.0.2-beta.2] 2026-01-18
|
||||||
|
## Fixed
|
||||||
|
- Helpers not being downloaded (uncommented boilerplate)
|
||||||
|
|
||||||
|
## [6.0.2-beta.1] 2026-01-18
|
||||||
|
## Fixed
|
||||||
|
- Do not spawn dialogs from inside of thread when fetching prereqs
|
||||||
|
## Changed
|
||||||
|
- Optimize time complexity of startup checks
|
||||||
|
- Optimize coordinate calculation by using local records first
|
||||||
|
- Rename some internal functions
|
||||||
|
- Wrap entire startup process in dialog
|
||||||
|
|
||||||
|
## [6.0.1-beta.1] 2026-01-16
|
||||||
|
## Fixed
|
||||||
|
- Explicitly use Python 3.13 when calling subprocesses
|
||||||
|
|
||||||
|
## [6.0.0-beta.20] 2026-01-14
|
||||||
|
## Fixed
|
||||||
|
- Write cache file after wiping
|
||||||
|
|
||||||
|
## [6.0.0-beta.19] 2026-01-14
|
||||||
|
## Fixed
|
||||||
|
- Steam Deck compatible script path expansion
|
||||||
|
|
||||||
|
## [6.0.0-beta.18] 2026-01-14
|
||||||
|
## Fixed
|
||||||
|
- Update UI checksums
|
||||||
|
|
||||||
|
## [6.0.0-beta.17] 2026-01-14
|
||||||
|
## Added
|
||||||
|
- More descriptive help dialogs when initial dependencies are missing
|
||||||
|
|
||||||
|
## [6.0.0-beta.16] 2026-01-04
|
||||||
|
## Fixed
|
||||||
|
- Regression introduced in previous hotfix
|
||||||
|
|
||||||
|
## [6.0.0-beta.15] 2025-12-27
|
||||||
|
## Fixed
|
||||||
|
- Path discovery during first-time setup when parsing filepaths with whitespaces
|
||||||
|
- First-time setup dialog continuously triggering when DayZ install path had whitespaces in it
|
||||||
|
|
||||||
|
## [6.0.0-beta.14] 2025-12-09
|
||||||
|
## Fixed
|
||||||
|
- Dialogs with newlines breaking output in log table
|
||||||
|
|
||||||
|
## [6.0.0-beta.13] 2025-11-29
|
||||||
|
## Fixed
|
||||||
|
- Server filter panel not being hidden when entering other page contexts
|
||||||
|
- Path to remote changelog being constructed incorrectly
|
||||||
|
|
||||||
|
## [6.0.0-beta.12] 2025-11-14
|
||||||
|
## Changed
|
||||||
|
- Require Python 3.13
|
||||||
|
## Fixed
|
||||||
|
- Normalize beta version
|
||||||
|
|
||||||
|
## [6.0.0-beta.11] 2025-11-13
|
||||||
|
## Added
|
||||||
|
- Support sandboxed flatpak
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Preferred client from radio toggle to combobox
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Config file erroneously getting updated when populating settings menu
|
||||||
|
|
||||||
|
## [6.0.0-beta.10] 2025-11-10
|
||||||
|
## Fixed
|
||||||
|
- Python 3.14 error in finally block
|
||||||
|
- Require Python version between 3.11 and 3.12
|
||||||
|
|
||||||
|
## [6.0.0-beta.9] 2025-11-05
|
||||||
|
## Fixed
|
||||||
|
- UI not being constructed correctly if CHANGELOG.md was missing
|
||||||
|
|
||||||
|
## [6.0.0-beta.8] 2025-11-04
|
||||||
|
## Added
|
||||||
|
- Internal flag to allow distribution packaged releases to disable in-app updates
|
||||||
|
- Pre-boot check to test whether script was invoked directly
|
||||||
|
- Commandline usage help text
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- ESC key destroying wait dialogs while a thread is pending
|
||||||
|
- Tooltip signals being erroneously drawn on main menu
|
||||||
|
- Leaky variable name in dialog titles
|
||||||
|
- Prevent extraneous signals from propagating when column width is adjusted
|
||||||
|
- Script failing to start when remote endpoints are unavailable (GaryBlackbourne)
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Optimize time complexity of pre-boot checks (GaryBlackbourne)
|
||||||
|
- Moved location of notes file
|
||||||
|
- Rewrote distance calculation module (GaryBlackbourne)
|
||||||
|
|
||||||
|
## [6.0.0-beta.7] 2025-09-20
|
||||||
|
## Added
|
||||||
|
- Users can save text notes to describe servers
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- State file serialization methods
|
||||||
|
|
||||||
|
## [6.0.0-beta.6] 2025-09-12
|
||||||
|
## Added
|
||||||
|
- Support DayZ Experimental
|
||||||
|
- Show additional client information in Options menu
|
||||||
|
- Warn user of client version mismatches
|
||||||
|
- Support clickable hyperlinks
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Mods rarely not appearing in local mod list if download completed too quickly
|
||||||
|
- Statusbar not updating when clicking a row after spamming keyboard input
|
||||||
|
- Extraneous logs being generated when subscribing to mods
|
||||||
|
- Narrow width of columns in modlist dialogs occluding text
|
||||||
|
- Newline terminators in history file
|
||||||
|
- Floating point number calculation
|
||||||
|
- Window resizing too small if no prior resolution was set
|
||||||
|
|
||||||
|
## [6.0.0-beta.5] 2025-08-20
|
||||||
|
## Fixed
|
||||||
|
- Servers returning malformed A2S_INFO blocking server browser from loading
|
||||||
|
|
||||||
|
## [6.0.0-beta.4] 2025-08-13
|
||||||
|
## Fixed
|
||||||
|
- Branch toggle signal being emitted when entering Options menu from other contexts
|
||||||
|
|
||||||
|
## [6.0.0-beta.3] 2025-08-08
|
||||||
|
## Added
|
||||||
|
- Additional server metadata to details dialog
|
||||||
|
- Prompt user when connecting if a server is locked
|
||||||
|
- Dedicated settings page ("Options")
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Statusbar contents not updating on certain pages
|
||||||
|
- Breadcrumbs not updating when returning from keybindings page
|
||||||
|
- Wrap long descriptions in server details
|
||||||
|
- Prevent debug button from activating when in certain input fields
|
||||||
|
- Window size not updating correctly when unmaximizing window after changing "fullscreen at boot" setting
|
||||||
|
|
||||||
|
## Dropped
|
||||||
|
- Extraneous information from right statusbar
|
||||||
|
|
||||||
|
## [6.0.0-beta.2] 2025-07-29
|
||||||
|
## Fixed
|
||||||
|
- Missing parameters when closing application via window decorations
|
||||||
|
|
||||||
|
## [6.0.0-beta.1] 2025-07-29
|
||||||
|
## Added
|
||||||
|
- Ping column to server browsing contexts
|
||||||
|
- Server details dialog to server browsing contexts
|
||||||
|
- Filter by modded servers
|
||||||
|
- Breadcrumbs showing current menu context to top of window
|
||||||
|
- Speed up load time and navigation of server tables
|
||||||
|
- More robust threading and cache system when filtering servers
|
||||||
|
- Dedicated changelog page
|
||||||
|
- Dedicated keybindings page
|
||||||
|
- Vim-style navigation keybindings
|
||||||
|
- Additional validation on entry dialogs to prevent submitting empty text
|
||||||
|
- Added "Return to main menu" button to dialog windows when failing to load server table
|
||||||
|
- Dynamic context menus for modded servers
|
||||||
|
- Additional keybindings for filter toggles
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Entry dialog sensitivity when validating API keys
|
||||||
|
- Normalized buttons in dialogs and restored proper padding
|
||||||
|
- GTK errors being emitted to stdout when inserting debug table
|
||||||
|
- Suppress errors during pre-boot checks when mods are not installed
|
||||||
|
- Centered filter checkboxes within panel
|
||||||
|
- Do not pop unhighlight/select stale buttons if no stale mods exist
|
||||||
|
- Improved keybinding interaction with side panels
|
||||||
|
- Key stickiness when quickly navigating through entries in tables
|
||||||
|
- Suppress typeahead search in mod dialogs
|
||||||
|
- Do not trigger global API cooldown if no LAN/favorite servers are found
|
||||||
|
- Fix table column expansion in server mod dialogs
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Reduced global API cooldown from 60s to 30s
|
||||||
|
- Clarify dialog messages when DayZ path could not be found
|
||||||
|
- Auto-focus first item when opening context menus
|
||||||
|
- Opacity setting on side buttons when in a different context
|
||||||
|
- Refactored BM API key validation to account for new key format
|
||||||
|
|
||||||
|
## Dropped
|
||||||
|
- Ping readout in statusbar
|
||||||
|
|
||||||
## [5.8.0-beta.2] 2025-07-06
|
## [5.8.0-beta.2] 2025-07-06
|
||||||
## Added
|
## Added
|
||||||
- Filter servers by official/unofficial status
|
- Filter servers by official/unofficial status
|
||||||
@@ -405,7 +616,7 @@ As part of this change, version 4.0.0 introduces the ability to connect to or ad
|
|||||||
|
|
||||||
If you encounter any problems with this new release or with the migration of configs, please do not hesitate to submit a bug report.
|
If you encounter any problems with this new release or with the migration of configs, please do not hesitate to submit a bug report.
|
||||||
|
|
||||||
Attention Fedora 38 users: problems with upstream GNOME packages causing crashes have been reported to GNOME development and a fix has been issued. You have the choice of compiling the zenity package
|
Attention Fedora 38 users: problems with upstream GNOME packages causing crashes have been reported to GNOME development and a fix has been issued. You have the choice of compiling the zenity package
|
||||||
from source or waiting until the latest version is merged into Fedora's package manager.
|
from source or waiting until the latest version is merged into Fedora's package manager.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -430,7 +641,7 @@ from source or waiting until the latest version is merged into Fedora's package
|
|||||||
- Store complete IP:Port instead of server IDs
|
- Store complete IP:Port instead of server IDs
|
||||||
- Make Battlemetrics API key optional: this is only used for the 'Connect by ID' and 'Add server by ID' methods and is not required. If you prefer, you can simply connect/add by IP.
|
- Make Battlemetrics API key optional: this is only used for the 'Connect by ID' and 'Add server by ID' methods and is not required. If you prefer, you can simply connect/add by IP.
|
||||||
- Prevent the application from launching in Game Mode on Steam Deck: Steam Deck's kiosk mode has problems sending keyboard input to third party applications. To prevent unintended usage, DZGUI now warns the user to launch the app in Desktop Mode if they attempt to use it from Game Mode. Adding DZGUI as a Non-Steam Game does work on desktop PCs, but is not recommended due to the way Steam handles subshells. For best results, launch DZGUI directly via the script/applications menu (PC) or via the desktop icon (Steam Deck).
|
- Prevent the application from launching in Game Mode on Steam Deck: Steam Deck's kiosk mode has problems sending keyboard input to third party applications. To prevent unintended usage, DZGUI now warns the user to launch the app in Desktop Mode if they attempt to use it from Game Mode. Adding DZGUI as a Non-Steam Game does work on desktop PCs, but is not recommended due to the way Steam handles subshells. For best results, launch DZGUI directly via the script/applications menu (PC) or via the desktop icon (Steam Deck).
|
||||||
- Omit null servers from list: servers that time out or send an empty response are now omitted entirely from the My Servers list, as they will not return meaningful metadata unless they are online.
|
- Omit null servers from list: servers that time out or send an empty response are now omitted entirely from the My Servers list, as they will not return meaningful metadata unless they are online.
|
||||||
The My Servers list thus shows online and accessible servers
|
The My Servers list thus shows online and accessible servers
|
||||||
|
|
||||||
## [3.3.0] 2023-05-16
|
## [3.3.0] 2023-05-16
|
||||||
@@ -449,7 +660,7 @@ from source or waiting until the latest version is merged into Fedora's package
|
|||||||
- First-time setup: sudo escalation when checking system map count for the first time
|
- First-time setup: sudo escalation when checking system map count for the first time
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Steam Deck: non-ASCII delimiter causing setup menu to despawn on some devices
|
- Steam Deck: non-ASCII delimiter causing setup menu to despawn on some devices
|
||||||
- Don't add items in My Servers multiple times to array when the list of favorites is paginated
|
- Don't add items in My Servers multiple times to array when the list of favorites is paginated
|
||||||
- Trigger progress dialogs sooner and in sequence to reduce appearance of visual lag
|
- Trigger progress dialogs sooner and in sequence to reduce appearance of visual lag
|
||||||
- First-time setup: break out of dialogs correctly when user backs out
|
- First-time setup: break out of dialogs correctly when user backs out
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# Introduction
|
||||||
|
|
||||||
|
Thank you for your interest in DZGUI!
|
||||||
|
|
||||||
|
This guide goes over development conventions and best practices for contributors.
|
||||||
|
If you are a developer, you can skip to the end.
|
||||||
|
|
||||||
|
# Requesting help
|
||||||
|
|
||||||
|
If you encounter a problem with DZGUI, you can submit tickets on the GitHub
|
||||||
|
[issue tracker](https://github.com/aclist/dztui/issues) under the
|
||||||
|
`troubleshooting` tag.
|
||||||
|
|
||||||
|
# How can I help the project?
|
||||||
|
|
||||||
|
There are several ways to help this project.
|
||||||
|
1. Report bugs that you find
|
||||||
|
2. Request features that you would like
|
||||||
|
3. Contribute features and fixes to the codebase
|
||||||
|
4. Contribute documentation to the project
|
||||||
|
|
||||||
|
Before making any contribution, please read the `CODE_OF_CONDUCT.md` and act
|
||||||
|
accordingly.
|
||||||
|
|
||||||
|
## Submitting a ticket
|
||||||
|
|
||||||
|
Navigate to the GitHub [issue tracker](https://github.com/aclist/dztui/issues).
|
||||||
|
From there, follow the onscreen prompts. You will be asked questions such as:
|
||||||
|
|
||||||
|
- What version are you using?
|
||||||
|
- What distribution are you using?
|
||||||
|
- What is the issue that you found?
|
||||||
|
- How can we reproduce the issue?
|
||||||
|
|
||||||
|
You can also attach screenshots, logs, or other data that can help us.
|
||||||
|
|
||||||
|
## Requesting a feature
|
||||||
|
|
||||||
|
You can also request features via the same issue tracker. It is good practice to
|
||||||
|
first search for your idea to see if a similar one has already been posted.
|
||||||
|
If not, open a ticket where you describe your feature and its possible benefits.
|
||||||
|
|
||||||
|
Please note that this is a community project, so it takes time for us to develop
|
||||||
|
features. Putting in a feature request does not mean that it will be implemented,
|
||||||
|
but we will do our best to support as many cool ideas as possible.
|
||||||
|
|
||||||
|
## Contributing code or documentation
|
||||||
|
|
||||||
|
If you would like to take ownership or assist with an issue on the issue tracker, or
|
||||||
|
contribute a new change, please follow the guidelines below.
|
||||||
|
|
||||||
|
Fork this repository and check out the code up to `prerelease/<latest-version>`.
|
||||||
|
If there is no pending prerelease PR, you can base your changes off of
|
||||||
|
the `testing` branch. You may later be asked to retarget your PR to the prerelease
|
||||||
|
branch once a new one is made. This is because out-of-band PRs are consolidated into
|
||||||
|
the next release before merging.
|
||||||
|
|
||||||
|
The following naming conventions apply for PRs:
|
||||||
|
- fix/<your-fix> - patch/hotfix branches
|
||||||
|
- feat/<your-feature> - feature branches
|
||||||
|
- doc/<your-doc-branch> - documentation branches
|
||||||
|
- infra/<your-infra-branch> - infrastructure branches
|
||||||
|
|
||||||
|
Implement your changes and test them locally. If they work you may
|
||||||
|
open a merge request, and then we review your changes. If everything is OK, it
|
||||||
|
will be merged to `prerelease/<latest-version>`, then `testing`, and after a live
|
||||||
|
testing phase, to `stable` as well.
|
||||||
|
|
||||||
|
It is recommended to follow
|
||||||
|
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), as this
|
||||||
|
integrates well with tooling and helps the project review your code.
|
||||||
@@ -11,6 +11,15 @@ This overcomes certain limitations in the Linux client and helps prepare the gam
|
|||||||
- Concatenate launch options to pass to Steam
|
- Concatenate launch options to pass to Steam
|
||||||
- Connect to mod-enabled LAN servers
|
- Connect to mod-enabled LAN servers
|
||||||
|
|
||||||
|
## Design philosophy
|
||||||
|
|
||||||
|
DZGUI follows a specific set of guidelines, enumerated below:
|
||||||
|
|
||||||
|
- Provide a free and open-source tool under GPL
|
||||||
|
- Do not use undocumented, third-party servers to aggregate data; no central "DZGUI" server
|
||||||
|
- All connections go to Steam and DayZ servers directly; the tool should function in perpetuity without intermediary endpoints
|
||||||
|
- Target Linux desktop and Steam deck specifically; not a cross-platform tool
|
||||||
|
|
||||||
## Setup and usage
|
## Setup and usage
|
||||||
|
|
||||||
Refer to the documentation for installation and setup instructions:
|
Refer to the documentation for installation and setup instructions:
|
||||||
@@ -18,7 +27,6 @@ Refer to the documentation for installation and setup instructions:
|
|||||||
- [GitHub](https://aclist.github.io/dzgui/index.html)
|
- [GitHub](https://aclist.github.io/dzgui/index.html)
|
||||||
- [Mirror (Codeberg)](https://aclist.codeberg.page)
|
- [Mirror (Codeberg)](https://aclist.codeberg.page)
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=5.8.0-beta.2
|
src_path="$(readlink -e "$0")"
|
||||||
|
version=6.0.6-beta.1
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
@@ -39,6 +40,7 @@ cols_file="$state_path/$prefix.cols.json"
|
|||||||
|
|
||||||
#CACHE FILES
|
#CACHE FILES
|
||||||
coords_file="$cache_path/$prefix.coords"
|
coords_file="$cache_path/$prefix.coords"
|
||||||
|
src_path_file="$cache_path/$prefix.src"
|
||||||
|
|
||||||
#legacy paths
|
#legacy paths
|
||||||
hist_file="$config_path/history"
|
hist_file="$config_path/history"
|
||||||
@@ -63,17 +65,14 @@ testing_url="$url_prefix/testing"
|
|||||||
releases_url="https://github.com/$author/$repo/releases/download/browser"
|
releases_url="https://github.com/$author/$repo/releases/download/browser"
|
||||||
km_helper_url="$releases_url/latlon"
|
km_helper_url="$releases_url/latlon"
|
||||||
|
|
||||||
|
|
||||||
set_im_module(){
|
set_im_module(){
|
||||||
#TODO: drop pending SteamOS changes
|
#TODO: drop pending SteamOS changes
|
||||||
pgrep -a gamescope | grep -q "generate-drm-mode"
|
if pgrep -a gamescope | grep -q "generate-drm-mode"; then
|
||||||
if [[ $? -eq 0 ]]; then
|
unset GTK_IM_MODULE
|
||||||
GTK_IM_MODULE=""
|
|
||||||
logger INFO "Detected Steam Deck (Game Mode), unsetting GTK_IM_MODULE"
|
logger INFO "Detected Steam Deck (Game Mode), unsetting GTK_IM_MODULE"
|
||||||
else
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
redact(){
|
redact(){
|
||||||
sed 's@\(/home/\)[^/]*@\1REDACTED@g'
|
sed 's@\(/home/\)[^/]*@\1REDACTED@g'
|
||||||
}
|
}
|
||||||
@@ -87,13 +86,21 @@ logger(){
|
|||||||
printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" \
|
printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" \
|
||||||
| redact >> "$debug_log"
|
| redact >> "$debug_log"
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_dirs(){
|
setup_dirs(){
|
||||||
for dir in "$state_path" "$cache_path" "$share_path" "$helpers_path" "$freedesktop_path" "$config_path" "$log_path"; do
|
directories=()
|
||||||
if [[ ! -d $dir ]]; then
|
directories+=("$state_path")
|
||||||
mkdir -p "$dir"
|
directories+=("$cache_path")
|
||||||
fi
|
directories+=("$share_path")
|
||||||
|
directories+=("$helpers_path")
|
||||||
|
directories+=("$freedesktop_path")
|
||||||
|
directories+=("$config_path")
|
||||||
|
directories+=("$log_path")
|
||||||
|
for dir in "${directories[@]}"; do
|
||||||
|
mkdir -p "$dir"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_state_files(){
|
setup_state_files(){
|
||||||
if [[ -f "$debug_log" ]]; then
|
if [[ -f "$debug_log" ]]; then
|
||||||
rm "$debug_log" && touch $debug_log
|
rm "$debug_log" && touch $debug_log
|
||||||
@@ -104,13 +111,13 @@ setup_state_files(){
|
|||||||
logger INFO "Migrating legacy version file"
|
logger INFO "Migrating legacy version file"
|
||||||
fi
|
fi
|
||||||
# wipe cache files
|
# wipe cache files
|
||||||
local path="$cache_path"
|
if [[ $(ls -A "$cache_path") ]]; then
|
||||||
if find "$path" -mindepth 1 -maxdepth 1 | read; then
|
for file in "$cache_path"/*; do
|
||||||
for file in $path/*; do
|
|
||||||
rm "$file"
|
rm "$file"
|
||||||
done
|
done
|
||||||
logger INFO "Wiped cache files"
|
logger INFO "Wiped cache files"
|
||||||
fi
|
fi
|
||||||
|
echo "$src_path" > "$src_path_file"
|
||||||
}
|
}
|
||||||
print_config_vals(){
|
print_config_vals(){
|
||||||
local keys=(
|
local keys=(
|
||||||
@@ -132,10 +139,10 @@ print_config_vals(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
test_gobject(){
|
test_gobject(){
|
||||||
python3 -c "import gi"
|
python3.13 -c "import gi"
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
logger CRITICAL "Missing PyGObject"
|
logger CRITICAL "Missing PyGObject"
|
||||||
fdialog "Requires PyGObject (python-gobject)"
|
quit_with_help_dialog "Requires PyGObject (python-gobject)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
logger INFO "Found PyGObject in Python env"
|
logger INFO "Found PyGObject in Python env"
|
||||||
@@ -214,17 +221,14 @@ default_steam_path="$default_steam_path"
|
|||||||
|
|
||||||
#Preferred Steam launch command (for Flatpak support)
|
#Preferred Steam launch command (for Flatpak support)
|
||||||
preferred_client="$preferred_client"
|
preferred_client="$preferred_client"
|
||||||
|
|
||||||
#DZGUI source path
|
|
||||||
src_path="$src_path"
|
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
depcheck(){
|
depcheck(){
|
||||||
for dep in "${!deps[@]}"; do
|
for dep in "${!deps[@]}"; do
|
||||||
command -v "$dep" 2>&1>/dev/null
|
if ! command -v "$dep" &> /dev/null; then
|
||||||
if [[ $? -eq 1 ]]; then
|
|
||||||
local msg="Requires $dep >= ${deps[$dep]}"
|
local msg="Requires $dep >= ${deps[$dep]}"
|
||||||
raise_error_and_quit "$msg"
|
echo "$msg"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
local jqmsg="jq must be compiled with support for oniguruma"
|
local jqmsg="jq must be compiled with support for oniguruma"
|
||||||
@@ -233,14 +237,31 @@ depcheck(){
|
|||||||
[[ $? -ne 0 ]] && raise_error_and_quit "$jqmsg"
|
[[ $? -ne 0 ]] && raise_error_and_quit "$jqmsg"
|
||||||
logger INFO "Initial dependencies satisfied"
|
logger INFO "Initial dependencies satisfied"
|
||||||
}
|
}
|
||||||
|
open_url(){
|
||||||
|
url="$1"
|
||||||
|
if [[ -n "$BROWSER" ]]; then
|
||||||
|
logger INFO "Opening '$url' in '$BROWSER'"
|
||||||
|
"$BROWSER" "$url"
|
||||||
|
else
|
||||||
|
logger INFO "Opening '$url' with xdg-open"
|
||||||
|
xdg-open "$url"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
quit_with_help_dialog(){
|
||||||
|
local sel
|
||||||
|
msg="$1"
|
||||||
|
help_button="Open help page"
|
||||||
|
url="https://aclist.github.io/dzgui/installation.html"
|
||||||
|
logger CRITICAL "$msg"
|
||||||
|
sel=$(zenity --info --extra-button="$help_button" --text="$msg")
|
||||||
|
[[ $sel == "$help_button" ]] && open_url "$url" &
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
check_pyver(){
|
check_pyver(){
|
||||||
local pyver=$(python3 --version | awk '{print $2}')
|
if [[ ! $(python3.13 --version) ]]; then
|
||||||
local minor=$(<<< $pyver awk -F. '{print $2}')
|
local msg="Requires Python 3.13"
|
||||||
if [[ -z $pyver ]] || [[ ${pyver:0:1} -lt 3 ]] || [[ $minor -lt 10 ]]; then
|
quit_with_help_dialog "$msg"
|
||||||
local msg="Requires Python >=3.10"
|
|
||||||
raise_error_and_quit "$msg"
|
|
||||||
fi
|
fi
|
||||||
logger INFO "Found Python version: $pyver"
|
|
||||||
}
|
}
|
||||||
watcher_deps(){
|
watcher_deps(){
|
||||||
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
||||||
@@ -314,6 +335,8 @@ check_unmerged(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_version(){
|
check_version(){
|
||||||
|
echo "# Checking version"
|
||||||
|
[[ -n $reference_branch ]] && return
|
||||||
local version_url=$(format_version_url)
|
local version_url=$(format_version_url)
|
||||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||||
local res=$(get_response_code "$version_url")
|
local res=$(get_response_code "$version_url")
|
||||||
@@ -363,7 +386,7 @@ prompt_dl(){
|
|||||||
Your branch: $branch
|
Your branch: $branch
|
||||||
Your version: $version
|
Your version: $version
|
||||||
Upstream version: $upstream
|
Upstream version: $upstream
|
||||||
|
|
||||||
Version updates introduce important bug fixes and are encouraged. Attempt to download the latest version?
|
Version updates introduce important bug fixes and are encouraged. Attempt to download the latest version?
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -377,10 +400,11 @@ prompt_dl(){
|
|||||||
dl_changelog(){
|
dl_changelog(){
|
||||||
local mdbranch
|
local mdbranch
|
||||||
local md
|
local md
|
||||||
|
source "$config_file"
|
||||||
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
||||||
[[ $branch == "testing" ]] && mdbranch="testing"
|
[[ $branch == "testing" ]] && mdbranch="testing"
|
||||||
local md="$url_prefix/${mdbranch}/$file"
|
local changelog="$url_prefix/${mdbranch}/CHANGELOG.md"
|
||||||
curl -Ls "$md" > "$state_path/CHANGELOG.md"
|
curl -Ls "$changelog" > "$state_path/CHANGELOG.md"
|
||||||
}
|
}
|
||||||
test_display_mode(){
|
test_display_mode(){
|
||||||
pgrep -a gamescope | grep -q "generate-drm-mode"
|
pgrep -a gamescope | grep -q "generate-drm-mode"
|
||||||
@@ -391,6 +415,7 @@ test_display_mode(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_architecture(){
|
check_architecture(){
|
||||||
|
echo "# Checking system architecture"
|
||||||
local cpu=$(< /proc/cpuinfo awk -F": " '/AMD Custom APU [0-9]{4}$/ {print $2; exit}')
|
local cpu=$(< /proc/cpuinfo awk -F": " '/AMD Custom APU [0-9]{4}$/ {print $2; exit}')
|
||||||
read -a APU_MODEL <<< "$cpu"
|
read -a APU_MODEL <<< "$cpu"
|
||||||
if [[ ${APU_MODEL[3]} != "0932" ]] && [[ ${APU_MODEL[3]} != "0405" ]]; then
|
if [[ ${APU_MODEL[3]} != "0932" ]] && [[ ${APU_MODEL[3]} != "0405" ]]; then
|
||||||
@@ -407,6 +432,7 @@ check_architecture(){
|
|||||||
logger INFO "Setting architecture to 'Steam Deck'"
|
logger INFO "Setting architecture to 'Steam Deck'"
|
||||||
}
|
}
|
||||||
check_map_count(){
|
check_map_count(){
|
||||||
|
echo "# Checking map count"
|
||||||
[[ $is_steam_deck -gt 0 ]] && return 0
|
[[ $is_steam_deck -gt 0 ]] && return 0
|
||||||
local map_count_file="/proc/sys/vm/max_map_count"
|
local map_count_file="/proc/sys/vm/max_map_count"
|
||||||
local min_count=1048576
|
local min_count=1048576
|
||||||
@@ -456,6 +482,7 @@ tdialog(){
|
|||||||
$steamsafe_zenity --info --text="$1" "${zenity_flags[@]}"
|
$steamsafe_zenity --info --text="$1" "${zenity_flags[@]}"
|
||||||
}
|
}
|
||||||
steam_deps(){
|
steam_deps(){
|
||||||
|
echo "# Checking Steam"
|
||||||
local flatpak
|
local flatpak
|
||||||
local steam
|
local steam
|
||||||
[[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam)
|
[[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam)
|
||||||
@@ -464,56 +491,70 @@ steam_deps(){
|
|||||||
local msg="Found neither Steam nor Flatpak Steam"
|
local msg="Found neither Steam nor Flatpak Steam"
|
||||||
raise_error_and_quit "$msg"
|
raise_error_and_quit "$msg"
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
|
|
||||||
[[ -n $preferred_client ]] && return 0
|
|
||||||
if [[ -z $preferred_client ]]; then
|
|
||||||
preferred_client="steam"
|
|
||||||
fi
|
|
||||||
elif [[ -n "$steam" ]]; then
|
|
||||||
preferred_client="steam"
|
|
||||||
else
|
|
||||||
preferred_client="flatpak"
|
|
||||||
fi
|
fi
|
||||||
update_config
|
|
||||||
logger INFO "Preferred client set to '$preferred_client'"
|
|
||||||
}
|
|
||||||
migrate_files(){
|
|
||||||
if [[ ! -f $config_path/dztuirc.oldapi ]]; then
|
|
||||||
cp $config_file $config_path/dztuirc.oldapi
|
|
||||||
logger INFO "Migrated old API file"
|
|
||||||
fi
|
|
||||||
[[ ! -f $hist_file ]] && return
|
|
||||||
rm $hist_file
|
|
||||||
logger INFO "Wiped old history file"
|
|
||||||
}
|
}
|
||||||
stale_symlinks(){
|
stale_symlinks(){
|
||||||
|
echo "# Cleaning stale symlinks"
|
||||||
local game_dir="$steam_path/steamapps/common/DayZ"
|
local game_dir="$steam_path/steamapps/common/DayZ"
|
||||||
for l in $(find "$game_dir" -xtype l); do
|
readarray -t links < <(find "$game_dir" -xtype l)
|
||||||
logger DEBUG "Updating stale symlink '$l'"
|
for link in "${links[@]}"; do
|
||||||
unlink "$l"
|
logger DEBUG "Updating stale symlink '$link'"
|
||||||
|
unlink "$link"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_availability() {
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local url=$1
|
||||||
|
local timeout_sec="1"
|
||||||
|
if [[ $2 ]]; then
|
||||||
|
timeout_sec=$2
|
||||||
|
fi
|
||||||
|
if ! ping -w "$timeout_sec" "$url" > /dev/null 2>&1; then
|
||||||
|
logger WARN "Failed to reach $url, service may be down."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
local_latlon(){
|
local_latlon(){
|
||||||
|
echo "# Checking coordinates"
|
||||||
if [[ -z $(command -v dig) ]]; then
|
if [[ -z $(command -v dig) ]]; then
|
||||||
local local_ip=$(curl -Ls "https://ipecho.net/plain")
|
local url_ipecho="https://ipecho.net/plain"
|
||||||
|
if ! check_availability "ipecho.net"; then
|
||||||
|
logger WARN "Failed to get external ip address, ipecho.net service may be down."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local local_ip=$(curl -Ls "$url_ipecho")
|
||||||
else
|
else
|
||||||
|
# TODO : implement checking remote
|
||||||
local local_ip=$(dig -4 +short myip.opendns.com @resolver1.opendns.com)
|
local local_ip=$(dig -4 +short myip.opendns.com @resolver1.opendns.com)
|
||||||
fi
|
fi
|
||||||
local url="http://ip-api.com/json/$local_ip"
|
if calc_local_coords "$local_ip"; then
|
||||||
local res=$(curl -Ls "$url" | jq -r '"\(.lat)\n\(.lon)"')
|
return 0
|
||||||
|
fi
|
||||||
|
local url_ip_api="http://ip-api.com/json/$local_ip"
|
||||||
|
if ! check_availability "ip-api.com"; then
|
||||||
|
logger WARN "Failed to get local coordinates, ip-api.com service may be down."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local res=$(curl -Ls "$url_ip_api" | jq -r '"\(.lat)\n\(.lon)"')
|
||||||
if [[ -z "$res" ]]; then
|
if [[ -z "$res" ]]; then
|
||||||
logger WARN "Failed to get local coordinates"
|
logger WARN "Failed to get local coordinates"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "$res" > "$coords_file"
|
echo "$res" > "$coords_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
lock(){
|
lock(){
|
||||||
|
echo "# Setting up lock file"
|
||||||
[[ ! -f $lock_file ]] && touch $lock_file
|
[[ ! -f $lock_file ]] && touch $lock_file
|
||||||
local pid=$(cat $lock_file)
|
local pid=$(cat $lock_file)
|
||||||
ps -p $pid -o pid= >/dev/null 2>&1
|
ps -p $pid -o pid= >/dev/null 2>&1
|
||||||
res=$?
|
res=$?
|
||||||
if [[ $res -eq 0 ]]; then
|
if [[ $res -eq 0 ]]; then
|
||||||
local msg="DZGUI already running ($pid)"
|
local msg="DZGUI is already running ($pid)"
|
||||||
raise_error_and_quit "$msg"
|
raise_error_and_quit "$msg"
|
||||||
elif [[ $pid == $$ ]]; then
|
elif [[ $pid == $$ ]]; then
|
||||||
:
|
:
|
||||||
@@ -526,9 +567,12 @@ get_hash(){
|
|||||||
md5sum "$1" | awk '{print $1}'
|
md5sum "$1" | awk '{print $1}'
|
||||||
}
|
}
|
||||||
fetch_a2s(){
|
fetch_a2s(){
|
||||||
# this file is currently monolithic
|
sum="d26da2fe03df2b95436f823f0496887b"
|
||||||
[[ -d $helpers_path/a2s ]] && { logger INFO "A2S helper is current"; return 0; }
|
if [[ -d $helpers_path/a2s ]] && [[ $(get_hash "$helpers_path/a2s/info.py") == $sum ]]; then
|
||||||
local sha=c7590ffa9a6d0c6912e17ceeab15b832a1090640
|
logger INFO "A2S helper is current"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local sha=b40eb24cdbb06ebd08272f224257fe5a81610e86
|
||||||
local author="yepoleb"
|
local author="yepoleb"
|
||||||
local repo="python-a2s"
|
local repo="python-a2s"
|
||||||
local url="https://github.com/$author/$repo/tarball/$sha"
|
local url="https://github.com/$author/$repo/tarball/$sha"
|
||||||
@@ -542,13 +586,13 @@ fetch_a2s(){
|
|||||||
logger INFO "Updated A2S helper to sha '$sha'"
|
logger INFO "Updated A2S helper to sha '$sha'"
|
||||||
}
|
}
|
||||||
fetch_dzq(){
|
fetch_dzq(){
|
||||||
local sum="9caed1445c45832f4af87736ba3f9637"
|
local sum="0d316badbb8d943c5f078e73862cac3e"
|
||||||
local file="$helpers_path/a2s/dayzquery.py"
|
local file="$helpers_path/a2s/dayzquery.py"
|
||||||
if [[ -f $file ]] && [[ $(get_hash "$file") == $sum ]]; then
|
if [[ -f $file ]] && [[ $(get_hash "$file") == $sum ]]; then
|
||||||
logger INFO "DZQ is current"
|
logger INFO "DZQ is current"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local sha=3088bbfb147b77bc7b6a9425581b439889ff3f7f
|
local sha="07483b88ed096327ebca752f5e177011b604d7fe"
|
||||||
local author="yepoleb"
|
local author="yepoleb"
|
||||||
local repo="dayzquery"
|
local repo="dayzquery"
|
||||||
local url="https://raw.githubusercontent.com/$author/$repo/$sha/dayzquery.py"
|
local url="https://raw.githubusercontent.com/$author/$repo/$sha/dayzquery.py"
|
||||||
@@ -585,11 +629,12 @@ fetch_helpers_by_sum(){
|
|||||||
[[ -f "$config_file" ]] && source "$config_file"
|
[[ -f "$config_file" ]] && source "$config_file"
|
||||||
declare -A sums
|
declare -A sums
|
||||||
sums=(
|
sums=(
|
||||||
["ui.py"]="f128a97e744e9e11036d707198feb8a8"
|
["funcs"]="1cd26343cd68a5382e3377a9757497fa"
|
||||||
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
||||||
|
["servers.py"]="ed442c3aecf33f777d59dcf53650d263"
|
||||||
|
["ui.py"]="cf52a3d5883afe02a013d8673df494fa"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["funcs"]="94287c75a5ae0a06a95dd439711e6fba"
|
["pefile.py"]="b452974a84bff1d821872fcebf59e380"
|
||||||
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
|
||||||
)
|
)
|
||||||
local author="aclist"
|
local author="aclist"
|
||||||
local repo="dztui"
|
local repo="dztui"
|
||||||
@@ -608,6 +653,10 @@ fetch_helpers_by_sum(){
|
|||||||
realbranch="dzgui"
|
realbranch="dzgui"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n $reference_branch ]]; then
|
||||||
|
realbranch="$reference_branch"
|
||||||
|
fi
|
||||||
|
|
||||||
for i in "${!sums[@]}"; do
|
for i in "${!sums[@]}"; do
|
||||||
file="$i"
|
file="$i"
|
||||||
sum="${sums[$i]}"
|
sum="${sums[$i]}"
|
||||||
@@ -631,7 +680,6 @@ fetch_helpers_by_sum(){
|
|||||||
logger INFO "Updated '$full_path' to sum '$sum'"
|
logger INFO "Updated '$full_path' to sum '$sum'"
|
||||||
fi
|
fi
|
||||||
[[ $file == "funcs" ]] && chmod +x "$full_path"
|
[[ $file == "funcs" ]] && chmod +x "$full_path"
|
||||||
[[ $file == "lan" ]] && chmod +x "$full_path"
|
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -646,15 +694,12 @@ fetch_km_helper(){
|
|||||||
}
|
}
|
||||||
get_response_code(){
|
get_response_code(){
|
||||||
local url="$1"
|
local url="$1"
|
||||||
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
curl --connect-timeout 3 -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
||||||
}
|
|
||||||
raise_error_and_quit(){
|
|
||||||
echo "$1"
|
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_ip_db(){
|
fetch_ip_db(){
|
||||||
parse_dl_url(){
|
parse_dl_url(){
|
||||||
curl -Ls "$url" \
|
curl --connect-timeout 3 -Ls "$url" \
|
||||||
| grep "csv.gz" \
|
| grep "csv.gz" \
|
||||||
| awk -F"['']" '{print $2}'
|
| awk -F"['']" '{print $2}'
|
||||||
}
|
}
|
||||||
@@ -670,6 +715,9 @@ fetch_ip_db(){
|
|||||||
fetch(){
|
fetch(){
|
||||||
logger INFO "Triggering fetch routine"
|
logger INFO "Triggering fetch routine"
|
||||||
local url="$1"
|
local url="$1"
|
||||||
|
local ip_file="${state_path}/ips.csv"
|
||||||
|
local base_file="${state_path}/${this_month}.csv.gz"
|
||||||
|
local extracted_file="${state_path}/${this_month}.csv"
|
||||||
|
|
||||||
curl -Ls "$url" > "$base_file"
|
curl -Ls "$url" > "$base_file"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
@@ -689,7 +737,7 @@ fetch_ip_db(){
|
|||||||
logger WARN "Abnormal exit while parsing IPs"
|
logger WARN "Abnormal exit while parsing IPs"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
rm "${state_path}/${month}.csv"
|
rm "${state_path}/${this_month}.csv"
|
||||||
|
|
||||||
readarray -t records < <(cat $ip_file | awk -F, 'NR==1 {print $1} END {print $1}')
|
readarray -t records < <(cat $ip_file | awk -F, 'NR==1 {print $1} END {print $1}')
|
||||||
if [[ ${records[0]} != "0.0.0.0" ]] && [[ ${records[1]} != "224.0.0.0" ]]; then
|
if [[ ${records[0]} != "0.0.0.0" ]] && [[ ${records[1]} != "224.0.0.0" ]]; then
|
||||||
@@ -704,55 +752,57 @@ fetch_ip_db(){
|
|||||||
rm "$ip_file"
|
rm "$ip_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$month" > "$month_file"
|
echo "$this_month" > "$month_file"
|
||||||
logger INFO "Wrote '$month' to stub '$month_file'"
|
logger INFO "Wrote '$this_month' to stub '$month_file'"
|
||||||
logger INFO "Updated '$ip_file'"
|
logger INFO "Updated '$ip_file'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_remote(){
|
||||||
|
local url="$1"
|
||||||
|
local res=$(get_response_code "$url")
|
||||||
|
if [[ $res -ne 200 ]]; then
|
||||||
|
logger WARN "Failed to retrieve remote resource: '$url' ($res)"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
logger INFO "Resolved remote URL: '$url'"
|
||||||
|
|
||||||
|
# test dl url
|
||||||
|
local dl_url="$(parse_dl_url)"
|
||||||
|
local res=$(get_response_code "$dl_url")
|
||||||
|
if [[ $res -ne 200 ]]; then
|
||||||
|
logger WARN "Remote resource unavailable: '$dl_url' ($res)"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
logger INFO "Resolved download URL: '$dl_url'"
|
||||||
|
fetch "$dl_url"
|
||||||
|
}
|
||||||
|
|
||||||
local url="https://db-ip.com/db/download/ip-to-city-lite"
|
local url="https://db-ip.com/db/download/ip-to-city-lite"
|
||||||
local month_file="${state_path}/.month"
|
month_file="${state_path}/.month"
|
||||||
local ip_file="${state_path}/ips.csv"
|
this_month=$(date +%Y-%m)
|
||||||
|
|
||||||
# test main url
|
|
||||||
local res=$(get_response_code "$url")
|
|
||||||
if [[ $res -ne 200 ]]; then
|
|
||||||
logger WARN "Failed to retrieve remote resource: '$url' ($res)"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
logger INFO "Resolved remote URL: '$url'"
|
|
||||||
|
|
||||||
# test dl url
|
|
||||||
local dl_url="$(parse_dl_url)"
|
|
||||||
local res=$(get_response_code "$dl_url")
|
|
||||||
if [[ $res -ne 200 ]]; then
|
|
||||||
logger WARN "Remote resource unavailable: '$dl_url' ($res)"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
logger INFO "Resolved download URL: '$dl_url'"
|
|
||||||
|
|
||||||
local month=$(parse_dl_url_date "$dl_url")
|
|
||||||
local base_file="${state_path}/${month}.csv.gz"
|
|
||||||
local extracted_file="${state_path}/${month}.csv"
|
|
||||||
|
|
||||||
# no stub file
|
# no stub file
|
||||||
if [[ ! -f $month_file ]]; then
|
if [[ ! -f $month_file ]]; then
|
||||||
logger WARN "No stub file '$month_file' present"
|
logger WARN "No stub file '$month_file' present"
|
||||||
fetch "$dl_url"
|
check_remote "$url"
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# local needs update
|
|
||||||
local last_month=$(< "$month_file")
|
|
||||||
if [[ $last_month != "$month" ]]; then
|
|
||||||
logger WARN "Local stub '$last_month' does not match remote stub '$month'"
|
|
||||||
fetch "$dl_url"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if stub is same date, abort
|
# if stub is same date, abort
|
||||||
logger INFO "Local stub '$last_month' is identical to remote, skipping"
|
local last_month=$(< "$month_file")
|
||||||
|
if [[ $last_month == "$this_month" ]]; then
|
||||||
|
logger INFO "Local stub '$last_month' is identical to remote, skipping"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# local needs update
|
||||||
|
logger WARN "Local stub '$last_month' does not match '$this_month'"
|
||||||
|
check_remote "$url"
|
||||||
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
fetch_helpers(){
|
fetch_helpers(){
|
||||||
|
echo "# Checking helper files"
|
||||||
fetch_a2s
|
fetch_a2s
|
||||||
fetch_dzq
|
fetch_dzq
|
||||||
fetch_km_helper
|
fetch_km_helper
|
||||||
@@ -851,12 +901,26 @@ file_picker(){
|
|||||||
}
|
}
|
||||||
find_library_folder(){
|
find_library_folder(){
|
||||||
local search_path="$1"
|
local search_path="$1"
|
||||||
steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" \
|
readarray -t paths < <(python3.13 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" \
|
||||||
| jq -r '.libraryfolders[]|select(.apps|has("221100")).path')"
|
| jq -r '.libraryfolders[]|select(.apps|has("221100")).path')
|
||||||
if [[ ! $? -eq 0 ]] || [[ -z $steam_path ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
logger WARN "Failed to parse Steam path using '$search_path'"
|
logger WARN "Failed to parse Steam path using '$search_path'"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
if [[ ${#paths[@]} -eq 0 ]]; then
|
||||||
|
logger WARN "No valid VDF paths in '$search_path'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [[ ${#paths[@]} -gt 1 ]]; then
|
||||||
|
for path in "${paths[@]}"; do
|
||||||
|
if [[ -d "$path" ]]; then
|
||||||
|
steam_path="$path"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
steam_path="${paths[0]}"
|
||||||
|
fi
|
||||||
logger INFO "Steam path resolved to: $steam_path"
|
logger INFO "Steam path resolved to: $steam_path"
|
||||||
}
|
}
|
||||||
create_config(){
|
create_config(){
|
||||||
@@ -865,6 +929,7 @@ create_config(){
|
|||||||
unset default_steam_path
|
unset default_steam_path
|
||||||
unset steam_path
|
unset steam_path
|
||||||
|
|
||||||
|
preferred_client="steam"
|
||||||
while true; do
|
while true; do
|
||||||
local player_input="$($steamsafe_zenity \
|
local player_input="$($steamsafe_zenity \
|
||||||
--forms \
|
--forms \
|
||||||
@@ -925,8 +990,9 @@ create_config(){
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
varcheck(){
|
varcheck(){
|
||||||
|
echo "# Checking config file"
|
||||||
local msg="Config file '$config_file' missing. Start first-time setup now?"
|
local msg="Config file '$config_file' missing. Start first-time setup now?"
|
||||||
local msg2="The Steam paths set in your config file appear to be invalid. Restart first-time setup now?"
|
local msg2="The Steam paths set in your config file appear to be invalid (DayZ was moved or uninstalled). Restart first-time setup now?"
|
||||||
if [[ ! -f $config_file ]]; then
|
if [[ ! -f $config_file ]]; then
|
||||||
qdialog "$msg" "Yes" "Exit"
|
qdialog "$msg" "Yes" "Exit"
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
@@ -938,7 +1004,7 @@ varcheck(){
|
|||||||
source "$config_file"
|
source "$config_file"
|
||||||
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
||||||
local game_dir="$steam_path/steamapps/common/DayZ"
|
local game_dir="$steam_path/steamapps/common/DayZ"
|
||||||
if [[ ! -d $steam_path ]] || [[ ! -d $game_dir ]] || [[ ! $(find $game_dir -type f) ]]; then
|
if [[ ! -d $steam_path ]] || [[ ! -d $game_dir ]] || [[ ! $(find "$game_dir" -type f) ]]; then
|
||||||
logger WARN "DayZ path resolved to '$game_dir'"
|
logger WARN "DayZ path resolved to '$game_dir'"
|
||||||
logger WARN "Workshop path resolved to '$workshop_dir'"
|
logger WARN "Workshop path resolved to '$workshop_dir'"
|
||||||
qdialog "$msg2" "Yes" "Exit"
|
qdialog "$msg2" "Yes" "Exit"
|
||||||
@@ -949,18 +1015,16 @@ varcheck(){
|
|||||||
create_config
|
create_config
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [[ $src_path != $(realpath "$0") ]]; then
|
|
||||||
src_path=$(realpath "$0")
|
|
||||||
update_config
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
is_dzg_downloading(){
|
is_dzg_downloading(){
|
||||||
|
echo "# Checking DayZ"
|
||||||
if [[ -d $steam_path ]] && [[ -d $steam_path/downloading/$aid ]]; then
|
if [[ -d $steam_path ]] && [[ -d $steam_path/downloading/$aid ]]; then
|
||||||
logger WARN "DayZ may be scheduling updates"
|
logger WARN "DayZ may be scheduling updates"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
is_steam_running(){
|
is_steam_running(){
|
||||||
|
echo "# Checking Steam"
|
||||||
local res=$(ps aux | grep "steamwebhelper" | grep -v grep)
|
local res=$(ps aux | grep "steamwebhelper" | grep -v grep)
|
||||||
if [[ -z $res ]]; then
|
if [[ -z $res ]]; then
|
||||||
logger WARN "Steam may not be running"
|
logger WARN "Steam may not be running"
|
||||||
@@ -973,6 +1037,7 @@ get_response_code(){
|
|||||||
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
||||||
}
|
}
|
||||||
test_connection(){
|
test_connection(){
|
||||||
|
echo "# Testing connection"
|
||||||
declare -A hr
|
declare -A hr
|
||||||
local res1
|
local res1
|
||||||
local res2
|
local res2
|
||||||
@@ -1006,6 +1071,8 @@ legacy_cols(){
|
|||||||
mv $cols_file.new $cols_file
|
mv $cols_file.new $cols_file
|
||||||
}
|
}
|
||||||
stale_mod_signatures(){
|
stale_mod_signatures(){
|
||||||
|
echo "# Checking stale mods"
|
||||||
|
[[ ! -f "$versions_file" ]] && return
|
||||||
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
||||||
if [[ -d $workshop_dir ]]; then
|
if [[ -d $workshop_dir ]]; then
|
||||||
readarray -t old_mod_ids < <(awk -F, '{print $1}' $versions_file)
|
readarray -t old_mod_ids < <(awk -F, '{print $1}' $versions_file)
|
||||||
@@ -1018,18 +1085,48 @@ stale_mod_signatures(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
create_new_links(){
|
create_new_links(){
|
||||||
|
echo "# Setting up symlinks"
|
||||||
"$func_helper" "update_symlinks"
|
"$func_helper" "update_symlinks"
|
||||||
}
|
}
|
||||||
|
calc_local_coords(){
|
||||||
|
local ip="$1"
|
||||||
|
[[ ! -f "$geo_helper" ]] && return 1
|
||||||
|
|
||||||
|
IFS="." read -ra split <<< "$ip"
|
||||||
|
[[ ${#split[@]} -ne 4 ]] && return 1
|
||||||
|
|
||||||
|
prefix="^${split[0]}.${split[1]}."
|
||||||
|
readarray -t res < <(grep "$prefix" "$geo_helper")
|
||||||
|
|
||||||
|
for address in "${res[@]}"; do
|
||||||
|
IFS="," read -ra fields <<< "$address"
|
||||||
|
upper="${fields[1]}"
|
||||||
|
IFS="." read -ra upper_digits <<< "$upper"
|
||||||
|
if [[ ${split[2]} -gt ${upper_digits[2]} ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ ${split[2]} -eq ${upper_digits[2]} ]]; then
|
||||||
|
if [[ ${split[3]} -gt ${upper_digits[3]} ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ ${split[3]} -eq ${upper_digits[3]} ]]; then
|
||||||
|
echo "${fields[-2]}" >> "$coords_file"
|
||||||
|
echo "${fields[-1]}" >> "$coords_file"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ ${split[2]} -lt ${upper_digits[2]} ]]; then
|
||||||
|
echo "${fields[-2]}" >> "$coords_file"
|
||||||
|
echo "${fields[-1]}" >> "$coords_file"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
initial_setup(){
|
initial_setup(){
|
||||||
setup_dirs
|
|
||||||
setup_state_files
|
|
||||||
depcheck
|
|
||||||
check_pyver
|
|
||||||
test_gobject
|
|
||||||
watcher_deps
|
|
||||||
check_architecture
|
check_architecture
|
||||||
test_connection
|
test_connection
|
||||||
fetch_helpers > >(pdialog "Checking helper files")
|
fetch_helpers
|
||||||
varcheck
|
varcheck
|
||||||
source "$config_file"
|
source "$config_file"
|
||||||
lock
|
lock
|
||||||
@@ -1038,14 +1135,12 @@ initial_setup(){
|
|||||||
check_version
|
check_version
|
||||||
check_map_count
|
check_map_count
|
||||||
steam_deps
|
steam_deps
|
||||||
migrate_files
|
|
||||||
stale_symlinks
|
stale_symlinks
|
||||||
stale_mod_signatures
|
stale_mod_signatures
|
||||||
create_new_links
|
create_new_links
|
||||||
local_latlon
|
local_latlon
|
||||||
is_steam_running
|
is_steam_running
|
||||||
is_dzg_downloading
|
is_dzg_downloading
|
||||||
print_config_vals
|
|
||||||
}
|
}
|
||||||
uninstall(){
|
uninstall(){
|
||||||
_full(){
|
_full(){
|
||||||
@@ -1089,22 +1184,82 @@ uninstall(){
|
|||||||
rm "$self"
|
rm "$self"
|
||||||
echo "Uninstall routine complete"
|
echo "Uninstall routine complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usage(){
|
||||||
|
cat <<- EOM
|
||||||
|
DZGUI - Free and Open Source DayZ launcher
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
dzgui.sh [options]
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
When no option is provided, the script launches DZGUI.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-u, --uninstall:
|
||||||
|
Uninstalls the software
|
||||||
|
|
||||||
|
-v, --version:
|
||||||
|
Prints the version
|
||||||
|
|
||||||
|
-h, --help:
|
||||||
|
Prints this message
|
||||||
|
EOM
|
||||||
|
}
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
local zenv=$(zenity --version 2>/dev/null)
|
# setup zenity environment
|
||||||
|
local zenv=""
|
||||||
|
zenv=$(zenity --version 2>/dev/null)
|
||||||
[[ -z $zenv ]] && { echo "Requires zenity >= ${deps[$steamsafe_zenity]}"; exit 1; }
|
[[ -z $zenv ]] && { echo "Requires zenity >= ${deps[$steamsafe_zenity]}"; exit 1; }
|
||||||
if [[ $1 == "--uninstall" ]] || [[ $1 == "-u" ]]; then
|
|
||||||
uninstall &&
|
# parse arguments
|
||||||
exit 0
|
while [[ $# -gt 0 ]]; do
|
||||||
fi
|
case $1 in
|
||||||
|
"--uninstall" | "-u")
|
||||||
|
uninstall
|
||||||
|
exit 0
|
||||||
|
# shift
|
||||||
|
;;
|
||||||
|
"--version" | "-v")
|
||||||
|
echo $version
|
||||||
|
exit 0
|
||||||
|
# shift
|
||||||
|
;;
|
||||||
|
"--help" | "-h")
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
# shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unrecognized command!"
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
set_im_module
|
set_im_module
|
||||||
|
|
||||||
printf "Initializing setup...\n"
|
printf "Checking dependencies...\n"
|
||||||
initial_setup
|
setup_dirs
|
||||||
|
setup_state_files
|
||||||
|
depcheck
|
||||||
|
check_pyver
|
||||||
|
test_gobject
|
||||||
|
watcher_deps
|
||||||
|
|
||||||
|
initial_setup > >(pdialog "Initializing setup")
|
||||||
|
|
||||||
printf "All OK. Kicking off UI...\n"
|
printf "All OK. Kicking off UI...\n"
|
||||||
python3 "$ui_helper" "--init-ui" "$version" "$is_steam_deck"
|
python3.13 "$ui_helper" "--init-ui" "$version" "$is_steam_deck"
|
||||||
|
|
||||||
}
|
}
|
||||||
main "$@"
|
|
||||||
#TODO: tech debt: cruddy handling for steam forking
|
if [[ $(basename "$0") == "dzgui.sh" ]]; then
|
||||||
[[ $? -eq 1 ]] && pkill -f dzgui.sh
|
main "$@"
|
||||||
|
|
||||||
|
#TODO: tech debt: cruddy handling for steam forking
|
||||||
|
[[ $? -eq 1 ]] && pkill -f dzgui.sh
|
||||||
|
fi
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#define R 6371
|
|
||||||
#define TO_RAD (3.1415926536 / 180)
|
|
||||||
double dist(double th1, double ph1, double th2, double ph2)
|
|
||||||
{
|
|
||||||
double dx, dy, dz;
|
|
||||||
ph1 -= ph2;
|
|
||||||
ph1 *= TO_RAD, th1 *= TO_RAD, th2 *= TO_RAD;
|
|
||||||
|
|
||||||
dz = sin(th1) - sin(th2);
|
|
||||||
dx = cos(ph1) * cos(th1) - cos(th2);
|
|
||||||
dy = sin(ph1) * cos(th1);
|
|
||||||
return asin(sqrt(dx * dx + dy * dy + dz * dz) / 2) * 2 * R;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
|
||||||
{
|
|
||||||
if(argc < 5 || argc > 5){
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
float coords[4];
|
|
||||||
for(int i=1;i<5;i++){
|
|
||||||
if(atof(argv[i]) == 0){
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
coords[i] = atof(argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
double d = dist(coords[1], coords[2], coords[3], coords[4]);
|
|
||||||
printf("%.1f\n", d);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,492 @@
|
|||||||
|
import json
|
||||||
|
import struct
|
||||||
|
import typing # noqa
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from enum import Enum
|
||||||
|
from pathlib import Path
|
||||||
|
from shlex import shlex
|
||||||
|
from typing import BinaryIO, Union
|
||||||
|
|
||||||
|
# https://learn.microsoft.com/en-us/windows/win32/debug/pe-format
|
||||||
|
endian = "<"
|
||||||
|
IMAGE_DIRECTORY_ENTRY = 2
|
||||||
|
VERSION_RESOURCE = 16
|
||||||
|
RESOURCE_NODE = ".rsrc"
|
||||||
|
PE32_x86 = "0x10b"
|
||||||
|
PE32_x64 = "0x20b"
|
||||||
|
VS_VERSION_INFO_MAGIC = "0xfeef04bd0000"
|
||||||
|
VS_VERSION_INFO_ID = "VS_VERSION_INFO"
|
||||||
|
|
||||||
|
|
||||||
|
class VersionMatch(Enum):
|
||||||
|
LOCAL_OLDER = 1
|
||||||
|
LOCAL_NEWER = 2
|
||||||
|
SAME_VERSION = 3
|
||||||
|
|
||||||
|
|
||||||
|
class u8:
|
||||||
|
fmt = "B"
|
||||||
|
|
||||||
|
|
||||||
|
class u16:
|
||||||
|
fmt = "H"
|
||||||
|
|
||||||
|
|
||||||
|
class u32:
|
||||||
|
fmt = "L"
|
||||||
|
|
||||||
|
|
||||||
|
class u64:
|
||||||
|
fmt = "Q"
|
||||||
|
|
||||||
|
|
||||||
|
class i8:
|
||||||
|
fmt = "b"
|
||||||
|
|
||||||
|
|
||||||
|
class i16:
|
||||||
|
fmt = "h"
|
||||||
|
|
||||||
|
|
||||||
|
class i32:
|
||||||
|
fmt = "l"
|
||||||
|
|
||||||
|
|
||||||
|
class i64:
|
||||||
|
fmt = "q"
|
||||||
|
|
||||||
|
|
||||||
|
class PackedData:
|
||||||
|
@classmethod
|
||||||
|
def unpack(cls, data: BinaryIO):
|
||||||
|
r = []
|
||||||
|
for key, value in cls.__annotations__.items():
|
||||||
|
if value == str:
|
||||||
|
f = data.read(8).rstrip(b"\x00\x00").decode()
|
||||||
|
else:
|
||||||
|
fmt = endian + (value.fmt)
|
||||||
|
size = struct.calcsize(fmt)
|
||||||
|
f = struct.unpack(fmt, data.read(size))[0]
|
||||||
|
r.append(f)
|
||||||
|
return cls(*r)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class COFF_FILE_HDR(PackedData):
|
||||||
|
machine_type: u16
|
||||||
|
number_of_sections: u16
|
||||||
|
timestamp: u32
|
||||||
|
pointer_to_symbol_table: u32
|
||||||
|
number_of_symbols: u32
|
||||||
|
size_of_optional_header: u16
|
||||||
|
characteristics: u16
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class OPTIONAL_HDR_X86(PackedData):
|
||||||
|
magic: u16
|
||||||
|
major_linker_ver: u8
|
||||||
|
minor_linker_ver: u8
|
||||||
|
size_of_code: u32
|
||||||
|
size_of_initialized_data: u32
|
||||||
|
size_of_uninitialized_data: u32
|
||||||
|
address_of_entry_point: u32
|
||||||
|
base_of_code: u32
|
||||||
|
base_of_data: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class OPTIONAL_HDR_X64(PackedData):
|
||||||
|
magic: u16
|
||||||
|
major_linker_ver: u8
|
||||||
|
minor_linker_ver: u8
|
||||||
|
size_of_code: u32
|
||||||
|
size_of_initialized_data: u32
|
||||||
|
size_of_uninitialized_data: u32
|
||||||
|
address_of_entry_point: u32
|
||||||
|
base_of_code: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class OPTIONAL_HDR_WIN_X86(PackedData):
|
||||||
|
image_base: u32
|
||||||
|
section_alignment: u32
|
||||||
|
file_alignment: u32
|
||||||
|
major_operating_system_version: u16
|
||||||
|
minor_operating_system_version: u16
|
||||||
|
major_image_version: u16
|
||||||
|
minor_image_version: u16
|
||||||
|
major_subsystem_version: u16
|
||||||
|
minor_subsystem_version: u16
|
||||||
|
win32_version_value: u32
|
||||||
|
size_of_image: u32
|
||||||
|
size_of_headers: u32
|
||||||
|
checksum: u32
|
||||||
|
subsystem: u16
|
||||||
|
dll_characteristics: u16
|
||||||
|
size_of_stack_reserve: u32
|
||||||
|
size_of_stack_commit: u32
|
||||||
|
size_of_heap_reserve: u32
|
||||||
|
size_of_heap_commit: u32
|
||||||
|
loader_flags: u32
|
||||||
|
number_of_rva_and_sizes: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class OPTIONAL_HDR_WIN_X64(PackedData):
|
||||||
|
image_base: u64
|
||||||
|
section_alignment: u32
|
||||||
|
file_alignment: u32
|
||||||
|
major_operating_system_version: u16
|
||||||
|
minor_operating_system_version: u16
|
||||||
|
major_image_version: u16
|
||||||
|
minor_image_version: u16
|
||||||
|
major_subsystem_version: u16
|
||||||
|
minor_subsystem_version: u16
|
||||||
|
win32_version_value: u32
|
||||||
|
size_of_image: u32
|
||||||
|
size_of_headers: u32
|
||||||
|
checksum: u32
|
||||||
|
subsystem: u16
|
||||||
|
dll_characteristics: u16
|
||||||
|
size_of_stack_reserve: u64
|
||||||
|
size_of_stack_commit: u64
|
||||||
|
size_of_heap_reserve: u64
|
||||||
|
size_of_heap_commit: u64
|
||||||
|
loader_flags: u32
|
||||||
|
number_of_rva_and_sizes: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class DATA_DIR(PackedData):
|
||||||
|
virtual_address: u32
|
||||||
|
size: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class SECTION_HDR(PackedData):
|
||||||
|
name: str
|
||||||
|
virtual_size: u32
|
||||||
|
virtual_address: u32
|
||||||
|
size_of_raw_data: u32
|
||||||
|
pointer_to_raw_data: u32
|
||||||
|
pointer_to_relocations: u32
|
||||||
|
pointer_to_line_numbers: u32
|
||||||
|
number_of_relocations: u16
|
||||||
|
number_of_line_numbers: u16
|
||||||
|
characteristics: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class RESOURCE_DIRECTORY_TABLE(PackedData):
|
||||||
|
characteristics: u32
|
||||||
|
timestamp: u32
|
||||||
|
major_version: u16
|
||||||
|
minor_version: u16
|
||||||
|
number_of_name_entries: u16
|
||||||
|
number_of_id_entries: u16
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class RESOURCE_DIRECTORY_ENTRY(PackedData):
|
||||||
|
"""
|
||||||
|
This field is either a string identifying a data leaf
|
||||||
|
(if the high bit is set) or an ID to another nested directory
|
||||||
|
(if the high bit is clear). The outermost level is always a
|
||||||
|
directory. If it is a name, the lower 31 bits are the offset from the
|
||||||
|
beginning of the resource section's raw data to the name
|
||||||
|
(the name consists of 16 bits length and trailing wide characters,
|
||||||
|
in Unicode, not 0-terminated).
|
||||||
|
"""
|
||||||
|
|
||||||
|
name_or_id: u32
|
||||||
|
data_or_subdir: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class RESOURCE_DATA_ENTRY(PackedData):
|
||||||
|
data_rva: u32
|
||||||
|
size: u32
|
||||||
|
codepage: u32
|
||||||
|
reserved: u32
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class VS_VERSION_INFO_HDR(PackedData):
|
||||||
|
size: u16
|
||||||
|
value_length: u16
|
||||||
|
value_type: u16
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class DayZVersion:
|
||||||
|
major: int
|
||||||
|
minor: int
|
||||||
|
patch: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class FileVersion:
|
||||||
|
major: int
|
||||||
|
minor: int
|
||||||
|
build: int
|
||||||
|
revision: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class Result:
|
||||||
|
local: Union[str, None]
|
||||||
|
remote: str
|
||||||
|
build: str
|
||||||
|
path: Union[Path, None]
|
||||||
|
match: VersionMatch
|
||||||
|
error: Union[Exception, None]
|
||||||
|
|
||||||
|
|
||||||
|
class PeFileError(Exception):
|
||||||
|
"""Expected contents missing from headers or resource nodes"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AppNotInstalledError(Exception):
|
||||||
|
"""App not present in user's libraryfolders"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AppMovedError(Exception):
|
||||||
|
"""VDF points to a nonexistent location on disk"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class VDFLoadError(Exception):
|
||||||
|
"""Malformed VDF or JSON conversion"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def parse_version_number(data: BinaryIO):
|
||||||
|
# https://learn.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo
|
||||||
|
minor = struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF
|
||||||
|
major = struct.unpack("<L", data.read(4))[0] >> 0 & 0xFFFF
|
||||||
|
build = struct.unpack("<L", data.read(4))[0] >> 0 & 0xFFFF
|
||||||
|
revision = struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF
|
||||||
|
return FileVersion(major, minor, build, revision)
|
||||||
|
|
||||||
|
|
||||||
|
def seek_to_hex(address: str, data: BinaryIO) -> None:
|
||||||
|
data.seek(int(address, base=16))
|
||||||
|
|
||||||
|
|
||||||
|
def seek_to_pe_stub(data: BinaryIO) -> None:
|
||||||
|
MAGIC = "0x3c"
|
||||||
|
seek_to_hex(MAGIC, data)
|
||||||
|
e_lfanew = hex(struct.unpack("<h", data.read(2))[0])
|
||||||
|
seek_to_hex(e_lfanew, data)
|
||||||
|
pe_stub = data.read(4).rstrip(b"\x00\x00\x00\x00").decode()
|
||||||
|
if pe_stub != "PE":
|
||||||
|
raise PeFileError("missing PE header data")
|
||||||
|
|
||||||
|
|
||||||
|
def get_dayz_version(file: Path) -> DayZVersion | Exception:
|
||||||
|
try:
|
||||||
|
version = get_version(file)
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
|
patch = str(version.build) + str(version.revision)
|
||||||
|
dz_vers = DayZVersion(version.major, version.minor, int(patch))
|
||||||
|
return dz_vers
|
||||||
|
|
||||||
|
|
||||||
|
def dayz_version_to_str(v: DayZVersion) -> str:
|
||||||
|
return ".".join(str(el) for el in [v.major, v.minor, v.patch])
|
||||||
|
|
||||||
|
|
||||||
|
def dayz_version_from_str(v: str) -> DayZVersion:
|
||||||
|
vers = v.split(".")
|
||||||
|
assert len(vers) == 3
|
||||||
|
return DayZVersion(*[int(el) for el in vers])
|
||||||
|
|
||||||
|
|
||||||
|
def get_version(file):
|
||||||
|
with open(file, "rb") as f:
|
||||||
|
seek_to_pe_stub(f)
|
||||||
|
COFF = COFF_FILE_HDR.unpack(f)
|
||||||
|
|
||||||
|
pos = f.tell()
|
||||||
|
blob = f.read()
|
||||||
|
magic = hex(struct.unpack("<H", (blob[0:2]))[0])
|
||||||
|
f.seek(pos)
|
||||||
|
|
||||||
|
if magic == PE32_x86:
|
||||||
|
OPTIONAL_HDR_X86.unpack(f)
|
||||||
|
OBJW = OPTIONAL_HDR_WIN_X86.unpack(f)
|
||||||
|
else:
|
||||||
|
OPTIONAL_HDR_X64.unpack(f)
|
||||||
|
OBJW = OPTIONAL_HDR_WIN_X64.unpack(f)
|
||||||
|
|
||||||
|
if OBJW.number_of_rva_and_sizes < 1:
|
||||||
|
raise PeFileError("no data resource directory")
|
||||||
|
|
||||||
|
data_dirs = []
|
||||||
|
for rva in range(OBJW.number_of_rva_and_sizes):
|
||||||
|
data_dir = DATA_DIR.unpack(f)
|
||||||
|
data_dirs.append(data_dir)
|
||||||
|
|
||||||
|
res_dir = data_dirs[IMAGE_DIRECTORY_ENTRY]
|
||||||
|
dir_va = res_dir.virtual_address
|
||||||
|
|
||||||
|
for section in range(COFF.number_of_sections):
|
||||||
|
hdr = SECTION_HDR.unpack(f)
|
||||||
|
if hdr.name == RESOURCE_NODE:
|
||||||
|
va = hdr.virtual_address
|
||||||
|
ptr = hdr.pointer_to_raw_data
|
||||||
|
offset = dir_va - va + ptr
|
||||||
|
seek_to_hex(hex(offset), f)
|
||||||
|
break
|
||||||
|
|
||||||
|
if hdr.name != RESOURCE_NODE:
|
||||||
|
raise PeFileError("no root resource node found")
|
||||||
|
|
||||||
|
table = RESOURCE_DIRECTORY_TABLE.unpack(f)
|
||||||
|
total = table.number_of_name_entries + table.number_of_id_entries
|
||||||
|
|
||||||
|
for entry in range(total):
|
||||||
|
entry = RESOURCE_DIRECTORY_ENTRY.unpack(f)
|
||||||
|
if entry.name_or_id == VERSION_RESOURCE:
|
||||||
|
while entry.data_or_subdir & (1 << 31):
|
||||||
|
shift = entry.data_or_subdir & ~(1 << 31)
|
||||||
|
seek_to_hex(hex(offset + shift), f)
|
||||||
|
table = RESOURCE_DIRECTORY_TABLE.unpack(f)
|
||||||
|
total = (
|
||||||
|
table.number_of_name_entries
|
||||||
|
+ table.number_of_id_entries
|
||||||
|
)
|
||||||
|
for entry in range(total):
|
||||||
|
entry = RESOURCE_DIRECTORY_ENTRY.unpack(f)
|
||||||
|
break
|
||||||
|
if entry.name_or_id > VERSION_RESOURCE:
|
||||||
|
raise PeFileError("no version info node found")
|
||||||
|
seek_to_hex(hex(offset + entry.data_or_subdir), f)
|
||||||
|
|
||||||
|
data = RESOURCE_DATA_ENTRY.unpack(f)
|
||||||
|
# https://stackoverflow.com/questions/2170843/va-virtual-address-rva-relative-virtual-address
|
||||||
|
offset = data.data_rva - hdr.virtual_address + hdr.pointer_to_raw_data
|
||||||
|
seek_to_hex(hex(offset), f)
|
||||||
|
|
||||||
|
hdr = VS_VERSION_INFO_HDR.unpack(f)
|
||||||
|
# https://learn.microsoft.com/en-us/windows/win32/menurc/vs-versioninfo
|
||||||
|
byte_len = len(VS_VERSION_INFO_ID.encode("utf-16le"))
|
||||||
|
label = f.read(byte_len).decode("utf-16le")
|
||||||
|
if label != VS_VERSION_INFO_ID:
|
||||||
|
raise PeFileError(f"header identifier != '{VS_VERSION_INFO_ID}'")
|
||||||
|
f.read(32 - byte_len)
|
||||||
|
|
||||||
|
identifier = hex(struct.unpack("<Q", f.read(8))[0])
|
||||||
|
if identifier != VS_VERSION_INFO_MAGIC:
|
||||||
|
raise PeFileError(
|
||||||
|
f"{VS_VERSION_INFO_ID} address != '{VS_VERSION_INFO_MAGIC}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
version = parse_version_number(f)
|
||||||
|
except Exception as e:
|
||||||
|
return PeFileError(e)
|
||||||
|
|
||||||
|
return version
|
||||||
|
|
||||||
|
|
||||||
|
def get_pefile_path(path: str, appid: int) -> Path:
|
||||||
|
binary = "DayZ_x64.exe"
|
||||||
|
identifier = {221100: "DayZ", 1024020: "DayZ Exp"}
|
||||||
|
name = identifier[appid]
|
||||||
|
|
||||||
|
pe_path = None
|
||||||
|
path = path + "/steamapps/libraryfolders.vdf"
|
||||||
|
|
||||||
|
with open(path, "r") as f:
|
||||||
|
try:
|
||||||
|
j = json.loads(vdf_to_json(f))
|
||||||
|
except Exception:
|
||||||
|
raise VDFLoadError("Failed to parse libraryfolders")
|
||||||
|
|
||||||
|
for obj in j["libraryfolders"]:
|
||||||
|
if str(appid) in j["libraryfolders"][obj]["apps"]:
|
||||||
|
pe_path = j["libraryfolders"][obj]["path"]
|
||||||
|
pe_path += f"/steamapps/common/{name}/{binary}"
|
||||||
|
break
|
||||||
|
|
||||||
|
if pe_path is None:
|
||||||
|
raise AppNotInstalledError(
|
||||||
|
f"Failed to find a libraryfolder for the appid '{appid}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
pe_path = Path(pe_path)
|
||||||
|
if pe_path.exists() is False:
|
||||||
|
raise AppMovedError(
|
||||||
|
f"Path '{pe_path}' specified in libraryfolders does not exist"
|
||||||
|
)
|
||||||
|
|
||||||
|
return pe_path
|
||||||
|
|
||||||
|
|
||||||
|
def compare_versions(local: DayZVersion, remote: DayZVersion):
|
||||||
|
"""
|
||||||
|
packaging.version module is not available OOTB on some distributions
|
||||||
|
"""
|
||||||
|
if dayz_version_to_str(local) == dayz_version_to_str(remote):
|
||||||
|
return VersionMatch.SAME_VERSION
|
||||||
|
|
||||||
|
if local.major < remote.major:
|
||||||
|
return VersionMatch.LOCAL_OLDER
|
||||||
|
if local.major > remote.major:
|
||||||
|
return VersionMatch.LOCAL_NEWER
|
||||||
|
if local.major == remote.major:
|
||||||
|
if local.minor < remote.minor:
|
||||||
|
return VersionMatch.LOCAL_OLDER
|
||||||
|
if local.minor > remote.minor:
|
||||||
|
return VersionMatch.LOCAL_NEWER
|
||||||
|
if local.minor == remote.minor:
|
||||||
|
if local.patch < remote.patch:
|
||||||
|
return VersionMatch.LOCAL_OLDER
|
||||||
|
if local.patch > remote.patch:
|
||||||
|
return VersionMatch.LOCAL_NEWER
|
||||||
|
if local.patch == remote.patch:
|
||||||
|
return VersionMatch.SAME_VERSION
|
||||||
|
|
||||||
|
|
||||||
|
def vdf_to_json(stream):
|
||||||
|
def _istr(indent, string):
|
||||||
|
return (indent * " ") + string
|
||||||
|
|
||||||
|
jbuf = "{\n"
|
||||||
|
lex = shlex(stream)
|
||||||
|
indent = 1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
tok = lex.get_token()
|
||||||
|
if not tok:
|
||||||
|
return jbuf + "}\n"
|
||||||
|
if tok == "}":
|
||||||
|
indent -= 1
|
||||||
|
jbuf += _istr(indent, "}")
|
||||||
|
ntok = lex.get_token()
|
||||||
|
lex.push_token(ntok)
|
||||||
|
if ntok and ntok != "}":
|
||||||
|
jbuf += ","
|
||||||
|
jbuf += "\n"
|
||||||
|
else:
|
||||||
|
ntok = lex.get_token()
|
||||||
|
if ntok == "{":
|
||||||
|
jbuf += _istr(indent, tok + ": {\n")
|
||||||
|
indent += 1
|
||||||
|
else:
|
||||||
|
jbuf += _istr(indent, tok + ": " + ntok)
|
||||||
|
ntok = lex.get_token()
|
||||||
|
lex.push_token(ntok)
|
||||||
|
if ntok != "}":
|
||||||
|
jbuf += ","
|
||||||
|
jbuf += "\n"
|
||||||
@@ -0,0 +1,472 @@
|
|||||||
|
import json
|
||||||
|
import math
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import socket
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import typing # noqa
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from urllib import request, parse
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
sys.path.append("a2s")
|
||||||
|
import a2s # noqa
|
||||||
|
from a2s import dayzquery # noqa
|
||||||
|
|
||||||
|
params = [
|
||||||
|
r"\nor\1\map\chernarusplus\nor\1\map\sakhal\nor\1\map\enoch\empty\1\nor\1\map\namalsk", # noqa
|
||||||
|
r"\map\namalsk\empty\1",
|
||||||
|
r"\map\namalsk\noplayers\1",
|
||||||
|
r"\map\chernarusplus\empty\1",
|
||||||
|
r"\map\chernarusplus\noplayers\1",
|
||||||
|
r"\map\sakhal\empty\1",
|
||||||
|
r"\map\sakhal\noplayers\1",
|
||||||
|
r"\map\enoch\empty\1",
|
||||||
|
r"\map\enoch\noplayers\1",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class BmAPIError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class BmIdError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidIpError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def get_netmask() -> str:
|
||||||
|
hostname = os.uname()[1]
|
||||||
|
i = socket.gethostbyname(hostname)
|
||||||
|
netmask = i.rsplit(".", 1)[0]
|
||||||
|
return netmask
|
||||||
|
|
||||||
|
|
||||||
|
def test_ip(suffix: int, port: int) -> dict | None:
|
||||||
|
netmask = get_netmask()
|
||||||
|
hostname = f"{netmask}.{str(suffix)}"
|
||||||
|
ping = ["ping", "-c1", "-i", "0.1", "-w", "1"]
|
||||||
|
output = subprocess.run(ping + [hostname], capture_output=True)
|
||||||
|
if output.returncode == 0:
|
||||||
|
return query_direct(hostname, port)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def sanitize(name: str) -> str:
|
||||||
|
name = re.sub(r"\r", r"", name)
|
||||||
|
name = re.sub(r"\n", r"", name)
|
||||||
|
name = re.sub(r"\x01", r"", name)
|
||||||
|
name = re.sub(r"\ufeff", r"", name)
|
||||||
|
name = re.sub(r"(^!\s*)", r"-", name)
|
||||||
|
name = re.sub(r"(^-\s*)", r"", name)
|
||||||
|
name = re.sub(r"(^-)", r"", name)
|
||||||
|
name = re.sub(r"(^\s*)", r"", name)
|
||||||
|
name = re.sub(r"\t", "", name)
|
||||||
|
return name
|
||||||
|
|
||||||
|
|
||||||
|
def parse_json(json: list) -> list:
|
||||||
|
"""
|
||||||
|
Server metadata is underspecified and server operators
|
||||||
|
tend to insert random garbage in the headers. In case
|
||||||
|
sanitization failed, discard malformed rows rather than
|
||||||
|
aborting outright.
|
||||||
|
"""
|
||||||
|
rows = []
|
||||||
|
for row in json:
|
||||||
|
try:
|
||||||
|
name = sanitize(row["name"])
|
||||||
|
if name == "":
|
||||||
|
continue
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
malformed = False
|
||||||
|
for key in [
|
||||||
|
"map",
|
||||||
|
"gametype",
|
||||||
|
"players",
|
||||||
|
"max_players",
|
||||||
|
"addr",
|
||||||
|
"gameport",
|
||||||
|
]:
|
||||||
|
try:
|
||||||
|
row[key]
|
||||||
|
except KeyError:
|
||||||
|
malformed = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if malformed is True:
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
r = row["gametype"].split(",")
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if "no3rd" in r:
|
||||||
|
view = "1PP"
|
||||||
|
else:
|
||||||
|
view = "3PP"
|
||||||
|
|
||||||
|
if "external" in r:
|
||||||
|
provider = "Unoffic."
|
||||||
|
else:
|
||||||
|
provider = "Official"
|
||||||
|
|
||||||
|
if "mod" in r:
|
||||||
|
modded = True
|
||||||
|
else:
|
||||||
|
modded = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
r = row["gametype"].split("lqs")
|
||||||
|
queue = r[1].split(",")[0]
|
||||||
|
except IndexError:
|
||||||
|
queue = 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
test_time = re.search(r"[0-9]{2}:[0-9]{2}", row["gametype"])
|
||||||
|
if test_time:
|
||||||
|
time = test_time.group(0)
|
||||||
|
else:
|
||||||
|
time = "Unknown"
|
||||||
|
except AttributeError:
|
||||||
|
time = "Unknown"
|
||||||
|
|
||||||
|
try:
|
||||||
|
ip = row["addr"].split(":")[0] + ":" + str(row["gameport"])
|
||||||
|
qport = row["addr"].split(":")[1]
|
||||||
|
except IndexError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
ping = row["ping"]
|
||||||
|
except KeyError:
|
||||||
|
ping = 9999
|
||||||
|
|
||||||
|
mapname = row["map"].lower()
|
||||||
|
players = row["players"]
|
||||||
|
max_players = row["max_players"]
|
||||||
|
raw = [
|
||||||
|
name,
|
||||||
|
mapname,
|
||||||
|
view,
|
||||||
|
time,
|
||||||
|
int(players),
|
||||||
|
int(max_players),
|
||||||
|
int(queue),
|
||||||
|
ip,
|
||||||
|
int(qport),
|
||||||
|
ping,
|
||||||
|
provider,
|
||||||
|
modded,
|
||||||
|
]
|
||||||
|
rows.append(raw)
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
|
def query_direct(ip: str, qport: int, TIMEOUT: float=3.0) -> dict | None:
|
||||||
|
try:
|
||||||
|
info = a2s.info((ip, qport), TIMEOUT)
|
||||||
|
|
||||||
|
name = info.server_name
|
||||||
|
mapname = info.map_name
|
||||||
|
address = ip + ":" + str(qport)
|
||||||
|
gameport = str(info.port)
|
||||||
|
players = info.player_count
|
||||||
|
max_players = info.max_players
|
||||||
|
keywords = info.keywords
|
||||||
|
|
||||||
|
try:
|
||||||
|
ping = info.ping
|
||||||
|
ping = math.floor(info.ping * 1000)
|
||||||
|
except AttributeError:
|
||||||
|
ping = 9999
|
||||||
|
|
||||||
|
res = {}
|
||||||
|
res["name"] = name
|
||||||
|
res["map"] = mapname
|
||||||
|
res["gametype"] = keywords
|
||||||
|
res["players"] = players
|
||||||
|
res["max_players"] = max_players
|
||||||
|
res["addr"] = address
|
||||||
|
res["gameport"] = gameport
|
||||||
|
res["ping"] = ping
|
||||||
|
return res
|
||||||
|
except TimeoutError:
|
||||||
|
return None
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class Res:
|
||||||
|
status: int
|
||||||
|
parsed: bool
|
||||||
|
json: Union[str, None]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class Ping:
|
||||||
|
addr: str
|
||||||
|
iteration: int
|
||||||
|
ping: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class Details:
|
||||||
|
data: Union[list, None]
|
||||||
|
description: str
|
||||||
|
success: bool
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True, frozen=True)
|
||||||
|
class Prereqs:
|
||||||
|
password: bool
|
||||||
|
gameport: int
|
||||||
|
appid: Union[int, None]
|
||||||
|
version: Union[str, None]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
|
class Record:
|
||||||
|
"""
|
||||||
|
The gameport field is manipulated by the RowType.CONN_BY_IP method
|
||||||
|
"""
|
||||||
|
ip: str
|
||||||
|
gameport: int
|
||||||
|
qport: int
|
||||||
|
|
||||||
|
|
||||||
|
def get_prereqs(ip: str, qport: int) -> Prereqs:
|
||||||
|
try:
|
||||||
|
info = a2s.info((ip, qport))
|
||||||
|
except TimeoutError:
|
||||||
|
return Prereqs(False, 0, None, None)
|
||||||
|
|
||||||
|
gameport = getattr(info, "port", 0)
|
||||||
|
is_password = getattr(info, "password_protected", False)
|
||||||
|
appid = getattr(info, "game_id", None)
|
||||||
|
version = getattr(info, "version", None)
|
||||||
|
|
||||||
|
return Prereqs(is_password, gameport, appid, version)
|
||||||
|
|
||||||
|
|
||||||
|
def details(ip: str, qport: int) -> Details:
|
||||||
|
default_str = "None provided"
|
||||||
|
|
||||||
|
try:
|
||||||
|
info = a2s.info((ip, qport))
|
||||||
|
except TimeoutError:
|
||||||
|
return Details(None, default_str, False)
|
||||||
|
try:
|
||||||
|
rules = dayzquery.dayz_rules((ip, int(qport)))
|
||||||
|
except TimeoutError:
|
||||||
|
return Details(None, default_str, False)
|
||||||
|
|
||||||
|
try:
|
||||||
|
keywords = info.keywords.split(",")
|
||||||
|
except AttributeError:
|
||||||
|
return Details(None, default_str, False)
|
||||||
|
|
||||||
|
battleye = "Disabled"
|
||||||
|
if "battleye" in keywords:
|
||||||
|
battleye = "Enabled"
|
||||||
|
|
||||||
|
day_accel = 0.0
|
||||||
|
night_accel = 0.0
|
||||||
|
for keyword in keywords:
|
||||||
|
if "etm" in keyword:
|
||||||
|
day_accel = float(keyword.lstrip("etm"))
|
||||||
|
day_accel = float(f"{day_accel:g}")
|
||||||
|
if "entm" in keywords:
|
||||||
|
night_accel = float(keyword.lstrip("entm"))
|
||||||
|
night_accel = float(f"{night_accel:g}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
password = info.password_protected
|
||||||
|
if password is False:
|
||||||
|
password = "Disabled"
|
||||||
|
else:
|
||||||
|
password = "Enabled"
|
||||||
|
except AttributeError:
|
||||||
|
password = "-"
|
||||||
|
|
||||||
|
try:
|
||||||
|
vac = info.vac_enabled
|
||||||
|
if vac is False:
|
||||||
|
vac = "Disabled"
|
||||||
|
else:
|
||||||
|
vac = "Enabled"
|
||||||
|
except AttributeError:
|
||||||
|
vac = "-"
|
||||||
|
|
||||||
|
try:
|
||||||
|
version = info.version
|
||||||
|
except AttributeError:
|
||||||
|
version = "-"
|
||||||
|
|
||||||
|
try:
|
||||||
|
dlc = rules.dlc_flags
|
||||||
|
if dlc == 0:
|
||||||
|
dlc = "None"
|
||||||
|
if dlc == 2:
|
||||||
|
dlc = "Frostline"
|
||||||
|
except AttributeError:
|
||||||
|
dlc = "not specified"
|
||||||
|
|
||||||
|
try:
|
||||||
|
platform = rules.platform
|
||||||
|
if platform == "win":
|
||||||
|
platform = "Windows"
|
||||||
|
if platform == "?":
|
||||||
|
platform = "Linux"
|
||||||
|
except AttributeError:
|
||||||
|
platform = "not specified"
|
||||||
|
|
||||||
|
try:
|
||||||
|
description = rules.description.strip()
|
||||||
|
if description == "":
|
||||||
|
description = default_str
|
||||||
|
except AttributeError:
|
||||||
|
description = default_str
|
||||||
|
|
||||||
|
rows = [
|
||||||
|
["Battleye", battleye],
|
||||||
|
["Daytime acceleration", f"{day_accel}x"],
|
||||||
|
["DLC", dlc],
|
||||||
|
["Night-time acceleration", f"{night_accel}x"],
|
||||||
|
["Password", password],
|
||||||
|
["Platform", platform],
|
||||||
|
["Valve Anti-Cheat", vac],
|
||||||
|
["Version", version],
|
||||||
|
]
|
||||||
|
|
||||||
|
return Details(rows, description, True)
|
||||||
|
|
||||||
|
|
||||||
|
def ping(iteration: int, row: list) -> Ping:
|
||||||
|
addr = row[7]
|
||||||
|
qport = row[8]
|
||||||
|
|
||||||
|
res = None
|
||||||
|
|
||||||
|
if row[9] != 9999:
|
||||||
|
return Ping(addr, iteration, row[9])
|
||||||
|
|
||||||
|
try:
|
||||||
|
ip = addr.split(":")[0]
|
||||||
|
except IndexError:
|
||||||
|
ping = 9999
|
||||||
|
|
||||||
|
try:
|
||||||
|
res = query_direct(ip, qport, 0.5)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if res is None:
|
||||||
|
ping = 9999
|
||||||
|
else:
|
||||||
|
ping = res["ping"]
|
||||||
|
|
||||||
|
return Ping(addr, iteration, ping)
|
||||||
|
|
||||||
|
|
||||||
|
def query_api(key: str, appid: int, param: str) -> Res:
|
||||||
|
LIMIT = 10000
|
||||||
|
url = "https://api.steampowered.com/IGameServersService/GetServerList/v1/?"
|
||||||
|
|
||||||
|
payload: dict[str, Union[int, str]] = {
|
||||||
|
"filter": r"\appid" + fr"\{appid}" + param,
|
||||||
|
"limit": LIMIT,
|
||||||
|
"key": key,
|
||||||
|
}
|
||||||
|
par = parse.urlencode(payload)
|
||||||
|
url = f"{url}{par}"
|
||||||
|
|
||||||
|
status = 200
|
||||||
|
parsed = True
|
||||||
|
data = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
with request.urlopen(url) as response:
|
||||||
|
if response.status != 200:
|
||||||
|
status = response.status
|
||||||
|
try:
|
||||||
|
parsed = True
|
||||||
|
data = json.load(response)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
parsed = False
|
||||||
|
data = None
|
||||||
|
except HTTPError:
|
||||||
|
status = 403
|
||||||
|
parsed = False
|
||||||
|
data = None
|
||||||
|
finally:
|
||||||
|
return Res(status, parsed, data)
|
||||||
|
|
||||||
|
|
||||||
|
def query_bm_api(api_key: str, bm_id: str) -> Record:
|
||||||
|
if bm_id.isnumeric() is False:
|
||||||
|
raise BmIdError("ID must be numeric only")
|
||||||
|
|
||||||
|
payload: dict[str, Union[int, str]] = {
|
||||||
|
"sort": "-players",
|
||||||
|
"filter[game]": "dayz",
|
||||||
|
"filter[ids][whitelist]": bm_id,
|
||||||
|
}
|
||||||
|
|
||||||
|
url = "https://api.battlemetrics.com/servers?"
|
||||||
|
par = parse.urlencode(payload)
|
||||||
|
url = f"{url}{par}"
|
||||||
|
|
||||||
|
hdr = {"Authorization": "Bearer " + api_key}
|
||||||
|
r = request.Request(url, headers=hdr)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with request.urlopen(r) as response:
|
||||||
|
try:
|
||||||
|
j = json.load(response)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
raise BmAPIError("Malformed response from Battlemetrics")
|
||||||
|
|
||||||
|
if len(j["data"]) < 1:
|
||||||
|
raise BmAPIError("Not a valid Battlemetrics ID")
|
||||||
|
j = j["data"][0]["attributes"]
|
||||||
|
return Record(j["ip"], j["port"], j["portQuery"])
|
||||||
|
except HTTPError:
|
||||||
|
raise BmAPIError("Failed to query Battlemetrics")
|
||||||
|
|
||||||
|
|
||||||
|
def validate_ip(addr: str) -> Record:
|
||||||
|
fields = addr.split(":")
|
||||||
|
if len(fields) != 2:
|
||||||
|
raise InvalidIpError("Address must be formatted as IP:Queryport")
|
||||||
|
|
||||||
|
ip = fields[0]
|
||||||
|
port = fields[1]
|
||||||
|
|
||||||
|
try:
|
||||||
|
int(port)
|
||||||
|
except ValueError:
|
||||||
|
raise InvalidIpError(f"'{port}' is not a valid port")
|
||||||
|
|
||||||
|
if int(port) > 65535 or int(port) < 0:
|
||||||
|
raise InvalidIpError(f"'{port}' is not a valid port")
|
||||||
|
|
||||||
|
try:
|
||||||
|
socket.inet_aton(ip)
|
||||||
|
except OSError:
|
||||||
|
raise InvalidIpError(f"'{ip}' is not a valid IP")
|
||||||
|
|
||||||
|
ip = addr.split(":")[0]
|
||||||
|
qport = int(addr.split(":")[1])
|
||||||
|
record = Record(ip, 0, qport)
|
||||||
|
return record
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
latlon
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
bin := latlon
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
CFLAGS += -Wall
|
||||||
|
CFLAGS += -Wextra
|
||||||
|
CFLAGS += -Wpedantic
|
||||||
|
CFLAGS += -std=c23
|
||||||
|
CFLAGS += -O3
|
||||||
|
|
||||||
|
LDFLAGS += -lm
|
||||||
|
|
||||||
|
PREFIX ?= $(HOME)/.local/share/dzgui
|
||||||
|
|
||||||
|
all: $(bin)
|
||||||
|
|
||||||
|
install: $(bin)
|
||||||
|
install -Dm 755 $(bin) $(PREFIX)
|
||||||
|
|
||||||
|
$(bin): latlon.c
|
||||||
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(bin)
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
// This small program computes the distance between two points on the Earths
|
||||||
|
// surface. The algorithm used for computing is called haversine formula.
|
||||||
|
// Source for the algorithm can be found here:
|
||||||
|
// https://en.wikipedia.org/wiki/Haversine_formula
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// Earth's radius in meters.
|
||||||
|
#define RADIUS ((12756L / 2.0L) * 1000L)
|
||||||
|
|
||||||
|
// PI natural constant
|
||||||
|
#define PI 3.1415926536L
|
||||||
|
|
||||||
|
// coordinates struct for storing points
|
||||||
|
struct Coordinate {
|
||||||
|
double latitude;
|
||||||
|
double longitude;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates a radian value from an angle
|
||||||
|
*/
|
||||||
|
double radian_from(const double angle) {
|
||||||
|
return (angle * PI) / 180;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculate the haversine function from an angle in radian
|
||||||
|
*/
|
||||||
|
double haversine(const double angle) { return ((1.0L - cos(angle)) / 2); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculate the distance between two coordinates
|
||||||
|
*/
|
||||||
|
double great_circle_distance(const struct Coordinate a,
|
||||||
|
const struct Coordinate b) {
|
||||||
|
|
||||||
|
// calculate longitude and latitude differences
|
||||||
|
struct Coordinate diff_coord = {
|
||||||
|
.longitude = a.longitude - b.longitude,
|
||||||
|
.latitude = a.latitude - b.latitude,
|
||||||
|
};
|
||||||
|
|
||||||
|
// calculate haversine(theta) value, where theta is the angle between the
|
||||||
|
// two coordinates
|
||||||
|
double hav_theta = haversine(diff_coord.latitude)
|
||||||
|
+ cos(a.latitude) * cos(b.latitude) * haversine(diff_coord.longitude);
|
||||||
|
|
||||||
|
// calculate distance from radius, and haversine(theta) values
|
||||||
|
double distance = 2 * RADIUS * asin(sqrt(hav_theta));
|
||||||
|
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[]) {
|
||||||
|
if (argc < 5 || argc > 5) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct Coordinate a = {
|
||||||
|
.latitude = radian_from(atof(argv[1])),
|
||||||
|
.longitude = radian_from(atof(argv[2])),
|
||||||
|
};
|
||||||
|
const struct Coordinate b = {
|
||||||
|
.latitude = radian_from(atof(argv[3])),
|
||||||
|
.longitude = radian_from(atof(argv[4])),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Returns the distance in meters.
|
||||||
|
// To pretty-print the result in a consumer of this module, it is
|
||||||
|
// recommended to divide the result by 1,000 and round it.
|
||||||
|
printf("%.1f\n", great_circle_distance(a, b));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 609 KiB |
|
Before Width: | Height: | Size: 569 KiB |
|
Before Width: | Height: | Size: 417 KiB |
|
Before Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 31 KiB |