mirror of
https://github.com/aclist/dztui.git
synced 2025-01-01 15:12:05 +01:00
fix: hotfix for #59
This commit is contained in:
parent
57cf0df642
commit
c7c93558ae
2 changed files with 43 additions and 33 deletions
|
@ -6,6 +6,10 @@
|
||||||
- Custom query API
|
- Custom query API
|
||||||
- Store favorites by IP
|
- Store favorites by IP
|
||||||
|
|
||||||
|
## [3.2.4] 2023-03-01
|
||||||
|
### Fixed
|
||||||
|
- BM API returning stale query port and preventing fetching modlist
|
||||||
|
|
||||||
## [3.2.3] 2023-02-17
|
## [3.2.3] 2023-02-17
|
||||||
### Fixed
|
### Fixed
|
||||||
- sysctl map count value not being loaded immediately after setting
|
- sysctl map count value not being loaded immediately after setting
|
||||||
|
|
52
dzgui.sh
52
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
version=3.2.3
|
version=3.2.4
|
||||||
|
|
||||||
aid=221100
|
aid=221100
|
||||||
game="dayz"
|
game="dayz"
|
||||||
|
@ -682,7 +682,7 @@ history_table(){
|
||||||
|
|
||||||
ip_table(){
|
ip_table(){
|
||||||
while true; do
|
while true; do
|
||||||
sel=$(prepare_ip_list "$meta_file" | $steamsafe_zenity --width 1200 --height 800 --list --column=Name --column=IP --column=Players --column=Gametime --print-column=2 --separator=%% 2>/dev/null)
|
sel=$(prepare_ip_list "$meta_file" | $steamsafe_zenity --width 1200 --height 800 --text="Multiple maps found at this server. Select map from the list below" --title="DZGUI" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2 --separator=%% 2>/dev/null)
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
return_from_table=1
|
return_from_table=1
|
||||||
return
|
return
|
||||||
|
@ -701,20 +701,13 @@ ip_table(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
fetch_ip_metadata(){
|
fetch_ip_metadata(){
|
||||||
local meta_file=$(mktemp)
|
meta_file=$(mktemp)
|
||||||
source $config_file
|
source $config_file
|
||||||
url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api"
|
url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api"
|
||||||
curl -Ls "$url" > $meta_file
|
curl -Ls "$url" > $meta_file
|
||||||
json=$(mktemp)
|
json=$(mktemp)
|
||||||
< $meta_file jq '.response' > $json
|
< $meta_file jq '.response' > $json
|
||||||
res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null)
|
res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null)
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|
||||||
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
|
|
||||||
echo "[DZGUI] 96: Failed to retrieve IP metadata"
|
|
||||||
|
|
||||||
else
|
|
||||||
ip_table
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#TODO: local servers
|
#TODO: local servers
|
||||||
|
@ -773,6 +766,12 @@ connect_by_ip(){
|
||||||
[[ $? -eq 1 ]] && return
|
[[ $? -eq 1 ]] && return
|
||||||
if validate_ip "$ip"; then
|
if validate_ip "$ip"; then
|
||||||
fetch_ip_metadata
|
fetch_ip_metadata
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
|
||||||
|
echo "[DZGUI] 96: Failed to retrieve IP metadata"
|
||||||
|
else
|
||||||
|
ip_table
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -911,16 +910,26 @@ delete_or_connect(){
|
||||||
source $config_file
|
source $config_file
|
||||||
unset delete
|
unset delete
|
||||||
else
|
else
|
||||||
#hotfix for bug #36
|
local lookup_ip=$(echo "$sel" | awk -F: '{print $1}')
|
||||||
local lookup_ip=$(echo "$sel" | awk -F%% '{print $1}')
|
ip=$lookup_ip
|
||||||
local lookup_port=$(echo "$lookup_ip" | awk -F: '{print $2}')
|
fetch_ip_metadata
|
||||||
source $config_file
|
if [[ ! $? -eq 0 ]]; then
|
||||||
url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$lookup_ip&key=$steam_api"
|
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
|
||||||
local qport_res=$(curl -Ls "$url" | jq -r --arg port $lookup_port '.response.servers[]|select(.gameport==($port|tonumber)).addr')
|
echo "[DZGUI] 96: Failed to retrieve IP metadata"
|
||||||
local qport=$(echo "$qport_res" | awk -F: '{print $2}')
|
else
|
||||||
qport_list="$lookup_ip%%$qport"
|
local jad=$(echo "$res" | jq -r '.addr')
|
||||||
connect "$qport_list" "ip"
|
if [[ $(<<< "$jad" wc -l ) -gt 1 ]]; then
|
||||||
|
ip_table
|
||||||
|
elif [[ $(<<< "$jad" wc -l ) -eq 1 ]]; then
|
||||||
|
local gameport="$(echo "$res" | jq -r '.gameport')"
|
||||||
|
local ip="$(echo "$jad" | awk -F: '{print $1}')"
|
||||||
|
local qport=$(echo "$jad" | awk -F: '{print $2}')
|
||||||
|
local sa_ip=$(echo "$ip:$gameport%%$qport")
|
||||||
|
qport_list="$sa_ip"
|
||||||
|
local sel="$ip:$gameport%%$qport"
|
||||||
|
connect "$sel" "ip"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
populate(){
|
populate(){
|
||||||
|
@ -1444,9 +1453,6 @@ mods_disk_size(){
|
||||||
main_menu(){
|
main_menu(){
|
||||||
print_news
|
print_news
|
||||||
set_mode
|
set_mode
|
||||||
# if [[ -n $fav ]]; then
|
|
||||||
# items[8]=" Change favorite server"
|
|
||||||
# fi
|
|
||||||
while true; do
|
while true; do
|
||||||
set_header ${FUNCNAME[0]}
|
set_header ${FUNCNAME[0]}
|
||||||
rc=$?
|
rc=$?
|
||||||
|
|
Loading…
Reference in a new issue