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

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