1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2025-09-07 14:12:26 +02:00

feat: highlight stale mods (#162)

This commit is contained in:
aclist 2024-11-21 23:40:17 +09:00
parent e9cd457233
commit 08af994361
4 changed files with 92 additions and 14 deletions

View file

@ -39,6 +39,7 @@ lock_file="$state_path/$prefix.lock"
cache_dir="$HOME/.cache/$app_name"
_cache_servers="$cache_dir/$prefix.servers"
_cache_mods_temp="$cache_dir/$prefix.mods_temp"
_cache_stale_mods_temp="$cache_dir/$prefix.stale_mods_temp"
_cache_temp="$cache_dir/$prefix.temp"
_cache_my_servers="$cache_dir/$prefix.my_servers"
_cache_history="$cache_dir/$prefix.history"
@ -95,6 +96,7 @@ else
fi
declare -A funcs=(
["Highlight stale"]="find_stale_mods"
["My servers"]="dump_servers"
["Change player name"]="update_config_val"
["Change Steam API key"]="update_config_val"
@ -144,6 +146,20 @@ lan_scan(){
printf "%s\n" "$res"
fi
}
find_stale_mods(){
local res
local mods=()
> $_cache_stale_mods_temp
for i in "${ip_list[@]}"; do
local ip=$(<<< "$i" awk -F: '{print $1}')
local qport=$(<<< "$i" awk -F: '{print $3}')
res=$(a2s $ip $qport rules)
if [[ -n $res ]]; then
printf "%s\n" "$res" >> $_cache_stale_mods_temp
fi
done
return 99
}
get_player_count(){
shift
local res