1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-30 22:22:04 +01:00

Compare commits

..

No commits in common. "21e9e140d197eaa9ab5be167dcfc360e4139f22f" and "99d964bf449bbee524d67cbe719350b6929b8a2a" have entirely different histories.

3 changed files with 27 additions and 29 deletions

View file

@ -1,11 +1,5 @@
# Changelog # Changelog
## [5.6.0-beta.19] 2024-12-18
### Added
- Redact usernames in log files
### Fixed
- More performant symlink traversal when checking for legacy links
## [5.6.0-beta.18] 2024-12-14 ## [5.6.0-beta.18] 2024-12-14
### Added ### Added
- Open Steam workshop subscriptions dialog - Open Steam workshop subscriptions dialog

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=5.6.0-beta.19 version=5.6.0-beta.18
#CONSTANTS #CONSTANTS
aid=221100 aid=221100
@ -83,7 +83,6 @@ logger(){
local self="${BASH_SOURCE[0]}" local self="${BASH_SOURCE[0]}"
local caller="${FUNCNAME[1]}" local caller="${FUNCNAME[1]}"
local line="${BASH_LINENO[0]}" local line="${BASH_LINENO[0]}"
self="$(<<< "$self" sed 's@\(/[^/]*/\)\([^/]*\)\(.*\)@\1REDACTED\3@g')"
printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" >> "$debug_log" printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" >> "$debug_log"
} }
setup_dirs(){ setup_dirs(){
@ -587,7 +586,7 @@ fetch_helpers_by_sum(){
["ui.py"]="99544ccef6060125509c4b689a808a15" ["ui.py"]="99544ccef6060125509c4b689a808a15"
["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="05f104fcdf27222f04046d41ec48d692" ["funcs"]="98261fdba4323f77c6dd610c1efc4d11"
["lan"]="c62e84ddd1457b71a85ad21da662b9af" ["lan"]="c62e84ddd1457b71a85ad21da662b9af"
) )
local author="aclist" local author="aclist"

View file

@ -337,9 +337,8 @@ is_in_favs(){
find_id(){ find_id(){
local file="$default_steam_path/config/loginusers.vdf" local file="$default_steam_path/config/loginusers.vdf"
[[ ! -f $file ]] && return 1 [[ ! -f $file ]] && return 1
local res=$(python3 "$helpers_path/vdf2json.py" \ local res=$(python3 $HOME/.local/share/dzgui/helpers/vdf2json.py \
-i "$file" \ -i "$file" | jq -r '.users
| jq -r '.users
|to_entries[] |to_entries[]
|select(.value.MostRecent=="1") |select(.value.MostRecent=="1")
|.key' |.key'
@ -740,7 +739,6 @@ logger(){
local self="${BASH_SOURCE[0]}" local self="${BASH_SOURCE[0]}"
local caller="${FUNCNAME[1]}" local caller="${FUNCNAME[1]}"
local line="${BASH_LINENO[0]}" local line="${BASH_LINENO[0]}"
self="$(<<< "$self" sed 's@\(/[^/]*/\)\([^/]*\)\(.*\)@\1REDACTED\3@g')"
printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" >> "$debug_log" printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" >> "$debug_log"
} }
test_ping(){ test_ping(){
@ -1202,22 +1200,29 @@ compare(){
} }
legacy_symlinks(){ legacy_symlinks(){
logger INFO "Removing legacy symlinks" logger INFO "Removing legacy symlinks"
for d in "$game_dir"/*; do
readarray -t stale_mod_dirs1 < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type l -name '@?*-*') if [[ $d =~ @[0-9]+-.+ ]]; then
logger INFO "Read local mods into array 1 with length: ${#stale_mod_dirs[@]}" logger INFO "Unlinking '$d'"
if [[ ${#stale_mod_dirs1} -ne 0 ]]; then unlink "$d"
for d in "${stale_mod_dirs1[@]}"; do fi
unlink "$game_dir/$d" done
done readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)
fi logger INFO "Read local mods into array with length: ${#mod_dirs[@]}"
[[ ${#mod_dirs[@]} -eq 0 ]] && return
readarray -t stale_mod_dirs2 < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type l -name '@??') logger INFO "Removing legacy encoding format"
logger INFO "Read local mods into array 2 with length: ${#stale_mod_dirs[@]}" for d in "${mod_dirs[@]}"; do
if [[ ${#stale_mod_dirs2} -eq 0 ]]; then # suppress errors if mods are downloading at boot
for d in "${stale_mod_dirs2[@]}"; do logger INFO "Testing directory '$d'"
unlink "$game_dir/$d" [[ ! -f "$d/meta.cpp" ]] && continue
done local id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}')
fi logger INFO "Given id is '$id'"
local encoded_id=$(echo "$id" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g')
logger INFO "Resolved id is '$encoded_id'"
if [[ -h "$game_dir/@$encoded_id" ]]; then
logger INFO "Unlinking '$game_dir/@$encoded_id'"
unlink "$game_dir/@$encoded_id"
fi
done
} }
symlinks(){ symlinks(){
readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d) readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)