From 1c78d4b06f0c2969b0d45c37167d8f74def1a4fe Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 28 May 2023 15:11:16 +0100 Subject: [PATCH 1/4] fix(sdtd): resolve sdtd details not collecting note xmllint is now required to gather details for sdtd This commit updates the server details to include new fields such as Internet IP, Server IP, Telnet Enabled, Telnet Password and Telnet Port. It also updates the game info for 7 Days to Die to use different XML tags for retrieving values. --- lgsm/modules/command_dev_details.sh | 6 +++- lgsm/modules/info_game.sh | 47 +++++++++++++++-------------- lgsm/modules/info_messages.sh | 1 - 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/lgsm/modules/command_dev_details.sh b/lgsm/modules/command_dev_details.sh index 330d7e2cd9..28abb87b16 100644 --- a/lgsm/modules/command_dev_details.sh +++ b/lgsm/modules/command_dev_details.sh @@ -44,7 +44,7 @@ declare -A server_details=( ['HTTP Password']="${httppassword}" ['HTTP Port']="${httpport}" ['HTTP User']="${httpuser}" - ['ip']="${ip}" + ['Internet IP']="${extip}" ['LAN Port']="${lanport}" ['Master Port']="${masterport}" ['Master']="${master}" @@ -56,12 +56,16 @@ declare -A server_details=( ['RCON Password']="${rconpassword}" ['RCON Port']="${rconport}" ['Reserved Slots']="${reservedslots}" + ['Server IP']="${ip}" ['Server Password']="${serverpassword}" ['Servername']="${servername}" ['Shard']="${shard}" ['Sharding']="${sharding}" ['Steam Auth Port']="${steamauthport}" + ['Telnet Enabled']="${telnetenabled}" ['Telnet IP']="${telnetip}" + ['Telnet Password']="${telnetpassword}" + ['Telnet Port']="${telnetport}" ['Tickrate']="${tickrate}" ['World Name']="${worldname}" ['World Type']="${worldtype}" diff --git a/lgsm/modules/info_game.sh b/lgsm/modules/info_game.sh index 5f9b4aaf72..8b91629c05 100644 --- a/lgsm/modules/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -1883,38 +1883,39 @@ fn_info_game_scpsl() { # Filetype: xml fn_info_game_sdtd() { if [ -f "${servercfgfullpath}" ]; then - fn_info_game_xml "gamemode" "ServerSettings/@GameMode" - fn_info_game_xml "maxplayers" "ServerSettings/@MaxPlayers" - fn_info_game_xml "servername" "ServerSettings/@ServerName" - fn_info_game_xml "serverpassword" "ServerSettings/@ServerPassword" - fn_info_game_xml "serverport" "ServerSettings/@ServerPort" - fn_info_game_xml "telnetenabled" "ServerSettings/@TelnetEnabled" - fn_info_game_xml "telnetpass" "ServerSettings/@TelnetPassword" - fn_info_game_xml "telnetport" "ServerSettings/@TelnetPort" - fn_info_game_xml "httpenabled" "ServerSettings/@ControlPanelEnabled" - fn_info_game_xml "httppassword" "ServerSettings/@ControlPanelPassword" - fn_info_game_xml "httpport" "ServerSettings/@ControlPanelPort" - fn_info_game_xml "worldname" "ServerSettings/@GameWorld" - + fn_info_game_xml "gamemode" "/ServerSettings/property[@name='GameMode']/@value" + fn_info_game_xml "httpenabled" "/ServerSettings/property[@name='ControlPanelEnabled']/@value" + fn_info_game_xml "httppassword" "/ServerSettings/property[@name='ControlPanelPassword']/@value" + fn_info_game_xml "httpport" "/ServerSettings/property[@name='ControlPanelPort']/@value" + fn_info_game_xml "maxplayers" "/ServerSettings/property[@name='ServerMaxPlayerCount']/@value" + fn_info_game_xml "servername" "/ServerSettings/property[@name='ServerName']/@value" + fn_info_game_xml "serverpassword" "/ServerSettings/property[@name='ServerPassword']/@value" + fn_info_game_xml "port" "/ServerSettings/property[@name='ServerPort']/@value" + fn_info_game_xml "telnetenabled" "/ServerSettings/property[@name='TelnetEnabled']/@value" + fn_info_game_xml "telnetpass" "/ServerSettings/property[@name='TelnetPassword']/@value" + fn_info_game_xml "telnetport" "/ServerSettings/property[@name='TelnetPort']/@value" + fn_info_game_xml "worldname" "/ServerSettings/property[@name='GameWorld']/@value" fi - servername="${servername:-"NOT SET"}" - serverpassword="${serverpassword:-"NOT SET"}" - port="${port:-"0"}" - queryport="${queryport:-"0"}" + gamemode="${gamemode:-"NOT SET"}" httpenabled="${httpenabled:-"NOT SET"}" - httpport="${httpport:-"0"}" httppassword="${httppassword:-"NOT SET"}" - telnetenabled="${telnetenabled:-"NOT SET"}" - telnetport="${telnetport:-"0"}" - telnetpass="${telnetpass:-"NOT SET"}" + httpport="${httpport:-"0"}" maxplayers="${maxplayers:-"0"}" - gamemode="${gamemode:-"NOT SET"}" - worldname="${worldname:-"NOT SET"}" + port="${port:-"0"}" + port3="$((port + 2))" + queryport="${port:-"0"}" + servername="${servername:-"NOT SET"}" + serverpassword="${serverpassword:-"NOT SET"}" + telnetenabled="${telnetenabled:-"NOT SET"}" # Telnet IP will be localhost if no password is set # check_ip will set the IP first. This will overwrite it. if [ -z "${telnetpass}" ]; then telnetip="127.0.0.1" fi + telnetpass="${telnetpass:-"NOT SET"}" + telnetport="${telnetport:-"0"}" + worldname="${worldname:-"NOT SET"}" + } # Config Type: Parameters (with an ini) diff --git a/lgsm/modules/info_messages.sh b/lgsm/modules/info_messages.sh index 13fe285354..520dfa58e8 100644 --- a/lgsm/modules/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -1411,7 +1411,6 @@ fn_info_message_sdtd() { { echo -e "${lightblue}Web Interface enabled:\t${default}${httpenabled}" echo -e "${lightblue}Web Interface url:\t${default}http://${httpip}:${httpport}/index.html" - echo -e "${lightblue}Web Interface username:\t${default}${httpuser}" echo -e "${lightblue}Web Interface password:\t${default}${httppassword}" } | column -s $'\t' -t echo -e "" From 9e85791e3255ab9823ce5af92dde073fc6f61686 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 28 May 2023 15:14:02 +0100 Subject: [PATCH 2/4] Release v23.3.1 --- lgsm/functions/core_functions.sh | 2 +- lgsm/functions/core_modules.sh | 2 +- lgsm/modules/core_functions.sh | 2 +- lgsm/modules/core_modules.sh | 2 +- linuxgsm.sh | 2 +- tests/tests_fctrserver.sh | 2 +- tests/tests_jc2server.sh | 2 +- tests/tests_mcserver.sh | 2 +- tests/tests_ts3server.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 50c69522ea..3c5777c70c 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v23.3.0" +modulesversion="v23.3.1" # Core diff --git a/lgsm/functions/core_modules.sh b/lgsm/functions/core_modules.sh index fd98349bcb..80e890d1a7 100644 --- a/lgsm/functions/core_modules.sh +++ b/lgsm/functions/core_modules.sh @@ -8,7 +8,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v23.3.0" +modulesversion="v23.3.1" # Core diff --git a/lgsm/modules/core_functions.sh b/lgsm/modules/core_functions.sh index c6f9264511..9731815476 100644 --- a/lgsm/modules/core_functions.sh +++ b/lgsm/modules/core_functions.sh @@ -8,7 +8,7 @@ module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v23.3.0" +modulesversion="v23.3.1" # Core diff --git a/lgsm/modules/core_modules.sh b/lgsm/modules/core_modules.sh index a950e8c227..827e62888b 100644 --- a/lgsm/modules/core_modules.sh +++ b/lgsm/modules/core_modules.sh @@ -8,7 +8,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v23.3.0" +modulesversion="v23.3.1" # Core diff --git a/linuxgsm.sh b/linuxgsm.sh index 787fb3a35b..30531fa754 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v23.3.0" +version="v23.3.1" shortname="core" gameservername="core" commandname="CORE" diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index e3a5ab80ec..6ecaad71a4 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v23.3.0" +version="v23.3.1" shortname="fctr" gameservername="fctrserver" commandname="CORE" diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 29ed21ab20..7eb3fe2b2c 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v23.3.0" +version="v23.3.1" shortname="jc2" gameservername="jc2server" commandname="CORE" diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 155275c303..4275b1f676 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v23.3.0" +version="v23.3.1" shortname="mc" gameservername="mcserver" commandname="CORE" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 82533f557b..f7f1cfb8c6 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v23.3.0" +version="v23.3.1" shortname="ts3" gameservername="ts3server" commandname="CORE" From 56d222041f58743877540136b301408a52a5aa13 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 28 May 2023 15:48:00 +0100 Subject: [PATCH 3/4] fix(sdtd): add port3 to master server query this will allow master server query to work for sdtd --- lgsm/modules/info_game.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lgsm/modules/info_game.sh b/lgsm/modules/info_game.sh index 8b91629c05..b90033d9c0 100644 --- a/lgsm/modules/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -2444,12 +2444,12 @@ if [ -z "${displaymasterserver}" ]; then if [ "$(command -v jq 2> /dev/null)" ]; then if [ -n "${ip}" ] && [ -n "${port}" ]; then if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then - # Query external IP first as most likely 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)" + # 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}" --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 # Loop though server IP addresses if external IP fails. 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 fi if [ "${masterserver}" == "0" ]; then From 778b004b7f2f7efbc2dc6a712b845858266729c3 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 28 May 2023 16:00:55 +0100 Subject: [PATCH 4/4] change core_functions to older version v23.2.3 --- lgsm/functions/core_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 3c5777c70c..b301b7e465 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v23.3.1" +modulesversion="v23.2.3" # Core