feat: switch to the dayzsalauncher.com JSON API

The daemonforge.dev JSON API is unfortunately too unreliable.
This commit is contained in:
bastimeyer 2022-02-19 16:49:44 +01:00
parent 48f0011856
commit b4c73a9cea
2 changed files with 6 additions and 7 deletions

View file

@ -49,7 +49,7 @@ Command line options:
-s <address[:port]>
--server <address[:port]>
Retrieve a server's mod list and add it to the remaining input.
Uses the daemonforge.dev DayZ server JSON API.
Uses the dayzsalauncher.com JSON API.
If --launch is set, it will automatically connect to the server.
-p <port>
@ -96,7 +96,7 @@ STEAM_ROOT=/media/games/SteamLibrary ./dayz-launcher.sh -l -s address
### Third party server query API
The third party JSON API for querying server data is unfortunately not perfectly reliable. This can't be fixed here, so if there are issues with querying the server data, then please try running the launcher again. Some servers also return invalid data, so manual mods setup via mod IDs is required.
Server data is queried via the third-party dayzsalauncher.com JSON API when using the `--server` parameter. Previously, this was done via the daemonforge.dev JSON API, which unfortunately wasn't perfectly reliable. Please try running the launcher again if the query times out, and if the data returned by the server query API doesn't reflect the server's actual mod IDs, then custom mod IDs will need to be set as launch arguments.
### Steam doesn't launch the game

View file

@ -12,12 +12,11 @@ FLATPAK_PARAMS=(
--command=/app/bin/steam-wrapper
)
API_URL="https://api.daemonforge.dev/server/@ADDRESS@/@PORT@/full"
API_URL="https://dayzsalauncher.com/api/v1/query/@ADDRESS@/@PORT@"
API_PARAMS=(
-sSL
-m 10
-H "Referer: https://daemonforge.dev/"
-H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
-H "User-Agent: dayz-linux-cli-launcher"
)
WORKSHOP_URL="https://steamcommunity.com/sharedfiles/filedetails/?id=@ID@"
@ -218,9 +217,9 @@ query_server_api() {
debug "Querying ${query}"
response="$(curl "${API_PARAMS[@]}" "${query}")"
debug "Parsing API response"
jq -e ".mods[]" >/dev/null 2>&1 <<< "${response}" || err "Missing mods data from API response"
jq -e ".result.mods[]" >/dev/null 2>&1 <<< "${response}" || err "Missing mods data from API response"
INPUT+=( $(jq -r ".mods[] | select(.app_id == ${DAYZ_ID}) | .id" <<< "${response}") )
INPUT+=( $(jq -r ".result.mods[] | .steamWorkshopId" <<< "${response}") )
}
setup_mods() {