From b4c73a9ceabd5a02eace33a7f7d5f6ee1386664f Mon Sep 17 00:00:00 2001 From: bastimeyer Date: Sat, 19 Feb 2022 16:49:44 +0100 Subject: [PATCH] feat: switch to the dayzsalauncher.com JSON API The daemonforge.dev JSON API is unfortunately too unreliable. --- README.md | 4 ++-- dayz-launcher.sh | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 77d51f8..b60e161 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Command line options: -s --server 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 @@ -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 diff --git a/dayz-launcher.sh b/dayz-launcher.sh index 7324b94..021695f 100755 --- a/dayz-launcher.sh +++ b/dayz-launcher.sh @@ -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() {