1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-28 21:32:36 +01:00

fix: align local mod signatures

This commit is contained in:
aclist 2024-11-16 07:42:52 +09:00
parent 1b7752588c
commit 732bc918a7
2 changed files with 26 additions and 3 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -o pipefail
version=5.6.0-beta.1
version=5.6.0-beta.2
#CONSTANTS
aid=221100
@ -572,7 +572,7 @@ fetch_helpers_by_sum(){
["ui.py"]="680ff0e4071681f26409fa3592a41e46"
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="fa5eb43c454e6bf2903e94884fe64644"
["funcs"]="acd5d85b27141082b25e07138f8b5b54"
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
)
local author="aclist"
@ -862,6 +862,18 @@ legacy_cols(){
< $cols_file jq '.cols += { "Queue": 120 }' > $cols_file.new &&
mv $cols_file.new $cols_file
}
stale_mod_signatures(){
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
if [[ -d $workshop_dir ]]; then
readarray -t old_mod_ids < <(awk -F, '{print $1}' $versions_file)
for ((i=0; i<${#old_mod_ids[@]}; ++i)); do
if [[ ! -d $workshop_dir/${old_mod_ids[$i]} ]]; then
"$HOME/.local/share/$app_name/helpers/funcs" "align_local" "${old_mod_ids[$i]}"
fi
done
fi
}
initial_setup(){
setup_dirs
setup_state_files
@ -882,6 +894,7 @@ initial_setup(){
steam_deps
migrate_files
stale_symlinks
stale_mod_signatures
local_latlon
is_steam_running
is_dzg_downloading

View file

@ -117,6 +117,7 @@ declare -A funcs=(
["start_cooldown"]="start_cooldown"
["list_mods"]="list_mods"
["delete"]="delete_local_mod"
["align_local"]="align_versions_file"
["show_server_modlist"]="show_server_modlist"
["test_ping"]="test_ping"
["is_in_favs"]="is_in_favs"
@ -339,7 +340,7 @@ list_mods(){
fi
}
installed_mods(){
ls -1 "$workshop_dir"
find "$workshop_dir" -maxdepth 1 -mindepth 1 -printf "%f\n"
}
local_latlon(){
local url="http://ip-api.com/json/$local_ip"
@ -579,6 +580,14 @@ parse_server_json(){
"\(.addr|split(":")[1])"
' | sort -k1
}
align_versions_file(){
shift
local mod="$1"
[[ ! -f $versions_file ]] && return
< "$versions_file" awk -F, -v var="$mod" '$1 != var' > $versions_file.new &&
mv $versions_file.new $versions_file
logger INFO "Removed local signatures for the mod '$mod'"
}
delete_local_mod(){
shift
if [[ -z $1 ]]; then
@ -597,6 +606,7 @@ delete_local_mod(){
[[ ! -L $game_dir/${symlinks[$i]} ]] && return 1
#SC2115
rm -rf "${workshop_dir:?}/${ids[$i]}" && unlink "$game_dir/${symlinks[$i]}" || return 1
align_versions_file "align" "${ids[$i]}"
done
}
test_cooldown(){