From 4a953164122a3e55f51679ea82d1d404adf85502 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:55:01 +0900 Subject: [PATCH 1/4] feat: redact usernames --- helpers/funcs | 1 + 1 file changed, 1 insertion(+) diff --git a/helpers/funcs b/helpers/funcs index 576b5c3..99bc569 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -739,6 +739,7 @@ logger(){ local self="${BASH_SOURCE[0]}" local caller="${FUNCNAME[1]}" 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" } test_ping(){ From 9b2ec79aa57ac41c9d5fa52b238b2d0c44b8fc97 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:56:14 +0900 Subject: [PATCH 2/4] feat: redact usernames --- dzgui.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dzgui.sh b/dzgui.sh index 8136155..0dd1df3 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -83,6 +83,7 @@ logger(){ local self="${BASH_SOURCE[0]}" local caller="${FUNCNAME[1]}" 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" } setup_dirs(){ From bdea37ddc447860c084c2a725ed0f258766b9ef5 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:57:09 +0900 Subject: [PATCH 3/4] chore: cleanup --- helpers/funcs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helpers/funcs b/helpers/funcs index 99bc569..8450450 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -337,8 +337,9 @@ is_in_favs(){ find_id(){ local file="$default_steam_path/config/loginusers.vdf" [[ ! -f $file ]] && return 1 - local res=$(python3 $HOME/.local/share/dzgui/helpers/vdf2json.py \ - -i "$file" | jq -r '.users + local res=$(python3 "$helpers_path/vdf2json.py" \ + -i "$file" \ + | jq -r '.users |to_entries[] |select(.value.MostRecent=="1") |.key' From 973e2dc100a5a82d803c735478285fcfe6732497 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:21:44 +0900 Subject: [PATCH 4/4] fix: shorten symlink check time --- CHANGELOG.md | 6 ++++++ dzgui.sh | 4 ++-- helpers/funcs | 39 ++++++++++++++++----------------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea3c173..ecfc1b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 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 ### Added - Open Steam workshop subscriptions dialog diff --git a/dzgui.sh b/dzgui.sh index 0dd1df3..ac2de14 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.6.0-beta.18 +version=5.6.0-beta.19 #CONSTANTS aid=221100 @@ -587,7 +587,7 @@ fetch_helpers_by_sum(){ ["ui.py"]="99544ccef6060125509c4b689a808a15" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="98261fdba4323f77c6dd610c1efc4d11" + ["funcs"]="05f104fcdf27222f04046d41ec48d692" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" diff --git a/helpers/funcs b/helpers/funcs index 8450450..5989793 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -1202,29 +1202,22 @@ compare(){ } legacy_symlinks(){ logger INFO "Removing legacy symlinks" - for d in "$game_dir"/*; do - if [[ $d =~ @[0-9]+-.+ ]]; then - logger INFO "Unlinking '$d'" - unlink "$d" - fi - done - readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d) - logger INFO "Read local mods into array with length: ${#mod_dirs[@]}" - [[ ${#mod_dirs[@]} -eq 0 ]] && return - logger INFO "Removing legacy encoding format" - for d in "${mod_dirs[@]}"; do - # suppress errors if mods are downloading at boot - logger INFO "Testing directory '$d'" - [[ ! -f "$d/meta.cpp" ]] && continue - local id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}') - 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 + + readarray -t stale_mod_dirs1 < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type l -name '@?*-*') + logger INFO "Read local mods into array 1 with length: ${#stale_mod_dirs[@]}" + if [[ ${#stale_mod_dirs1} -ne 0 ]]; then + for d in "${stale_mod_dirs1[@]}"; do + unlink "$game_dir/$d" + done + fi + + readarray -t stale_mod_dirs2 < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type l -name '@??') + logger INFO "Read local mods into array 2 with length: ${#stale_mod_dirs[@]}" + if [[ ${#stale_mod_dirs2} -eq 0 ]]; then + for d in "${stale_mod_dirs2[@]}"; do + unlink "$game_dir/$d" + done + fi } symlinks(){ readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)