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

Compare commits

..

No commits in common. "7d2bb7ddc5337e6527d78171fb1b955c37e120a6" and "21e9e140d197eaa9ab5be167dcfc360e4139f22f" have entirely different histories.

3 changed files with 19 additions and 76 deletions

View file

@ -1,13 +1,5 @@
# Changelog # Changelog
## [5.6.0-beta.20] 2024-12-23
### Added
- Output real and resolved mod ids to logs (temporary)
- Added -steam launch parameter
### Fixed
- Only iterate on missing symlinks
- Move logging up
## [5.6.0-beta.19] 2024-12-18 ## [5.6.0-beta.19] 2024-12-18
### Added ### Added
- Redact usernames in log files - Redact usernames in log files

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.20 version=5.6.0-beta.19
#CONSTANTS #CONSTANTS
aid=221100 aid=221100
@ -587,7 +587,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"]="5d69e8e3d7c3b3c499354b0b939ce76b" ["funcs"]="05f104fcdf27222f04046d41ec48d692"
["lan"]="c62e84ddd1457b71a85ad21da662b9af" ["lan"]="c62e84ddd1457b71a85ad21da662b9af"
) )
local author="aclist" local author="aclist"
@ -893,10 +893,10 @@ test_connection(){
if [[ $res -ne 200 ]]; then if [[ $res -ne 200 ]]; then
logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback" logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback"
remote_host=cb remote_host=cb
logger INFO "Set remote host to '${hr["codeberg.org"]}'"
res=$(get_response_code "${hr["codeberg.org"]}") res=$(get_response_code "${hr["codeberg.org"]}")
[[ $res -ne 200 ]] && raise_error_and_quit "$str (${hr["codeberg.org"]})" [[ $res -ne 200 ]] && raise_error_and_quit "$str (${hr["codeberg.org"]})"
fi fi
logger INFO "Set remote host to '${hr["codeberg.org"]}'"
if [[ $remote_host == "cb" ]]; then if [[ $remote_host == "cb" ]]; then
url_prefix="https://codeberg.org/$author/$repo/raw/branch" url_prefix="https://codeberg.org/$author/$repo/raw/branch"
releases_url="https://codeberg.org/$author/$repo/releases/download/browser" releases_url="https://codeberg.org/$author/$repo/releases/download/browser"
@ -1004,9 +1004,6 @@ main(){
uninstall && uninstall &&
exit 0 exit 0
fi fi
if [[ $1 == "--steam" ]] || [[ $1 == "-s" ]]; then
export STEAM_LAUNCH=1
fi
set_im_module set_im_module

View file

@ -29,8 +29,6 @@ prefix="dzg"
log_path="$state_path/logs" log_path="$state_path/logs"
debug_log="$log_path/DZGUI_DEBUG.log" debug_log="$log_path/DZGUI_DEBUG.log"
system_log="$log_path/DZGUI_SYSTEM.log" system_log="$log_path/DZGUI_SYSTEM.log"
mod_log="$log_path/DZGUI_MODIDS.log"
meta_log="$log_path/DZGUI_META.log"
#STATE FILES #STATE FILES
history_file="$state_path/$prefix.history" history_file="$state_path/$prefix.history"
@ -868,12 +866,12 @@ test_connection(){
if [[ $res -ne 200 ]]; then if [[ $res -ne 200 ]]; then
logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback" logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback"
remote_host=cb remote_host=cb
logger INFO "Set remote host to '${hr["codeberg.org"]}'"
res=$(get_response_code "${hr["codeberg.org"]}") res=$(get_response_code "${hr["codeberg.org"]}")
if [[ $res -ne 200 ]]; then if [[ $res -ne 200 ]]; then
return 1 return 1
fi fi
fi fi
logger INFO "Set remote host to '${hr["codeberg.org"]}'"
if [[ $remote_host == "cb" ]]; then if [[ $remote_host == "cb" ]]; then
url_prefix="https://codeberg.org/$author/$repo/raw/branch" url_prefix="https://codeberg.org/$author/$repo/raw/branch"
releases_url="https://codeberg.org/$author/$repo/releases/download/browser" releases_url="https://codeberg.org/$author/$repo/releases/download/browser"
@ -1167,12 +1165,6 @@ $(print_ip_list | sed 's/"//g')
Mods: Mods:
$(list_mods | sed 's/^/\t/g') $(list_mods | sed 's/^/\t/g')
DOC DOC
#2024-12-13
find $workshop_dir -mindepth 1 -maxdepth 1 -type d | awk -F/ '{print $NF}' | sort > "$mod_log"
find $workshop_dir -mindepth 1 -name meta.cpp | while read -r line; do
cat "$line" | awk '/publishedid/ {print $3}' | sed 's/;//g;s/\r//g'
done | sort > "$meta_log"
#END
printf "Wrote system log to %s" "$system_log" printf "Wrote system log to %s" "$system_log"
return 0 return 0
} }
@ -1228,60 +1220,22 @@ legacy_symlinks(){
fi fi
} }
symlinks(){ symlinks(){
_merge(){ readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)
comm -23 <(printf "%s\n" "${mods[@]}" | sort) <(printf "%s\n" "${targets[@]}" | sort) [[ ${#mod_dirs[@]} -eq 0 ]] && return
} logger INFO "Generating symlinks in new format"
_pulse(){ for d in "${mod_dirs[@]}"; do
zenity --pulsate --progress --auto-close --no-cancel --title="DZGUI" # suppress errors if mods are downloading at boot
} [[ ! -f "$d/meta.cpp" ]] && continue
_create_links(){ id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}')
local arr=("$@") encoded_id=$(encode "$id")
local encoded_id link="@$encoded_id"
local link if [[ -h "$game_dir/$link" ]]; then
local mod logger INFO "Symlink already exists: '$link' for mod '$id'"
for ((i=0; i<${#arr[@]}; i++)); do continue
encoded_id=$(encode "${arr[$i]}")
link="@$encoded_id"
mod="${arr[$i]}"
logger INFO "Creating link '$game_dir/$link' for '$workshop_dir/$mod'"
[[ $STEAM_LAUNCH -eq 1 ]] && echo "# Creating mod link $((i+1))/${#arr[@]}"
ln -s "$workshop_dir/$mod" "$game_dir/$link"
done
}
readarray -t mods < <(find $workshop_dir -mindepth 1 -name meta.cpp | awk -F/ 'NF=NF-1{print $NF}')
readarray -t links < <(find $game_dir -type l)
if [[ ${#mods[@]} -eq 0 ]]; then
logger INFO "No mods present, aborting"
return
fi
if [[ ${#links[@]} -eq 0 ]]; then
logger INFO "No symlinks present in '$game_dir', creating them"
if [[ $STEAM_LAUNCH -eq 1 ]]; then
_create_links "${mods[@]}" > >(_pulse)
else
_create_links "${mods[@]}"
fi fi
return ln -fs "$d" "$game_dir/$link"
fi logger INFO "Created symlink '$link' for mod '$id'"
done
readarray -t targets < <(printf "%s\n" "${links[@]}" | xargs readlink -f | awk -F/ '{print $NF}')
readarray -t hits < <(_merge)
if [[ ${#hits[@]} -eq 0 ]]; then
logger INFO "Symlinks are up to date, skipping"
return
fi
# update missing targets
logger INFO "Found ${#hits[@]} unlinked mods"
if [[ $STEAM_LAUNCH -eq 1 ]]; then
_create_links "${hits[@]}" > >(_pulse)
else
_create_links "${hits[@]}"
fi
} }
update_history(){ update_history(){
local record="$1" local record="$1"