From 93635d6af31cc00452ffbb8425d1bd2ff26aa56c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 8 Dec 2023 22:02:45 +0900 Subject: [PATCH] fix: format returned ip from local server --- dzgui.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 4e2710b..958e575 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=4.1.0.rc-6 +version=4.1.0.rc-7 aid=221100 game="dayz" @@ -751,14 +751,18 @@ parse_ips(){ local lan_qport=$(<<< $ip awk -F: '{print $2}') logger INFO "Given LAN IP was $lan_ip" logger INFO "Given LAN port was $lan_qport" - logger INFO "LAN response follows" res=$(a2s $lan_ip $lan_qport info) if [[ ! $? -eq 0 ]] || [[ $(<<< $res jq 'length') -eq 0 ]]; then warn "Failed to retrieve server metadata. Check IP:PORT combination and try again." return 1 fi logger INFO "$res" - ip_table "$res" + local name=$(<<< $res jq -r '.address') + local ip=$(<<< $address awk -F: '{print $1}') + local gameport=$(<<< $address awk -F: '{print $2}') + local qport=$(<<< $res jq '.qport') + logger INFO "Found '${name}' at ${ip}:${gameport}:${qport}" + echo "${name}%%${ip}:${gameport}%%${qport}" return 0 else if validate_ip "$ip"; then