Browse Source

fix(sdtd): add port3 to master server query

this will allow master server query to work for sdtd
pull/4218/head
Daniel Gibbs 2 years ago
parent
commit
56d222041f
  1. 6
      lgsm/modules/info_game.sh

6
lgsm/modules/info_game.sh

@ -2444,12 +2444,12 @@ if [ -z "${displaymasterserver}" ]; then
if [ "$(command -v jq 2> /dev/null)" ]; then if [ "$(command -v jq 2> /dev/null)" ]; then
if [ -n "${ip}" ] && [ -n "${port}" ]; then if [ -n "${ip}" ] && [ -n "${port}" ]; then
if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then
# Query external IP first as most likely to succeed. # Query external IP first as most liky to succeed.
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" 'if .response.servers != null then .response.servers[] | select((.gameport == ($port|tonumber) or .gameport == ($queryport|tonumber))) | .addr else empty end' | wc -l 2> /dev/null)" masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" --arg port3 "${port3}" 'if .response.servers != null then .response.servers[] | select((.gameport == ($port|tonumber) or .gameport == ($queryport|tonumber) or .gameport == ($port3|tonumber))) | .addr else empty end' | wc -l 2> /dev/null)"
if [ "${masterserver}" == "0" ]; then if [ "${masterserver}" == "0" ]; then
# Loop though server IP addresses if external IP fails. # Loop though server IP addresses if external IP fails.
for queryip in "${queryips[@]}"; do for queryip in "${queryips[@]}"; do
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" 'if .response.servers != null then .response.servers[] | select((.gameport == ($port|tonumber) or .gameport == ($queryport|tonumber))) | .addr else empty end' | wc -l 2> /dev/null)" masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${queryip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" --arg port3 "${port3}" 'if .response.servers != null then .response.servers[] | select((.gameport == ($port|tonumber) or .gameport == ($queryport|tonumber) or .gameport == ($port3|tonumber))) | .addr else empty end' | wc -l 2> /dev/null)"
done done
fi fi
if [ "${masterserver}" == "0" ]; then if [ "${masterserver}" == "0" ]; then

Loading…
Cancel
Save