From 6bcf0d808997162f8cab0371995bba664fe60f13 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 14 Sep 2020 10:01:03 +0100 Subject: [PATCH] allow accurate ip to be set for webadminip in most cases --- lgsm/functions/check_ip.sh | 14 +++++++++++--- lgsm/functions/info_messages.sh | 12 ++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lgsm/functions/check_ip.sh b/lgsm/functions/check_ip.sh index b953a3125..49e5edb5a 100644 --- a/lgsm/functions/check_ip.sh +++ b/lgsm/functions/check_ip.sh @@ -23,13 +23,21 @@ getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\ # If the IP variable has been set by user. if [ -n "${ip}" ]&&[ "${ip}" != "0.0.0.0" ]; then queryips=( "${ip}" ) - # If game config does have an IP set. + webadminip=( "${ip}" ) +# If game config does have an IP set. elif [ -n "${configip}" ]&&[ "${configip}" != "0.0.0.0" ];then queryips=( "${configip}" ) ip="${configip}" - # If no ip is set by the user. + webadminip=( "${configip}" ) +# If there is only 1 server IP address. +# Some IP details can automaticly use the one IP +elif [ "${getipwc}" == "1" ]; then + queryips=( $(echo "${getip}") ) + ip="0.0.0.0" + webadminip=( "${getip}" ) +# If no ip is set by the user and server has more than one IP. else queryips=( $(echo "${getip}") ) ip="0.0.0.0" -# If IP has not been set by user. + webadminip=( "${ip}" ) fi diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index a7d6a1261..6ecef11e3 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -1115,7 +1115,7 @@ fn_info_message_sdtd(){ fn_messages_separator { echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}" - echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}" + echo -e "${lightblue}WebAdmin url:\t${default}http://${webadminip}:${webadminport}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}" } | column -s $'\t' -t echo -e "" @@ -1162,7 +1162,7 @@ fn_info_message_spark(){ echo -e "${lightgreen}${servername} WebAdmin${default}" fn_messages_separator { - echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html" + echo -e "${lightblue}WebAdmin url:\t${default}http://${webadminip}:${webadminport}/index.html" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}" } | column -s $'\t' -t @@ -1276,7 +1276,7 @@ fn_info_message_unreal(){ fn_messages_separator { echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}" - echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}" + echo -e "${lightblue}WebAdmin url:\t${default}http://${webadminip}:${webadminport}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}" } | column -s $'\t' -t @@ -1300,7 +1300,7 @@ fn_info_message_unreal2(){ fn_messages_separator { echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}" - echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}" + echo -e "${lightblue}WebAdmin url:\t${default}http://${webadminip}:${webadminport}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}" } | column -s $'\t' -t @@ -1321,7 +1321,7 @@ fn_info_message_unreal3(){ fn_messages_separator { echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}" - echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}" + echo -e "${lightblue}WebAdmin url:\t${default}http://${webadminip}:${webadminport}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}" } | column -s $'\t' -t @@ -1362,7 +1362,7 @@ fn_info_message_kf2(){ fn_messages_separator { echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}" - echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}" + echo -e "${lightblue}WebAdmin url:\t${default}http://${webadminip}:${webadminport}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}" } | column -s $'\t' -t