From cbb0c50b23c2acf67c578b0e272066e60f443ba3 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 18 Jan 2023 23:51:19 +0900 Subject: [PATCH 01/65] docs: update readme link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3bc5e8..a822b9c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ## What this is -A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. +A GUI version of [DZTUI](https://github.com/aclist/dztui/tree/dztui) for Linux. DZGUI allows you to connect to both official and modded/community DayZ servers on Linux and provides a graphical interface for doing so. This overcomes certain limitations in the Linux client and helps prepare the game to launch by doing the following: From 779b894a3fa3f237ef625ad40693cd0660bb9e24 Mon Sep 17 00:00:00 2001 From: aclist Date: Thu, 19 Jan 2023 20:11:38 +0900 Subject: [PATCH 02/65] feat: support Flatpak steam --- dzgui.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 932fda6..34e9d7f 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -69,7 +69,7 @@ print_news(){ } declare -A deps -deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1" [steam]="1.0.0") +deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1") changelog(){ if [[ $branch == "stable" ]]; then md="https://raw.githubusercontent.com/aclist/dztui/dzgui/changelog.md" @@ -84,7 +84,7 @@ changelog(){ depcheck(){ for dep in "${!deps[@]}"; do - command -v $dep 2>&1>/dev/null || (printf "Requires %s >=%s\n" $dep ${deps[$dep]}; exit 1) + command -v "$dep" 2>&1>/dev/null || (printf "Requires %s >=%s\n" "$dep" ${deps[$dep]}; exit 1) done } watcher_deps(){ @@ -340,7 +340,7 @@ steam_deck_mods(){ rc=$? if [[ $rc -eq 0 ]]; then echo "[DZGUI] Opening ${workshop}$next" - steam steam://url/CommunityFilePage/$next 2>/dev/null & + "$steam_cmd" steam://url/CommunityFilePage/$next 2>/dev/null & $steamsafe_zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null else return 1 @@ -380,7 +380,7 @@ manual_mod_install(){ [[ -f $ex ]] && return 1 local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid" local workshop_dir="$steam_path/steamapps/workshop/content/$aid" - steam "steam://url/CommunityFilePage/${stage_mods[$i]}" + "$steam_cmd" "steam://url/CommunityFilePage/${stage_mods[$i]}" echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences." sleep 1s foreground @@ -467,12 +467,12 @@ auto_mod_install(){ [[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status" touch "/tmp/dz.status" console_dl "$diff" && - steam steam://open/downloads && 2>/dev/null 1>&2 + "$steam_cmd" steam://open/downloads && 2>/dev/null 1>&2 win=$(xdotool search --name "DZG Watcher") xdotool windowactivate $win until [[ -z $(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort)) ]]; do local missing=$(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort) | wc -l) - echo "# Downloaded $((${#modids[@]}-missing)) of ${#modids[@]} mods" + echo "# Downloaded $((${#modids[@]}-missing)) of ${#modids[@]} mods. ESC cancels" done | $steamsafe_zenity --pulsate --progress --title="DZG Watcher" --auto-close --no-cancel --width=500 2>/dev/null compare [[ $force_update -eq 1 ]] && { unset force_update; return; } @@ -512,6 +512,7 @@ update_stamps(){ check_timestamps(){ readarray -t local_modlist < <(ls -1 $workshop_dir) max=${#local_modlist[@]} + [[ $max -eq 0 ]] && return readarray -t stamps < <(get_local_stamps | jq -r '.response.publishedfiledetails[].time_updated') if [[ ! -f $version_file ]]; then update_stamps @@ -1065,6 +1066,8 @@ popup(){ 400) pop "Automod install enabled. Auto-downloaded mods will not appear\nin your Steam Workshop subscriptions, but DZGUI will\ntrack the version number of downloaded mods internally\nand trigger an update if necessary." ;; 500) pop "Automod install disabled.\nSwitched to manual mode." ;; 600) pop "No preferred servers set." ;; + 700) pop "Toggled to Flatpak Steam." ;; + 800) pop "Toggled to native Steam." ;; esac } toggle_console_dl(){ @@ -1091,6 +1094,17 @@ force_update_mods(){ mv /tmp/versions $version_file fi } +toggle_steam_binary(){ + case $steam_cmd in + steam) + steam_cmd=xdg-open + popup 700 + ;; + xdg-open) + steam_cmd=steam + popup 800;; + esac +} options_menu(){ case "$auto_install" in 0|1|"") auto_hr="OFF"; ;; @@ -1104,6 +1118,11 @@ options_menu(){ ) #TODO: tech debt: drop old flags [[ $auto_install -eq 2 ]] || [[ $auto_install -eq 1 ]] && debug_list+=("Force update local mods") + case $steam_cmd in + steam) steam_hr=Steam ;; + xdg-open) steam_hr=Flatpak ;; + esac + [[ $toggle_steam -eq 1 ]] && debug_list+=("Toggle native Steam or Flatpak [$steam_hr]") debug_sel=$($steamsafe_zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null) [[ -z $debug_sel ]] && return if [[ $debug_sel == "${debug_list[0]}" ]]; then @@ -1125,6 +1144,8 @@ options_menu(){ force_update_mods merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title=DZGUI --width=500 2>/dev/null) auto_mod_install + elif [[ $debug_sel == "${debug_list[5]}" ]]; then + toggle_steam_binary fi } query_and_connect(){ @@ -1747,10 +1768,27 @@ fetch_helpers(){ mkdir -p "$helpers_path" [[ ! -f "$helpers_path/vdf2json.py" ]] && curl -Ls "$vdf2json_url" > "$helpers_path/vdf2json.py" } +steam_deps(){ + local flatpak steam + flatpak=$(flatpak run com.valvesoftware.Steam --version 2>/dev/null) + steam=$(command -v steam) + if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then + warn "Requires Steam or Flatpak Steam" + exit + elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then + toggle_steam=1 + steam_cmd="steam" + elif [[ -n "$steam" ]]; then + steam_cmd="steam" + else + steam_cmd="xdg-open" + fi +} initial_setup(){ echo "# Initial setup" run_depcheck watcher_deps + steam_deps check_architecture check_version check_map_count From 15bd9b398f9ca43b5ec16b5153cb82cf5288f337 Mon Sep 17 00:00:00 2001 From: aclist Date: Thu, 19 Jan 2023 23:42:19 +0900 Subject: [PATCH 03/65] feat: Add Flatpak support --- changelog.md | 4 ++++ dzgui.sh | 29 +++++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index 21666e6..8b3d488 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Custom query API - Store favorites by IP +## [3.2.0] 2023-01-19 +### Added +- Support Flatpak version of Steam + ## [3.1.8] 2023-01-18 ### Fixed - Progress window blocking rest of window stack diff --git a/dzgui.sh b/dzgui.sh index 34e9d7f..69a1432 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.1.8 +version=3.2.0 aid=221100 game="dayz" @@ -340,7 +340,7 @@ steam_deck_mods(){ rc=$? if [[ $rc -eq 0 ]]; then echo "[DZGUI] Opening ${workshop}$next" - "$steam_cmd" steam://url/CommunityFilePage/$next 2>/dev/null & + "$sbp_cmd" steam://url/CommunityFilePage/$next 2>/dev/null & $steamsafe_zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null else return 1 @@ -380,7 +380,7 @@ manual_mod_install(){ [[ -f $ex ]] && return 1 local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid" local workshop_dir="$steam_path/steamapps/workshop/content/$aid" - "$steam_cmd" "steam://url/CommunityFilePage/${stage_mods[$i]}" + "$sbp_cmd" "steam://url/CommunityFilePage/${stage_mods[$i]}" echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences." sleep 1s foreground @@ -467,7 +467,7 @@ auto_mod_install(){ [[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status" touch "/tmp/dz.status" console_dl "$diff" && - "$steam_cmd" steam://open/downloads && 2>/dev/null 1>&2 + "$sbp_cmd" steam://open/downloads && 2>/dev/null 1>&2 win=$(xdotool search --name "DZG Watcher") xdotool windowactivate $win until [[ -z $(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort)) ]]; do @@ -830,7 +830,7 @@ concat_mods(){ launch(){ mods=$(concat_mods) if [[ $debug -eq 1 ]]; then - launch_options="steam -applaunch $aid -connect=$ip -nolauncher -nosplash -name=$name -skipintro \"-mod=$mods\"" + launch_options="$steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -name=$name -skipintro \"-mod=$mods\"" print_launch_options="$(printf "This is a dry run.\nThese options would have been used to launch the game:\n\n$launch_options\n" | fold -w 60)" $steamsafe_zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\ --text="$print_launch_options" 2>/dev/null @@ -845,7 +845,7 @@ launch(){ else echo "[DZGUI] All OK. Launching DayZ" $steamsafe_zenity --width 500 --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null - steam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\" + $steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\" exit fi one_shot_launch=0 @@ -1095,13 +1095,15 @@ force_update_mods(){ fi } toggle_steam_binary(){ - case $steam_cmd in + case $sbp_cmd in steam) - steam_cmd=xdg-open + sbp_cmd="xdg-open" + steam_cmd="flatpak run com.valvesoftware.Steam" popup 700 ;; xdg-open) - steam_cmd=steam + sbp_cmd="steam" + steam_cmd="steam" popup 800;; esac } @@ -1118,7 +1120,7 @@ options_menu(){ ) #TODO: tech debt: drop old flags [[ $auto_install -eq 2 ]] || [[ $auto_install -eq 1 ]] && debug_list+=("Force update local mods") - case $steam_cmd in + case $sbp_cmd in steam) steam_hr=Steam ;; xdg-open) steam_hr=Flatpak ;; esac @@ -1770,18 +1772,21 @@ fetch_helpers(){ } steam_deps(){ local flatpak steam - flatpak=$(flatpak run com.valvesoftware.Steam --version 2>/dev/null) + flatpak=$(flatpak list | grep valvesoftware.Steam) steam=$(command -v steam) if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then warn "Requires Steam or Flatpak Steam" exit elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then toggle_steam=1 + sbp_cmd="steam" steam_cmd="steam" elif [[ -n "$steam" ]]; then + sbp_cmd="steam" steam_cmd="steam" else - steam_cmd="xdg-open" + sbp_cmd="xdg-open" + steam_cmd="flatpak run com.valvesoftware.Steam" fi } initial_setup(){ From 4e0bb3cc3ff85562e573ef194aa2fd7b39008d8f Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 20 Jan 2023 02:05:11 +0900 Subject: [PATCH 04/65] fix: flatpak hotfixes --- dzgui.sh | 83 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 69a1432..d407dd3 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.0 +version=3.2.1 aid=221100 game="dayz" @@ -194,6 +194,9 @@ staging_dir="$staging_dir" #Path to default Steam client default_steam_path="$default_steam_path" + +#Preferred Steam launch command (for Flatpak support) +preferred_client="$preferred_client" END } write_desktop_file(){ @@ -340,7 +343,7 @@ steam_deck_mods(){ rc=$? if [[ $rc -eq 0 ]]; then echo "[DZGUI] Opening ${workshop}$next" - "$sbp_cmd" steam://url/CommunityFilePage/$next 2>/dev/null & + "$steam_cmd" steam://url/CommunityFilePage/$next 2>/dev/null & $steamsafe_zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null else return 1 @@ -380,7 +383,7 @@ manual_mod_install(){ [[ -f $ex ]] && return 1 local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid" local workshop_dir="$steam_path/steamapps/workshop/content/$aid" - "$sbp_cmd" "steam://url/CommunityFilePage/${stage_mods[$i]}" + "$steam_cmd" "steam://url/CommunityFilePage/${stage_mods[$i]}" echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences." sleep 1s foreground @@ -467,7 +470,7 @@ auto_mod_install(){ [[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status" touch "/tmp/dz.status" console_dl "$diff" && - "$sbp_cmd" steam://open/downloads && 2>/dev/null 1>&2 + "$steam_cmd" steam://open/downloads && 2>/dev/null 1>&2 win=$(xdotool search --name "DZG Watcher") xdotool windowactivate $win until [[ -z $(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort)) ]]; do @@ -1095,15 +1098,15 @@ force_update_mods(){ fi } toggle_steam_binary(){ - case $sbp_cmd in + case "$steam_cmd" in steam) - sbp_cmd="xdg-open" steam_cmd="flatpak run com.valvesoftware.Steam" + update_steam_cmd popup 700 ;; - xdg-open) - sbp_cmd="steam" + flatpak*) steam_cmd="steam" + update_steam_cmd popup 800;; esac } @@ -1120,35 +1123,36 @@ options_menu(){ ) #TODO: tech debt: drop old flags [[ $auto_install -eq 2 ]] || [[ $auto_install -eq 1 ]] && debug_list+=("Force update local mods") - case $sbp_cmd in + case "$steam_cmd" in steam) steam_hr=Steam ;; - xdg-open) steam_hr=Flatpak ;; + flatpak*) steam_hr=Flatpak ;; esac [[ $toggle_steam -eq 1 ]] && debug_list+=("Toggle native Steam or Flatpak [$steam_hr]") debug_sel=$($steamsafe_zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null) [[ -z $debug_sel ]] && return - if [[ $debug_sel == "${debug_list[0]}" ]]; then - enforce_dl=1 - toggle_branch && - check_version - elif [[ $debug_sel == "${debug_list[1]}" ]]; then - toggle_debug - elif [[ $debug_sel == "${debug_list[2]}" ]]; then - source_script=$(realpath "$0") - source_dir=$(dirname "$source_script") - generate_log > "$source_dir/DZGUI.log" - printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir" - $steamsafe_zenity --info --width 500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null - elif [[ $debug_sel == "${debug_list[3]}" ]]; then - toggle_console_dl - elif [[ $debug_sel == "${debug_list[4]}" ]]; then - force_update=1 - force_update_mods - merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title=DZGUI --width=500 2>/dev/null) - auto_mod_install - elif [[ $debug_sel == "${debug_list[5]}" ]]; then - toggle_steam_binary - fi + case "$debug_sel" in + "Toggle branch") + enforce_dl=1 + toggle_branch && + check_version + ;; + "Toggle debug mode") toggle_debug ;; + "Generate debug log") + source_script=$(realpath "$0") + source_dir=$(dirname "$source_script") + generate_log > "$source_dir/DZGUI.log" + printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir" + $steamsafe_zenity --info --width 500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null + ;; + Toggle[[:space:]]auto*) toggle_console_dl ;; + "Force update local mods") + force_update=1 + force_update_mods + merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title=DZGUI --width=500 2>/dev/null) + auto_mod_install + ;; + Toggle[[:space:]]native*) toggle_steam_binary ;; + esac } query_and_connect(){ [[ -z $whitelist ]] && { popup 600; return; } @@ -1770,6 +1774,14 @@ fetch_helpers(){ mkdir -p "$helpers_path" [[ ! -f "$helpers_path/vdf2json.py" ]] && curl -Ls "$vdf2json_url" > "$helpers_path/vdf2json.py" } +update_steam_cmd(){ + local new_cmd + preferred_client="$steam_cmd" + new_cmd="preferred_client=\"$preferred_client\"" + mv $config_file ${config_path}dztuirc.old + nr=$(awk '/preferred_client=/ {print NR}' ${config_path}dztuirc.old) + awk -v "var=$new_cmd" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc +} steam_deps(){ local flatpak steam flatpak=$(flatpak list | grep valvesoftware.Steam) @@ -1779,13 +1791,12 @@ steam_deps(){ exit elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then toggle_steam=1 - sbp_cmd="steam" steam_cmd="steam" + [[ -n $preferred_client ]] && steam_cmd="$preferred_client" + [[ -z $preferred_client ]] && update_steam_cmd elif [[ -n "$steam" ]]; then - sbp_cmd="steam" steam_cmd="steam" else - sbp_cmd="xdg-open" steam_cmd="flatpak run com.valvesoftware.Steam" fi } @@ -1793,12 +1804,12 @@ initial_setup(){ echo "# Initial setup" run_depcheck watcher_deps - steam_deps check_architecture check_version check_map_count fetch_helpers config + steam_deps run_varcheck stale_symlinks init_items From 8b19f6340b6761c98cc771e9ef03ed60000683d5 Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 20 Jan 2023 02:21:31 +0900 Subject: [PATCH 05/65] fix: flatpak hotfixes --- dzgui.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index d407dd3..d5efbde 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.1 +version=3.2.2 aid=221100 game="dayz" @@ -343,7 +343,7 @@ steam_deck_mods(){ rc=$? if [[ $rc -eq 0 ]]; then echo "[DZGUI] Opening ${workshop}$next" - "$steam_cmd" steam://url/CommunityFilePage/$next 2>/dev/null & + $steam_cmd steam://url/CommunityFilePage/$next 2>/dev/null & $steamsafe_zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null else return 1 @@ -383,7 +383,7 @@ manual_mod_install(){ [[ -f $ex ]] && return 1 local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid" local workshop_dir="$steam_path/steamapps/workshop/content/$aid" - "$steam_cmd" "steam://url/CommunityFilePage/${stage_mods[$i]}" + $steam_cmd "steam://url/CommunityFilePage/${stage_mods[$i]}" echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences." sleep 1s foreground @@ -470,7 +470,7 @@ auto_mod_install(){ [[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status" touch "/tmp/dz.status" console_dl "$diff" && - "$steam_cmd" steam://open/downloads && 2>/dev/null 1>&2 + $steam_cmd steam://open/downloads && 2>/dev/null 1>&2 win=$(xdotool search --name "DZG Watcher") xdotool windowactivate $win until [[ -z $(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort)) ]]; do From 82c6dbdfef223653f81136276f51ffa5222e8403 Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 24 Jan 2023 04:35:39 +0900 Subject: [PATCH 06/65] docs: add nix setup instructions --- dzgui.adoc | 21 +- dzgui.html | 1338 ---------------------------------------------------- 2 files changed, 15 insertions(+), 1344 deletions(-) delete mode 100644 dzgui.html diff --git a/dzgui.adoc b/dzgui.adoc index 81bd188..f77cb25 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -25,21 +25,30 @@ If any dependencies are missing when the application starts, it will warn you, s - `wmctrl` or `xdotool` === Preparation -. Download DZGUI and make it executable: +. **Download DZGUI and make it executable:** -**Automatic method (skip to 3 below when complete)** +Automatic method: generic OS (skip to step 3 below when complete) ``` curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash ``` -**Manual method** +Automatic method: nix-based systems (contributed by lelgenio) + +Follow the instructions at https://github.com/lelgenio/dzgui-nix to ingest the package and dependencies +into your system using flakes. + +Manual method ``` +git clone https://github.com/aclist/dztui.git chmod +x dzgui.sh ``` + +''' [start=2] -. Update the `vm.max_map_count` value (see https://www.protondb.com/app/221100) +. **Update the `vm.max_map_count` value (see https://www.protondb.com/app/221100)** + This is handled automatically by DZGUI if you just choose to run the application out of the box. Ephemeral method: @@ -56,8 +65,8 @@ echo 'vm.max_map_count=1048576' | sudo tee /etc/sysctl.d/dayz.conf If it detects an incorrect map count value, DZGUI will prompt you to permanently update the map count value when starting up. [start=3] -. Steam account with DayZ license -. Enable a Proton version ≥ `6.8` (or use Experimental) in the **Compatibility** field of the game's right-click options. +. **Prepare a Steam account with a DayZ license** +. **Enable a Proton version ≥ `6.8` (or use Experimental) in the `Compatibility` field of the game's right-click options.** === API key & server IDs diff --git a/dzgui.html b/dzgui.html deleted file mode 100644 index e002b7a..0000000 --- a/dzgui.html +++ /dev/null @@ -1,1338 +0,0 @@ - - - - - - - - -DZGUI documentation - - - - -
-
-

What this is

-
-
-

A GUI version of DZTUI for Linux. Used to list official and community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically.

-
-
-

DZGUI contains some expanded functionality that will eventually be backported to DZTUI. It is intended to be more of a user-friendly, turnkey solution for graphical desktop environments, and could also be used on the Steam Deck or similar devices.

-
-
-
-
-

Setup

-
-
-

Dependencies

-
-

If not already installed, the below can be found in your system’s package manager. -With the exception of Steam (which presumably you already have), in 99% of cases, -the other utilities should ship out of the box with mainstream distributions. They are provided here merely as a reference.

-
-
-

If any dependencies are missing when the application starts, it will warn you, so you need not take any preemptive measures here.

-
-
-
    -
  • -

    curl

    -
  • -
  • -

    jq

    -
  • -
  • -

    zenity

    -
  • -
  • -

    steam

    -
  • -
  • -

    wmctrl or xdotool

    -
  • -
-
-
-
-

Preparation

-
-
    -
  1. -

    Download DZGUI and make it executable:

    -
  2. -
-
-
-

Automatic method (skip to 3 below when complete)

-
-
-
-
curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash
-
-
-
-

Manual method

-
-
-
-
chmod +x dzgui.sh
-
-
-
-
    -
  1. -

    Update the vm.max_map_count value (see https://www.protondb.com/app/221100) -This is handled automatically by DZGUI if you just choose to run the application out of the box.

    -
  2. -
-
-
-

Ephemeral method:

-
-
-
-
sudo sysctl -w vm.max_map_count=1048576
-
-
-
-

Persistent method:

-
-
-
-
echo 'vm.max_map_count=1048576' | sudo tee /etc/sysctl.d/dayz.conf
-
-
-
- - - - - -
-
Note
-
-If it detects an incorrect map count value, DZGUI will prompt you to permanently update the map count value when starting up. -
-
-
-
    -
  1. -

    Steam account with DayZ license

    -
  2. -
  3. -

    Enable a Proton version ≥ 6.8 (or use Experimental) in the Compatibility field of the game’s right-click options.

    -
  4. -
-
-
-
-

API key & server IDs

-
-

BattleMetrics API key

-
-
    -
  1. -

    Register for an API key at BattleMetrics (free)

    -
  2. -
  3. -

    From the Personal Access Tokens area, Select New Token

    -
  4. -
  5. -

    Give the token any name in the field at the top

    -
  6. -
  7. -

    Leave all options unchecked and scroll to the bottom, select Create Token

    -
  8. -
  9. -

    Copy the access token for later use (see below). This is the unique token you will use to query servers.

    -
  10. -
  11. -

    Use the DayZ server browser to find servers of interest (proximity, player count, rules, etc.)

    -
  12. -
  13. -

    Each server has a unique ID. This is the string of numbers at the end of the URL. Copy these IDs. For example, in the URL https://www.battlemetrics.com/servers/dayz/8039514, the ID is 8039514.

    -
  14. -
-
-
- - - - - -
-
Note
-
-You will be prompted to enter these IDs when starting the app, so you could refer to them in another window while you complete setup. More IDs can be added later. -
-
-
-
-

Steam API key

-
-
    -
  1. -

    Register for a Steam API key using your Steam account. You will be asked for a unique URL for your app when registering.

    -
  2. -
  3. -

    Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1".

    -
  4. -
  5. -

    Once configured, you can insert this key in the app when launching the "Connect by IP" feature for the first time.

    -
  6. -
-
-
-
-
-

First-time launch

-
-
    -
  1. -

    DZGUI can be launched one of two ways.

    -
  2. -
-
-
-

From the terminal:

-
-
-
-
./dzgui.sh
-
-
-
-

Launching from the terminal gives more verbose information, and can be a good way of troubleshooting problems.

-
-
-

From the shortcut shipped with the application:

-
-
-

*If using a desktop environment based on the Freedesktop specification

-
-
-
    -
  • -

    Located under the "Games" category of your system’s applications list.

    -
  • -
  • -

    Via the DZGUI desktop shortcut (Steam Deck only)

    -
  • -
-
-
-
    -
  1. -

    Follow the menu prompts given by the app. You will be asked to provide:

    -
    -
      -
    • -

      API key (see above)

      -
    • -
    • -

      Player name (a generic handle, required by some servers)

      -
    • -
    • -

      At least one server ID

      -
    • -
    -
    -
  2. -
-
-
-

DZGUI will then attempt to locate your default Steam installation and DayZ path. If it detects multiple paths, you will be given a list to choose from.

-
-
- - - - - -
-
Note
-
-If the path was not detected correctly, you can manually edit the config file at $HOME/.config/dztui/dztuirc. -
-
-
-
-

Steam integration & artwork

-
-

Adding to steam

-
-

DZGUI can be added to Steam as a "non-Steam game" in order to facilitate integration with Steam Deck or desktop environments.

-
-
-
    -
  1. -

    Launch Steam in the "Large" view.

    -
  2. -
-
-
- - - - - -
-
Note
-
-Steam Deck: you must switch to "Desktop Mode" and launch Steam from the desktop. -
-
-
-
    -
  1. -

    Select Add a Game > Add a Non-Steam Game from the lower left-hand corner.

    -
  2. -
-
-
-
-01 -
-
-
-
    -
  1. -

    Navigate to $HOME/.local/share/applications/ and select dzgui.desktop

    -
  2. -
  3. -

    Select Add Selected Programs.

    -
  4. -
-
-
-
-

Controller layout

-
-

An official controller layout for Steam Deck is available in the Steam community layouts section. Search for "DZGUI Official Config" to download it. Long-press the View button and Select button (☰) to toggle D-pad navigation. This creates an additional layer that lets you navigate through menus using the D-pad and A/B to respectively confirm selections and go back. Remember to toggle this layer off again after launching your game to revert back to the master layer.

-
-
-
-

Artwork

-
-

The application also ships with Steam cover artwork. It is located under:

-
-
-
-
$HOME/.local/share/dzgui
-
-
-
-

The artwork consists of four parts:

-
-
-
    -
  1. -

    Grid: a vertical "box art" grid used on library pages

    -
  2. -
  3. -

    Hero: a large horizontal banner used on the app’s details page

    -
  4. -
  5. -

    Logo: a transparent icon used to remove Steam’s default app text

    -
  6. -
  7. -

    dzgui: used by freedesktop shortcut to generate a desktop icon; not intended for the user

    -
  8. -
-
-
-

Updating the artwork:

-
-
-
    -
  1. -

    Navigate to the app’s details page and right-click the blank image header at the top.

    -
  2. -
-
-
-
-03 -
-
-
-
    -
  1. -

    Select Set Custom Background

    -
  2. -
  3. -

    Select to display All Files from the File type dropdown

    -
  4. -
  5. -

    Navigate to the artwork path described above and select hero.png.

    -
  6. -
  7. -

    Next, right-click the image background and select Set Custom Logo.

    -
  8. -
-
-
-
-04 -
-
-
-
    -
  1. -

    Navigate to the same path and select logo.png. Notice that this removes the redundant app name that occluded the image.

    -
  2. -
-
-
-
-05 -
-
-
-
    -
  1. -

    Next, navigate to your Library index (looks like a bookshelf of cover art) and find the DZGUI app.

    -
  2. -
-
-
-
    -
  1. -

    Right-click its cover and select Manage > Set custom artwork.

    -
  2. -
-
-
-
-06 -
-
-
-
    -
  1. -

    Navigate to the same path and select grid.png. The final result:

    -
  2. -
-
-
-
-07 -
-
-
-
-
-

Updating the app

-
-

If DZGUI detects a new upstream version, it will prompt you to download it automatically. It backs up the original version before fetching the new one, then updates your config file with your existing values. Once finished, it will ask you to relaunch the app.

-
-
-

If you decline to upgrade to the new version, DZGUI will continue to the main menu with the current version.

-
-
- - - - - -
-
Note
-
-New versions may include changes to bugs that could prevent you from playing on certain servers. Upgrading is always advised. -
-
-
-

If you experience a problem or need to restore the prior version of DZGUI and/or your configs, it is enough to simply replace the new version with the old one and relaunch the app. The files can be found at:

-
-
-

Script:

-
-
-
-
<path to script><script name>.old
-
-
-
-

E.g., if DZGUI is named dzgui, in the path $HOME/bin, it will be located at

-
-
-
-
$HOME/bin/dzgui.old
-
-
-
-

If launching DZGUI via its system shortcut, the backup file (similarly for log files) will be located under:

-
-
-
-
$HOME/.local/share/dzgui
-
-
-
-

Backup config files:

-
-
-
-
$HOME/.config/dztui/dztuirc.old
-
-
-
-
-
-
-

Usage

-
-
-

Select My servers to fetch details for the server IDs you provided. Select the server you wish to connect to and click OK.

-
-
-

DZGUI will check the server’s modset against your local mods. If you are missing any, it will prompt you to download them through the Steam Workshop and open a window in the background in the system browser.

-
-
-

Open each link and click Subscribe to schedule these for download.

-
-
- - - - - -
-
Note
-
-You must be logged into Steam for mod change to take effect. It can take some time for the subscribed mods to download and update. You can continue clicking Next to regenerate the list, or wait for all of them to complete. -
-
-
-

Once all of the mods are downloaded and staged, DZGUI will notify you that it is ready to connect. The app hands the launch parameters to Steam and exits.

-
-
-
-
-

Menu options

-
-
-

Server browser

-
-

The server browser retrieves and lists all publicly broadcasting servers (including official ones) in a table. -These servers can be filtered by various parameters in order to display a more granular result.

-
-
-

After a server is selected from the list, the application continues to the mod validation step.

-
-
-

In order to use this feature, you must have a Steam API key. You will be asked for a unique URL for your app when registering. -Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1".

-
-
-

You will be prompted to insert this key into the app when launching the server browser for the first time.

-
-
- - - - - -
-
Note
-
-It is not currently possible to save servers from the full server browser. -
-
-
-
Filters
-
-

The server browser exposes the following filters. These options can be combined.

-
-
-

Untick filters to exclude those matches from the returned results. The "All maps" and "Keyword search" filters have special behavior (see below). -You must have a minimum of one filter active to return any results.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilterUsage

All maps

Return all available map types being served. -Note: disabling this option will present a list from which you can select one specific map type (e.g., namalsk)

Daytime

Include servers with gametime between 0600 and 1659

Nighttime

Include servers with gametime between 1700 and 0559

Empty

Include servers with 0 current players

Full

Include servers at maximum capacity

Low population

Include servers with fewer than 10 players online

Non-ASCII titles

Include servers with special symbols, Unicode, or text in the title. -Note: disabling this filter will also exclude CJK languages, Cyrillic, and other special character sets.

Keyword

Select this option to filter by server titles matching a specific word or phrase (case insensitive)

-
-
-
Table details
-
-

After retrieval, the browser presents a table of results with the following parameters. -Due to the density of information, the table will try to render at a minimum of 1920x1080 on a desktop or at fullscreen on a Steam Deck.

-
-
-
    -
  • -

    Total matches/total servers queried

    -
  • -
  • -

    Total players online on all servers

    -
  • -
  • -

    Map name

    -
  • -
  • -

    Server title

    -
  • -
  • -

    Gametime: the in-game time

    -
  • -
  • -

    Players: this is zero-padded for sorting purposes

    -
  • -
  • -

    Max players: this is zero-padded for sorting purposes

    -
  • -
  • -

    Distance: the physical distance to the server in kilometers is calculated by geolocation

    -
  • -
  • -

    IP: the IP address and port

    -
  • -
  • -

    Qport: the query port used to retrieve metadata and rules

    -
  • -
-
-
-
-
-

My servers

-
-

Fetches detailed server information on the list of servers saved in the config file. This is the main place you interact with DZGUI when choosing a server from your list. These details are:

-
-
-
    -
  • -

    Server: name of the server, truncated to 50 chars

    -
  • -
  • -

    IP/port: IP address and port in the format ip:port

    -
  • -
  • -

    Players: online players, in the format current/max

    -
  • -
  • -

    Gametime: in-game time on the 24-hour clock

    -
  • -
  • -

    Status: whether the server is online or not

    -
  • -
  • -

    ID: numerical ID from BattleMetrics, used as a reference when troubleshooting or sharing servers

    -
  • -
  • -

    Ping: round-trip response time from the server

    -
  • -
-
-
-
-

Quick connect to favorite server

-
-

Bypasses the server list and quick-connects to a single favorite server specified in advance using the Add favorite server option.

-
-
-
-

Connect by IP

-
-

Instead of relying on server IDs, returns the list of maps behind a given IP. Provide only the IP; no port is necessary. This returns the server metadata for you to verify before connecting.

-
-
-

If there are multiple maps hosted behind an IP (e.g. different maps on varying ports), the application will list all of them.

-
-
-

In order to use this feature, you must have a Steam API key. You will be asked for a unique URL for your app when registering. -Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1".

-
-
-

You will be prompted to insert this key into the app when launching the "Connect by IP" feature for the first time.

-
-
-
-

Add server by ID

-
-

Prompts you to add servers to the config file by ID. An indefinite number of servers can be added. These will be listed when using the [Launch server list] option.

-
-
-
-

Add favorite server

-
-

Prompts you to add/change a favorite server to the config file by ID. The name of the server will be updated in the header of the app. This server is used when selecting the Quick connect to favorite server option. If a favorite server is already enabled, this option switches to "Change favorite server."

-
-
-
-

Delete server

-
-

Prints a list of human-readable servers currently saved, and lets you delete them by selecting one from the list.

-
-
-
-

List installed mods

-
-

Prints a scrollable dialog containing all locally-installed mods and their corresponding symlinks IDs.

-
-
-
-

Toggle debug mode

-
-

Toggles debug mode, which is used to perform dry-runs and output what parameters would have been used to connect to a server. Enabling debug mode also exposes the Debug options menu, which contains some settings for advanced use.

-
-
-
-

Report bug

-
-

Using the system browser, opens the project’s GitHub issues page to submit a report.

-
-
-
-

Help file

-
-

Using the system browser, opens this document.

-
-
-
-

View changelog

-
-

Prints the entire changelog up to the current version (and unreleased changes) in-app.

-
-
-
-

Debug options

-
-

If enabled, this menu contains a sub-menu with various advanced features, enumerated below.

-
-
-
Toggle branch
-
-

Used to toggle the branch to fetch DZGUI from between stable and testing. The app ships with the stable branch enabled, with the testing branch being used to elaborate various experimental features.

-
-
-
-
Generate debug log
-
-

Writes a list of your current settings to a local file that can be pasted into bug reports.

-
-
-
-
-
-
-

Config file key/value pairs

-
-
-

Under normal usage, these values are populated and toggled automatically in-app. This config file is partially compatible DZTUI.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValue

api_key

the API key generated at BattleMetrics. See Setup

whitelist

comma-separated list of server IDs from BattleMetrics; integer-values only

fav

server to display in the Fav field and to quick-connect to (must be one only); integer-values only

name

an arbitrary "handle" name used to identify the player on a server (required by some servers)

debug

by default, set to 0; set to 1 to print launch options that would have been run, instead of actually connecting (used for troubleshooting and submitting bug reports)

branch

by default, set to stable; set to testing to fetch the testing branch

seen_news

stores a hash of the news item last seen by the client. This is used to suppress news messages until a new one is posted.

-
-
-
-

Troubleshooting/FAQ

-
-
-
Mods take a long time to synchronize when subscribing from Workshop
-

Steam schedules the downloads in the background and processes them as they are subscribed to. This process is not instantaneous and can take some time. Check the Downloads pane of Steam to see live progress.

-
-
-
Game does not launch through Steam
-

Check the logs emitted by Steam in the terminal, or in <steam path>/error.log.

-
-
-
Game launches, but throws a "mod missing/check PBO file" error when connecting
-

In rare cases, the server may be using misconfigured, malformed, or obsolete mods. This is out of our control and depends on server operators checking their mods for integrity. If you believe the mods are correct and this is a bug, please report it.

-
-
-
Game and server launches, but when joining the game world, an error occurs
-

A mod is corrupted or the issue lies with the server. Replace the mods in question and reconnect.

-
-
-
-
-

Testers wanted

-
-
-

If any of the below apply to you, your reports are encouraged:

-
-
-
    -
  • -

    Using a high resolution (4K) monitor

    -
  • -
  • -

    Own a Steam Deck

    -
  • -
  • -

    Seeking DZTUI functionality in DZGUI, or vice versa

    -
  • -
  • -

    Playing on a server with an enormous amount of mods

    -
  • -
  • -

    Playing on a server with non-English mod names (?)

    -
  • -
-
-
-
-
- - \ No newline at end of file From f1c1d65c28127704113193d6c0a59a2b4f9a1d57 Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 17 Feb 2023 13:35:37 +0900 Subject: [PATCH 07/65] fix: map count fixes --- changelog.md | 6 ++++++ dzgui.sh | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 8b3d488..63afeb8 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,12 @@ - Custom query API - Store favorites by IP +## [3.2.3] 2023-02-17 +### Fixed +- sysctl map count value not being loaded immediately after setting +- Application terminating when user declines to update map count value +- Erroneous stderror output when flatpak is not installed + ## [3.2.0] 2023-01-19 ### Added - Support Flatpak version of Steam diff --git a/dzgui.sh b/dzgui.sh index d5efbde..2ac3a43 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.2 +version=3.2.3 aid=221100 game="dayz" @@ -1719,13 +1719,11 @@ check_map_count(){ count=1048576 echo "[DZGUI] Checking system map count" if [[ $(sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then - echo "100" - map_warning=$($steamsafe_zenity --question --width 500 --title="DZGUI" --text "System map count must be $count or higher to run DayZ with Wine. Increase map count and make this change permanent? (will prompt for sudo password)" 2>/dev/null) + $steamsafe_zenity --question --width 500 --title="DZGUI" --text "System map count must be $count or higher to run DayZ with Wine.\nIncrease map count and make this change permanent? (will prompt for sudo password)" 2>/dev/null if [[ $? -eq 0 ]]; then pass=$($steamsafe_zenity --password) sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" - echo "" - + sudo sysctl -p /etc/sysctl.d/dayz.conf fi fi } @@ -1784,7 +1782,7 @@ update_steam_cmd(){ } steam_deps(){ local flatpak steam - flatpak=$(flatpak list | grep valvesoftware.Steam) + [[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam) steam=$(command -v steam) if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then warn "Requires Steam or Flatpak Steam" From ac57770d875ff972604df03cd17b4684256b3ec2 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 22 Feb 2023 15:57:04 +0900 Subject: [PATCH 08/65] fix: wrong query port being returned --- dzgui.sh | 70 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 2ac3a43..8f981d7 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -682,7 +682,7 @@ history_table(){ ip_table(){ while true; do - sel=$(prepare_ip_list "$meta_file" | $steamsafe_zenity --width 1200 --height 800 --list --column=Name --column=IP --column=Players --column=Gametime --print-column=2 --separator=%% 2>/dev/null) + sel=$(prepare_ip_list "$meta_file" | $steamsafe_zenity --width 1200 --height 800 --text="Multiple maps found at this server. Select map from the list below" --title="DZGUI" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2 --separator=%% 2>/dev/null) if [[ $? -eq 1 ]]; then return_from_table=1 return @@ -701,20 +701,13 @@ ip_table(){ done } fetch_ip_metadata(){ - local meta_file=$(mktemp) + meta_file=$(mktemp) source $config_file url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api" curl -Ls "$url" > $meta_file json=$(mktemp) < $meta_file jq '.response' > $json res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null) - if [[ ! $? -eq 0 ]]; then - warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again." - echo "[DZGUI] 96: Failed to retrieve IP metadata" - - else - ip_table - fi } #TODO: local servers @@ -773,6 +766,12 @@ connect_by_ip(){ [[ $? -eq 1 ]] && return if validate_ip "$ip"; then fetch_ip_metadata + if [[ ! $? -eq 0 ]]; then + warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again." + echo "[DZGUI] 96: Failed to retrieve IP metadata" + else + ip_table + fi else continue fi @@ -901,27 +900,37 @@ delete_by_id(){ source $config_file } delete_or_connect(){ - if [[ $delete -eq 1 ]]; then - server_name=$(echo "$sel" | awk -F"%%" '{print $1}') - server_id=$(echo "$sel" | awk -F"%%" '{print $2}') - $steamsafe_zenity --question --text="Delete this server? \n$server_name" --title=DZGUI --width=500 2>/dev/null - if [[ $? -eq 0 ]]; then - delete_by_id $server_id - fi - source $config_file - unset delete - else - #hotfix for bug #36 - local lookup_ip=$(echo "$sel" | awk -F%% '{print $1}') - local lookup_port=$(echo "$lookup_ip" | awk -F: '{print $2}') - source $config_file - url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$lookup_ip&key=$steam_api" - local qport_res=$(curl -Ls "$url" | jq -r --arg port $lookup_port '.response.servers[]|select(.gameport==($port|tonumber)).addr') - local qport=$(echo "$qport_res" | awk -F: '{print $2}') - qport_list="$lookup_ip%%$qport" - connect "$qport_list" "ip" - + if [[ $delete -eq 1 ]]; then + server_name=$(echo "$sel" | awk -F"%%" '{print $1}') + server_id=$(echo "$sel" | awk -F"%%" '{print $2}') + $steamsafe_zenity --question --text="Delete this server? \n$server_name" --title=DZGUI --width=500 2>/dev/null + if [[ $? -eq 0 ]]; then + delete_by_id $server_id fi + source $config_file + unset delete + else + local lookup_ip=$(echo "$sel" | awk -F: '{print $1}') + ip=$lookup_ip + fetch_ip_metadata + if [[ ! $? -eq 0 ]]; then + warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again." + echo "[DZGUI] 96: Failed to retrieve IP metadata" + else + local jad=$(echo "$res" | jq -r '.addr') + if [[ $(<<< "$jad" wc -l ) -gt 1 ]]; then + ip_table + elif [[ $(<<< "$jad" wc -l ) -eq 1 ]]; then + local gameport="$(echo "$res" | jq -r '.gameport')" + local ip="$(echo "$jad" | awk -F: '{print $1}')" + local qport=$(echo "$jad" | awk -F: '{print $2}') + local sa_ip=$(echo "$ip:$gameport%%$qport") + qport_list="$sa_ip" + local sel="$ip:$gameport%%$qport" + connect "$sel" "ip" + fi + fi + fi } populate(){ while true; do @@ -1444,9 +1453,6 @@ mods_disk_size(){ main_menu(){ print_news set_mode -# if [[ -n $fav ]]; then -# items[8]=" Change favorite server" -# fi while true; do set_header ${FUNCNAME[0]} rc=$? From b66e808c148b9ea34dd075eb9729783803cbe11f Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 1 Mar 2023 17:36:46 +0900 Subject: [PATCH 09/65] fix: hotfix for #59 --- changelog.md | 4 ++++ dzgui.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 63afeb8..ee74a1d 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Custom query API - Store favorites by IP +## [3.2.4] 2023-03-01 +### Fixed +- BM API returning stale query port and preventing fetching modlist + ## [3.2.3] 2023-02-17 ### Fixed - sysctl map count value not being loaded immediately after setting diff --git a/dzgui.sh b/dzgui.sh index 8f981d7..d8a895b 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.3 +version=3.2.4 aid=221100 game="dayz" From 435c2757257fc89c45e7c89de8173d045c042686 Mon Sep 17 00:00:00 2001 From: aclist Date: Sun, 7 May 2023 04:40:26 +0900 Subject: [PATCH 10/65] fix: fix for #61 --- changelog.md | 4 ++++ dzgui.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index ee74a1d..30b1190 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Custom query API - Store favorites by IP +## [3.2.5] 2023-05-07 +### Fixed +- Require sudo when checking vm map count + ## [3.2.4] 2023-03-01 ### Fixed - BM API returning stale query port and preventing fetching modlist diff --git a/dzgui.sh b/dzgui.sh index d8a895b..ed6ff78 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.4 +version=3.2.5 aid=221100 game="dayz" @@ -1724,7 +1724,7 @@ setup(){ check_map_count(){ count=1048576 echo "[DZGUI] Checking system map count" - if [[ $(sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then + if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then $steamsafe_zenity --question --width 500 --title="DZGUI" --text "System map count must be $count or higher to run DayZ with Wine.\nIncrease map count and make this change permanent? (will prompt for sudo password)" 2>/dev/null if [[ $? -eq 0 ]]; then pass=$($steamsafe_zenity --password) From 9fee338ba4a7c0ee45d30f62fb162ef7589f3c90 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 11:51:26 +0900 Subject: [PATCH 11/65] fix: do not parse Flatpak symlinks during setup --- changelog.md | 4 ++++ dzgui.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 30b1190..0028936 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Custom query API - Store favorites by IP +## [3.2.6] 2023-05-10 +### Fixed +- Don't parse Flatpak symlinks when setting up default Steam path + ## [3.2.5] 2023-05-07 ### Fixed - Require sudo when checking vm map count diff --git a/dzgui.sh b/dzgui.sh index ed6ff78..24dcd48 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.5 +version=3.2.6 aid=221100 game="dayz" @@ -1042,7 +1042,7 @@ console_dl(){ find_default_path(){ discover(){ echo "# Searching for Steam" - default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path \ + default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path "$HOME/.var" -o -path \ "/tmp" -o -path "/usr" -o -path "/boot" -o -path "/proc" -o -path "/root" \ -o -path "/sys" -o -path "/etc" -o -path "/var" -o -path "/lost+found" \) -prune \ -o -regex ".*/Steam/ubuntu12_32$" -print -quit 2>/dev/null | sed 's@/ubuntu12_32@@') From 1e1f647eb7a73032fb362872c285ece13b6a3f10 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 13:14:19 +0900 Subject: [PATCH 12/65] fix: sudo escalation --- dzgui.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 24dcd48..b80a0aa 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.6 +version=3.2.7 aid=221100 game="dayz" @@ -1724,12 +1724,24 @@ setup(){ check_map_count(){ count=1048576 echo "[DZGUI] Checking system map count" - if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then - $steamsafe_zenity --question --width 500 --title="DZGUI" --text "System map count must be $count or higher to run DayZ with Wine.\nIncrease map count and make this change permanent? (will prompt for sudo password)" 2>/dev/null - if [[ $? -eq 0 ]]; then - pass=$($steamsafe_zenity --password) - sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" - sudo sysctl -p /etc/sysctl.d/dayz.conf + if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then + if [[ $parent != "bash" ]]; then + $steamsafe_zenity --question --width 500 --title="DZGUI" --text "sudo password required to check system vm map count." 2>/dev/null + if [[ $? -eq 0 ]]; then + pass=$($steamsafe_zenity --password) + local ct=$(sudo -S <<< "$pass" sh -c "sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}')") + if [[ $ct -lt $count ]]; then + sudo sysctl -p /etc/sysctl.d/dayz.conf + pass=$($steamsafe_zenity --password) + fi + else + return + fi + else + if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then + sudo echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf + sudo sysctl -p /etc/sysctl.d/dayz.conf + fi fi fi } @@ -1827,4 +1839,5 @@ main(){ #TODO: tech debt: cruddy handling for steam forking [[ $? -eq 1 ]] && pkill -f dzgui.sh } +parent=$(cat /proc/$PPID/comm) main From 55f1a6ad626539764a6c0b55f8c30981c68d55a9 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 13:29:34 +0900 Subject: [PATCH 13/65] fix: sudo escalation --- dzgui.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index b80a0aa..db9dca2 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1722,24 +1722,25 @@ setup(){ fi } check_map_count(){ - count=1048576 + local count=1048576 echo "[DZGUI] Checking system map count" if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then if [[ $parent != "bash" ]]; then - $steamsafe_zenity --question --width 500 --title="DZGUI" --text "sudo password required to check system vm map count." 2>/dev/null + echo "parent is not bash" >> $HOME/log + $steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null if [[ $? -eq 0 ]]; then - pass=$($steamsafe_zenity --password) - local ct=$(sudo -S <<< "$pass" sh -c "sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}')") + local pass=$($steamsafe_zenity --password) + local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F"= " '{print $2}')") if [[ $ct -lt $count ]]; then + sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" sudo sysctl -p /etc/sysctl.d/dayz.conf - pass=$($steamsafe_zenity --password) fi else - return + exit 1 fi else if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then - sudo echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf + sudo sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" sudo sysctl -p /etc/sysctl.d/dayz.conf fi fi From 6bb3631e8ddd4c2aa9cbe0726d49ec09a1dc035d Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 13:41:40 +0900 Subject: [PATCH 14/65] fix: sudo escalation --- dzgui.sh | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index db9dca2..67b53b1 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1725,24 +1725,16 @@ check_map_count(){ local count=1048576 echo "[DZGUI] Checking system map count" if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then - if [[ $parent != "bash" ]]; then - echo "parent is not bash" >> $HOME/log - $steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null - if [[ $? -eq 0 ]]; then - local pass=$($steamsafe_zenity --password) - local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F"= " '{print $2}')") - if [[ $ct -lt $count ]]; then - sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" - sudo sysctl -p /etc/sysctl.d/dayz.conf - fi - else - exit 1 - fi + $steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null + if [[ $? -eq 0 ]]; then + local pass=$($steamsafe_zenity --password) + local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'") + local new_ct + [[ $ct -lt $count ]] && ct=$count + sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=$ct' > /etc/sysctl.d/dayz.conf" + sudo sysctl -p /etc/sysctl.d/dayz.conf else - if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then - sudo sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" - sudo sysctl -p /etc/sysctl.d/dayz.conf - fi + exit 1 fi fi } From 2f320db9aaed79d1af90762683c195c31d68fa8f Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 13:43:04 +0900 Subject: [PATCH 15/65] chore: bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 0028936..2769bce 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Custom query API - Store favorites by IP +## [3.2.7] 2023-05-10 +### Changed +- Better sudo escalation within zenity dialogs if vm map count is too small + ## [3.2.6] 2023-05-10 ### Fixed - Don't parse Flatpak symlinks when setting up default Steam path From 3b485a8f88fdbc946673819df9082456fb538aa7 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 17:01:51 +0900 Subject: [PATCH 16/65] fix: allow manual path discovery (#65) --- changelog.md | 4 ++++ dzgui.sh | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 2769bce..aebbccd 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Custom query API - Store favorites by IP +## [3.2.8] 2023-05-10 +### Fixed +- Allow user to retry with filepicker if auto path discovery resulted in false positive + ## [3.2.7] 2023-05-10 ### Changed - Better sudo escalation within zenity dialogs if vm map count is too small diff --git a/dzgui.sh b/dzgui.sh index 67b53b1..ef244ec 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.7 +version=3.2.8 aid=221100 game="dayz" @@ -272,7 +272,11 @@ create_config(){ find_library_folder if [[ -z $steam_path ]]; then zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Retry" --cancel-label="Exit" - [[ $? -eq 1 ]] && exit + if [[ $? -eq 0 ]]; then + file_picker + else + exit + fi else mkdir -p $config_path write_config > $config_file From f19ed7811a2fd2ed50b3c815fc82dbdfdd656835 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 17:05:25 +0900 Subject: [PATCH 17/65] fix: reword button --- dzgui.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index ef244ec..522d758 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.8 +version=3.2.9 aid=221100 game="dayz" @@ -271,7 +271,7 @@ create_config(){ find_default_path find_library_folder if [[ -z $steam_path ]]; then - zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Retry" --cancel-label="Exit" + zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Choose path manually" --cancel-label="Exit" if [[ $? -eq 0 ]]; then file_picker else From 70dfe930ec3eb9bc65326e3e6ed398aeeb402040 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 17:06:01 +0900 Subject: [PATCH 18/65] chore: bump version --- changelog.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index aebbccd..205830b 100644 --- a/changelog.md +++ b/changelog.md @@ -6,9 +6,9 @@ - Custom query API - Store favorites by IP -## [3.2.8] 2023-05-10 -### Fixed -- Allow user to retry with filepicker if auto path discovery resulted in false positive +## [3.2.9] 2023-05-10 +### Changed +- Reword button to "Choose path manually" instead of "Retry" ## [3.2.7] 2023-05-10 ### Changed From 69b1e64277be7b7d71879b16048fa1646ce7a879 Mon Sep 17 00:00:00 2001 From: aclist Date: Thu, 11 May 2023 12:06:02 +0900 Subject: [PATCH 19/65] chore: bump version from mainline --- changelog.md | 6 ++++++ dzgui.sh | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 205830b..b71e919 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,12 @@ - Custom query API - Store favorites by IP +## [3.2.10] 2023-05-11 +### Fixed +- Return from lockfile function if first-time setup has not been run +- Sanitize inputs when using file picker +- Require both wmctrl and xdotool + ## [3.2.9] 2023-05-10 ### Changed - Reword button to "Choose path manually" instead of "Retry" diff --git a/dzgui.sh b/dzgui.sh index 522d758..cc26b35 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.9 +version=3.2.10 aid=221100 game="dayz" @@ -88,9 +88,9 @@ depcheck(){ done } watcher_deps(){ - if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then + if [[ ! $(command -v wmctrl) ]] || [[ ! $(command -v xdotool) ]]; then echo "100" - warn "Missing dependency: requires 'wmctrl' or 'xdotool'.\nInstall from your system's package manager." + warn "Missing dependency: requires 'wmctrl' and 'xdotool'.\nInstall from your system's package manager." exit 1 fi } @@ -228,7 +228,7 @@ freedesktop_dirs(){ fi } find_library_folder(){ - steam_path=$(python3 $helpers_path/vdf2json.py -i $default_steam_path/steamapps/libraryfolders.vdf | jq -r '.libraryfolders[]|select(.apps|has("221100")).path') + steam_path=$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path') } file_picker(){ while true; do @@ -237,7 +237,7 @@ file_picker(){ return else default_steam_path="$path" - find_library_folder + find_library_folder "$default_steam_path" fi if [[ -z $steam_path ]]; then warn "DayZ not found at this path." @@ -485,7 +485,7 @@ auto_mod_install(){ [[ $force_update -eq 1 ]] && { unset force_update; return; } if [[ -z $diff ]]; then check_timestamps - passed_mod_check > >($steamsafe_zenity --pulsate --progress --title=DZGUI --auto-close --width=500 2>/dev/null) + passed_mod_check > >($steamsafe_zenity --pulsate --progress --title="DZGUI" --auto-close --width=500 2>/dev/null) launch else manual_mod_install @@ -1767,6 +1767,7 @@ while true; do done } lock(){ + [[ ! -d $config_path ]] && return if [[ ! -f ${config_path}.lockfile ]]; then touch ${config_path}.lockfile fi From 8cbe396bba2b1316923d00f4ea52ad45f773f412 Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 12 May 2023 08:01:42 +0900 Subject: [PATCH 20/65] fix: move debug file location --- dzgui.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index cc26b35..9364572 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.10 +version=3.2.13 aid=221100 game="dayz" @@ -228,23 +228,22 @@ freedesktop_dirs(){ fi } find_library_folder(){ + echo "ENTERED: ${FUNCNAME[0]}" >> /tmp/debug.log + echo "RECEIVED ARG: $1" >> /tmp/debug.log steam_path=$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path') + echo "STEAM PATH RESOLVED TO: $steam_path" >> /tmp/debug.log } file_picker(){ - while true; do + echo "${FUNCNAME[0]}" >> /tmp/debug.log local path=$($steamsafe_zenity --file-selection --directory 2>/dev/null) - if [[ -z "$path" ]]; then - return - else - default_steam_path="$path" - find_library_folder "$default_steam_path" - fi - if [[ -z $steam_path ]]; then - warn "DayZ not found at this path." - else - return - fi - done + echo "FILE PICKER PATH RESOLVED TO: $path" >> /tmp/debug.log + if [[ -z "$path" ]]; then + echo "PATH WAS EMPTY" >> /tmp/debug.log + return + else + default_steam_path="$path" + find_library_folder "$default_steam_path" + fi } create_config(){ check_pyver @@ -268,11 +267,14 @@ create_config(){ warn "Invalid BM API key" else while true; do + echo "STEAMSAFEZENITY: $steamsafe_zenity" >> /tmp/debug.log find_default_path - find_library_folder + find_library_folder "$default_steam_path" if [[ -z $steam_path ]]; then + echo "STEAM PATH WAS EMPTY" >> /tmp/debug.log zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Choose path manually" --cancel-label="Exit" if [[ $? -eq 0 ]]; then + echo "USER SELECTED FILE PICKER" >> /tmp/debug.log file_picker else exit @@ -1044,6 +1046,7 @@ console_dl(){ done } find_default_path(){ + echo "ENTER: ${FUNCNAME[0]}" >> $config/debug.log discover(){ echo "# Searching for Steam" default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path "$HOME/.var" -o -path \ @@ -1062,6 +1065,7 @@ find_default_path(){ default_steam_path="$HOME/.steam/steam" else local res=$(echo -e "Let DZGUI auto-discover Steam path (accurate, slower)\nSelect the Steam path manually (less accurate, faster)" | $steamsafe_zenity --list --column="Choice" --title=DZGUI --hide-header --text="Steam is not installed in a standard location." $sd_res) + echo "USER CHOSE: $res" >> /tmp/debug.log case "$res" in *auto*) discover ;; *manual*) @@ -1070,6 +1074,7 @@ find_default_path(){ esac fi fi + echo "FOUND DEFAULT PATH AT: $default_steam_path" >> /tmp/debug.log } popup(){ pop(){ @@ -1645,7 +1650,7 @@ enforce_dl(){ download_new_version > >($steamsafe_zenity --progress --pulsate --auto-close --no-cancel --width=500) } prompt_dl(){ - $steamsafe_zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t\t$branch\nYour version\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null + $steamsafe_zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t\t$branch\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null rc=$? if [[ $rc -eq 1 ]]; then return From f28257925f33a4318622c10b11e50a5a32929263 Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 12 May 2023 08:02:55 +0900 Subject: [PATCH 21/65] chore: bump version --- dzgui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index 9364572..0a667ce 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.13 +version=3.2.14 aid=221100 game="dayz" From 22e96873d97a4b9c289b34757f62b7c68261cb8b Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 12 May 2023 12:10:38 +0900 Subject: [PATCH 22/65] fix: not breaking out of loop after setting steam path (#65) --- dzgui.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 0a667ce..a4b2af7 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.14 +version=3.2.15 aid=221100 game="dayz" @@ -230,7 +230,7 @@ freedesktop_dirs(){ find_library_folder(){ echo "ENTERED: ${FUNCNAME[0]}" >> /tmp/debug.log echo "RECEIVED ARG: $1" >> /tmp/debug.log - steam_path=$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path') + steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path')" echo "STEAM PATH RESOLVED TO: $steam_path" >> /tmp/debug.log } file_picker(){ @@ -268,6 +268,7 @@ create_config(){ else while true; do echo "STEAMSAFEZENITY: $steamsafe_zenity" >> /tmp/debug.log + [[ -n $steam_path ]] && break find_default_path find_library_folder "$default_steam_path" if [[ -z $steam_path ]]; then @@ -1046,7 +1047,7 @@ console_dl(){ done } find_default_path(){ - echo "ENTER: ${FUNCNAME[0]}" >> $config/debug.log + echo "ENTER: ${FUNCNAME[0]}" >> /tmp/debug.log discover(){ echo "# Searching for Steam" default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path "$HOME/.var" -o -path \ From 95db1e01c300733ecc374fd7d4b68585b755c87f Mon Sep 17 00:00:00 2001 From: aclist Date: Fri, 12 May 2023 12:23:12 +0900 Subject: [PATCH 23/65] fix: return from config function --- dzgui.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index a4b2af7..e051109 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.15 +version=3.2.16 aid=221100 game="dayz" @@ -247,6 +247,13 @@ file_picker(){ } create_config(){ check_pyver + write_to_config(){ + mkdir -p $config_path + write_config > $config_file + info "Config file created at $config_file." + source $config_file + return + } while true; do player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="BattleMetrics API key" --add-entry="Steam API key" --title="DZGUI" --text="DZGUI" $sd_res --separator="│" 2>/dev/null)" #explicitly setting IFS crashes $steamsafe_zenity in loop @@ -268,7 +275,7 @@ create_config(){ else while true; do echo "STEAMSAFEZENITY: $steamsafe_zenity" >> /tmp/debug.log - [[ -n $steam_path ]] && break + [[ -n $steam_path ]] && { write_to_config; return; } find_default_path find_library_folder "$default_steam_path" if [[ -z $steam_path ]]; then @@ -281,11 +288,7 @@ create_config(){ exit fi else - mkdir -p $config_path - write_config > $config_file - info "Config file created at $config_file." - source $config_file - return + write_to_config fi done fi From 03a8a3169dbc1e63f1bae20da9ad90b1523abf5d Mon Sep 17 00:00:00 2001 From: aclist Date: Sat, 13 May 2023 01:01:56 +0900 Subject: [PATCH 24/65] fix: Do not enforce wmctrl on stable branch --- dzgui.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index e051109..8515014 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.16 +version=3.2.17 aid=221100 game="dayz" @@ -88,9 +88,9 @@ depcheck(){ done } watcher_deps(){ - if [[ ! $(command -v wmctrl) ]] || [[ ! $(command -v xdotool) ]]; then + if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then echo "100" - warn "Missing dependency: requires 'wmctrl' and 'xdotool'.\nInstall from your system's package manager." + warn "Missing dependency: requires 'wmctrl' or 'xdotool'.\nInstall from your system's package manager." exit 1 fi } From 854f5fc1d336931da5c9443dfb295f6a47309070 Mon Sep 17 00:00:00 2001 From: aclist Date: Sat, 13 May 2023 02:01:48 +0900 Subject: [PATCH 25/65] chore: update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index a7719e8..dbfa68c 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Happy new year. Fixed history menu modlist query. +NEWS: Backend hotfixes to support Steam Beta UI. Version 3.3.0 release imminent From 42142d999a0c1f835bb7bcc81369e1998a283d7e Mon Sep 17 00:00:00 2001 From: aclist Date: Sat, 13 May 2023 04:29:58 +0900 Subject: [PATCH 26/65] feat: add more startup logging --- dzgui.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 8515014..4b9f075 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.17 +version=3.2.18 aid=221100 game="dayz" @@ -246,6 +246,7 @@ file_picker(){ fi } create_config(){ + debug "ENTERED ${FUNCNAME[0]}" check_pyver write_to_config(){ mkdir -p $config_path @@ -274,15 +275,15 @@ create_config(){ warn "Invalid BM API key" else while true; do - echo "STEAMSAFEZENITY: $steamsafe_zenity" >> /tmp/debug.log + debug "STEAMSAFEZENITY: $steamsafe_zenity" [[ -n $steam_path ]] && { write_to_config; return; } find_default_path find_library_folder "$default_steam_path" if [[ -z $steam_path ]]; then - echo "STEAM PATH WAS EMPTY" >> /tmp/debug.log + debug "STEAM PATH WAS EMPTY" zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Choose path manually" --cancel-label="Exit" if [[ $? -eq 0 ]]; then - echo "USER SELECTED FILE PICKER" >> /tmp/debug.log + debug "USER SELECTED FILE PICKER" file_picker else exit @@ -310,8 +311,13 @@ run_depcheck(){ exit fi } +debug(){ + echo "$*" >> /tmp/debug.log +} check_pyver(){ + debug "ENTERED ${FUNCNAME[0]}" pyver=$(python3 --version | awk '{print $2}') + debug "PYVER is $pyver" if [[ -z $pyver ]] || [[ ${pyver:0:1} -lt 3 ]]; then warn "Requires python >=3.0" && exit @@ -332,13 +338,19 @@ run_varcheck(){ fi } config(){ + debug "ENTERED ${FUNCNAME[0]}" if [[ ! -f $config_file ]]; then + debug "CONFIG FILE MISSING" + debug "STEAMSAFEZENITY is $steamsafe_zenity" $steamsafe_zenity --width 500 --info --text="Config file not found. Click OK to proceed to first-time setup." 2>/dev/null code=$? + debug "RETURN CODE WAS $code" #TODO: prevent progress if user hits ESC if [[ $code -eq 1 ]]; then + debug "RECEIVED EXIT CODE 1" exit else + debug "CREATING CONFIG" create_config fi else From 97e9fef4302e493372103c4fb86984b82ee2338f Mon Sep 17 00:00:00 2001 From: aclist Date: Sat, 13 May 2023 04:31:30 +0900 Subject: [PATCH 27/65] feat: wipe debug at boot --- dzgui.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dzgui.sh b/dzgui.sh index 4b9f075..f539d49 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1852,6 +1852,7 @@ initial_setup(){ echo "100" } main(){ + > /tmp/debug.log lock initial_setup > >($steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --no-cancel --width=500 2>/dev/null) main_menu From e84ff51e254bd7a09cff4755854b753fab67040f Mon Sep 17 00:00:00 2001 From: aclist Date: Sat, 13 May 2023 19:16:33 +0900 Subject: [PATCH 28/65] chore: bump version --- dzgui.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index f539d49..32d6c30 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=3.2.18 +version=3.2.19 aid=221100 game="dayz" @@ -1852,7 +1852,6 @@ initial_setup(){ echo "100" } main(){ - > /tmp/debug.log lock initial_setup > >($steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --no-cancel --width=500 2>/dev/null) main_menu From 7fef2c7fa80a07d6c83a3dce8c3e65ae4323c7ea Mon Sep 17 00:00:00 2001 From: aclist Date: Sat, 13 May 2023 19:25:50 +0900 Subject: [PATCH 29/65] fix: more portable interpreter --- dzgui.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 32d6c30..df49189 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash set -o pipefail -version=3.2.19 +version=3.2.20 aid=221100 game="dayz" From 1803dd1166db32fe183754a1c76eca5ed2ba942c Mon Sep 17 00:00:00 2001 From: aclist Date: Sun, 14 May 2023 05:48:05 +0900 Subject: [PATCH 30/65] fix: use safe separator on forms --- dzgui.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index df49189..ee5568f 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=3.2.20 +version=3.2.21 aid=221100 game="dayz" @@ -228,17 +228,17 @@ freedesktop_dirs(){ fi } find_library_folder(){ - echo "ENTERED: ${FUNCNAME[0]}" >> /tmp/debug.log - echo "RECEIVED ARG: $1" >> /tmp/debug.log + echo "ENTERED: ${FUNCNAME[0]}" >> /tmp/dzdebug.log + echo "RECEIVED ARG: $1" >> /tmp/dzdebug.log steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path')" - echo "STEAM PATH RESOLVED TO: $steam_path" >> /tmp/debug.log + echo "STEAM PATH RESOLVED TO: $steam_path" >> /tmp/dzdebug.log } file_picker(){ - echo "${FUNCNAME[0]}" >> /tmp/debug.log + echo "${FUNCNAME[0]}" >> /tmp/dzdebug.log local path=$($steamsafe_zenity --file-selection --directory 2>/dev/null) - echo "FILE PICKER PATH RESOLVED TO: $path" >> /tmp/debug.log + echo "FILE PICKER PATH RESOLVED TO: $path" >> /tmp/dzdebug.log if [[ -z "$path" ]]; then - echo "PATH WAS EMPTY" >> /tmp/debug.log + echo "PATH WAS EMPTY" >> /tmp/dzdebug.log return else default_steam_path="$path" @@ -256,11 +256,11 @@ create_config(){ return } while true; do - player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="BattleMetrics API key" --add-entry="Steam API key" --title="DZGUI" --text="DZGUI" $sd_res --separator="│" 2>/dev/null)" + player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="BattleMetrics API key" --add-entry="Steam API key" --title="DZGUI" --text="DZGUI" $sd_res --separator="@" 2>/dev/null)" #explicitly setting IFS crashes $steamsafe_zenity in loop #and mapfile does not support high ascii delimiters #so split fields with newline - readarray -t args < <(echo "$player_input" | sed 's/│/\n/g') + readarray -t args < <(echo "$player_input" | sed 's/@/\n/g') name="${args[0]}" api_key="${args[1]}" steam_api="${args[2]}" @@ -312,7 +312,7 @@ run_depcheck(){ fi } debug(){ - echo "$*" >> /tmp/debug.log + echo "$*" >> /tmp/dzdebug.log } check_pyver(){ debug "ENTERED ${FUNCNAME[0]}" @@ -1062,7 +1062,7 @@ console_dl(){ done } find_default_path(){ - echo "ENTER: ${FUNCNAME[0]}" >> /tmp/debug.log + echo "ENTER: ${FUNCNAME[0]}" >> /tmp/dzdebug.log discover(){ echo "# Searching for Steam" default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path "$HOME/.var" -o -path \ @@ -1081,7 +1081,7 @@ find_default_path(){ default_steam_path="$HOME/.steam/steam" else local res=$(echo -e "Let DZGUI auto-discover Steam path (accurate, slower)\nSelect the Steam path manually (less accurate, faster)" | $steamsafe_zenity --list --column="Choice" --title=DZGUI --hide-header --text="Steam is not installed in a standard location." $sd_res) - echo "USER CHOSE: $res" >> /tmp/debug.log + echo "USER CHOSE: $res" >> /tmp/dzdebug.log case "$res" in *auto*) discover ;; *manual*) @@ -1090,7 +1090,7 @@ find_default_path(){ esac fi fi - echo "FOUND DEFAULT PATH AT: $default_steam_path" >> /tmp/debug.log + echo "FOUND DEFAULT PATH AT: $default_steam_path" >> /tmp/dzdebug.log } popup(){ pop(){ @@ -1636,6 +1636,7 @@ download_new_version(){ if [[ $rc -eq 0 ]]; then echo "[DZGUI] Wrote $upstream to $source_script" chmod +x $source_script + #FIXME: doesnt exist yet touch ${config_path}.unmerged echo "100" $steamsafe_zenity --question --width 500 --title="DZGUI" --text "DZGUI $upstream successfully downloaded.\nTo view the changelog, select Changelog.\nTo use the new version, select Exit and restart." --ok-label="Changelog" --cancel-label="Exit" 2>/dev/null From 357f512f007acc88ca4b35c1b04737eceb640be8 Mon Sep 17 00:00:00 2001 From: aclist Date: Sun, 14 May 2023 14:54:49 +0900 Subject: [PATCH 31/65] chore: update docs --- dzgui.adoc | 18 +++++++----------- dzgui.sh | 19 ++++++++----------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index f77cb25..872d62e 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -8,13 +8,12 @@ DayZ official/community server graphical launcher for Linux | Last updated: 2022 == What this is A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list official and community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. -DZGUI contains some expanded functionality that will eventually be backported to DZTUI. It is intended to be more of a user-friendly, turnkey solution for graphical desktop environments, and could also be used on the Steam Deck or similar devices. +Development on DZTUI (terminal client) has stopped at this time. DZGUI brings numerous functionality and security improvements and is intended to be a more user-friendly, turnkey solution for graphical desktop environments, and can also be used on the Steam Deck or similar devices. == Setup === Dependencies If not already installed, the below can be found in your system's package manager. -With the exception of Steam (which presumably you already have), in 99% of cases, -the other utilities should ship out of the box with mainstream distributions. They are provided here merely as a reference. +With the exception of Steam (which presumably you already have), wmctrl, and xdotool, the other utilities should ship out of the box with mainstream distributions. They are provided here merely as a reference. If any dependencies are missing when the application starts, it will warn you, so you need not take any preemptive measures here. @@ -36,7 +35,7 @@ curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash Automatic method: nix-based systems (contributed by lelgenio) Follow the instructions at https://github.com/lelgenio/dzgui-nix to ingest the package and dependencies -into your system using flakes. +into your system using flakes. Manual method @@ -49,7 +48,7 @@ chmod +x dzgui.sh [start=2] . **Update the `vm.max_map_count` value (see https://www.protondb.com/app/221100)** -This is handled automatically by DZGUI if you just choose to run the application out of the box. +This is handled automatically by DZGUI if you just choose to run the application out of the box. You will be prompted for your sudo password in order to check whether the system map count is too small. This is a one-time check that will not be triggered again once the map count is updated. If using the automatic method, you can skip to Step 3 below. Ephemeral method: ``` @@ -76,16 +75,13 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently 3. Give the token any name in the field at the top 4. Leave all options **unchecked** and scroll to the bottom, select **Create Token** 5. Copy the access token for later use (see below). This is the unique token you will use to query servers. -6. Use the https://www.battlemetrics.com/servers/dayz[DayZ server browser] to find servers of interest (proximity, player count, rules, etc.) -7. Each server has a unique ID. This is the string of numbers at the end of the URL. Copy these IDs. For example, in the URL https://www.battlemetrics.com/servers/dayz/8039514, the ID is `8039514`. - -[NOTE] -You will be prompted to enter these IDs when starting the app, so you could refer to them in another window while you complete setup. More IDs can be added later. +6. (Post-setup) Use the https://www.battlemetrics.com/servers/dayz[DayZ server browser] to find servers of interest (proximity, player count, rules, etc.) +7. (Post-setup) Each server has a unique ID. This is the string of numbers at the end of the URL. Copy these IDs. For example, in the URL https://www.battlemetrics.com/servers/dayz/8039514, the ID is `8039514`. ==== Steam API key 1. Register for a https://steamcommunity.com/dev/apikey[Steam API key] using your Steam account. You will be asked for a unique URL for your app when registering. 2. Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1". -3. Once configured, you can insert this key in the app when launching the "Connect by IP" feature for the first time. +3. Once configured, you can insert this key in the app when launching it for the first time. === First-time launch diff --git a/dzgui.sh b/dzgui.sh index ee5568f..00addc7 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=3.2.21 +version=3.2.22 aid=221100 game="dayz" @@ -130,6 +130,7 @@ set_api_params(){ first_entry=1 } query_api(){ + echo "# Querying API" #TODO: prevent drawing list if null values returned without API error if [[ $one_shot_launch -eq 1 ]]; then list_of_ids="$fav" @@ -1190,15 +1191,12 @@ options_menu(){ } query_and_connect(){ [[ -z $whitelist ]] && { popup 600; return; } - query_api - parse_json - #TODO: create logger function - if [[ ! $delete -eq 1 ]]; then - echo "[DZGUI] Checking response time of servers" - create_array | $steamsafe_zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null - else + q(){ + query_api + parse_json create_array - fi + } + q | $steamsafe_zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null rc=$? if [[ $rc -eq 1 ]]; then : @@ -1540,6 +1538,7 @@ page_through(){ parse_json } parse_json(){ + echo "# Parsing servers" page=$(echo "$list_response" | jq -r '.links.next?') if [[ $first_entry -eq 1 ]]; then local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') @@ -1547,8 +1546,6 @@ parse_json(){ first_entry=0 fi if [[ "$page" != "null" ]]; then - local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') - idarr+=("$list") page_through else printf "%s\n" "${idarr[@]}" > $tmp From f49257ad02f27fd38344ed5601ff4c22e89c77a1 Mon Sep 17 00:00:00 2001 From: aclist Date: Mon, 15 May 2023 10:04:23 +0900 Subject: [PATCH 32/65] fix: break out of sudo prompt when canceling --- dzgui.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 00addc7..18bb64f 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=3.2.22 +version=3.2.23 aid=221100 game="dayz" @@ -1081,8 +1081,7 @@ find_default_path(){ elif [[ -d "$HOME/.steam/steam" ]]; then default_steam_path="$HOME/.steam/steam" else - local res=$(echo -e "Let DZGUI auto-discover Steam path (accurate, slower)\nSelect the Steam path manually (less accurate, faster)" | $steamsafe_zenity --list --column="Choice" --title=DZGUI --hide-header --text="Steam is not installed in a standard location." $sd_res) - echo "USER CHOSE: $res" >> /tmp/dzdebug.log + local res=$(echo -e "Let DZGUI auto-discover Steam path (accurate, slower)\nSelect the Steam path manually (less accurate, faster)" | $steamsafe_zenity --list --column="Choice" --title="DZGUI" --hide-header --text="Steam is not installed in a standard location." $sd_res) case "$res" in *auto*) discover ;; *manual*) @@ -1091,11 +1090,10 @@ find_default_path(){ esac fi fi - echo "FOUND DEFAULT PATH AT: $default_steam_path" >> /tmp/dzdebug.log } popup(){ pop(){ - $steamsafe_zenity --info --text="$1" --title=DZGUI --width=500 2>/dev/null + $steamsafe_zenity --info --text="$1" --title="DZGUI" --width=500 2>/dev/null } case "$1" in 100) pop "This feature requires xdotool.";; @@ -1183,7 +1181,7 @@ options_menu(){ "Force update local mods") force_update=1 force_update_mods - merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title=DZGUI --width=500 2>/dev/null) + merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title="DZGUI" --width=500 2>/dev/null) auto_mod_install ;; Toggle[[:space:]]native*) toggle_steam_binary ;; @@ -1751,6 +1749,7 @@ check_map_count(){ $steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null if [[ $? -eq 0 ]]; then local pass=$($steamsafe_zenity --password) + [[ $? -eq 1 ]] && exit 1 local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'") local new_ct [[ $ct -lt $count ]] && ct=$count From 901171583c48eef4e30b50cdd98671517374ead5 Mon Sep 17 00:00:00 2001 From: aclist Date: Mon, 15 May 2023 10:05:21 +0900 Subject: [PATCH 33/65] docs: update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a822b9c..4b494bb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ## What this is -A GUI version of [DZTUI](https://github.com/aclist/dztui/tree/dztui) for Linux. +DZGUI is a GUI version of [DZTUI](https://github.com/aclist/dztui/tree/dztui) for Linux. + +Note: development of DZTUI has stopped and has been replaced with DZGUI. DZGUI allows you to connect to both official and modded/community DayZ servers on Linux and provides a graphical interface for doing so. This overcomes certain limitations in the Linux client and helps prepare the game to launch by doing the following: From 3f86408b9cb66d71f709490d57858122e1d5ccdf Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 15 May 2023 10:56:15 +0900 Subject: [PATCH 34/65] fix: do not capture return code of local var declaration --- dzgui.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 18bb64f..6db19a0 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=3.2.23 +version=3.2.24 aid=221100 game="dayz" @@ -1748,7 +1748,8 @@ check_map_count(){ if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then $steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null if [[ $? -eq 0 ]]; then - local pass=$($steamsafe_zenity --password) + local pass + pass=$($steamsafe_zenity --password) [[ $? -eq 1 ]] && exit 1 local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'") local new_ct From 67433964284b2e785bff7d5005e77c574500c3b6 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 15 May 2023 10:56:35 +0900 Subject: [PATCH 35/65] docs: update readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b494bb..a2803c1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## What this is DZGUI is a GUI version of [DZTUI](https://github.com/aclist/dztui/tree/dztui) for Linux. -Note: development of DZTUI has stopped and has been replaced with DZGUI. +Note: development of DZTUI has stopped and has been replaced with DZGUI. DZGUI allows you to connect to both official and modded/community DayZ servers on Linux and provides a graphical interface for doing so. This overcomes certain limitations in the Linux client and helps prepare the game to launch by doing the following: From 3808a672e3f93fbad8dbf49cad328ebb1189e74f Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 May 2023 20:02:56 +0900 Subject: [PATCH 36/65] feat: port features from stable --- dzgui.sh | 60 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 6db19a0..d9df189 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -51,13 +51,13 @@ update_last_seen(){ source $config_file } check_news(){ + echo "# Checking news" [[ $branch == "stable" ]] && news_url="$stable_url/news" [[ $branch == "testing" ]] && news_url="$testing_url/news" result=$(curl -Ls "$news_url") sum=$(echo -n "$result" | md5sum | awk '{print $1}') } print_news(){ - check_news if [[ $sum == $seen_news || -z $result ]]; then hchar="" news="" @@ -679,10 +679,10 @@ history_table(){ res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null) prepare_ip_list "$meta_file" >> /tmp/dz.hist sleep 0.5s - done | $steamsafe_zenity --pulsate --progress --auto-close --title=DZGUI --width=500 --no-cancel 2>/dev/null + done | $steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --width=500 --no-cancel 2>/dev/null [[ $? -eq 1 ]] && return while true; do - sel=$(cat /tmp/dz.hist | $steamsafe_zenity --width 1200 --height 800 --title=DZGUI --text="Recent servers" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2,5 --separator=%% 2>/dev/null) + sel=$(cat /tmp/dz.hist | $steamsafe_zenity --width 1200 --height 800 --title="DZGUI" --text="Recent servers" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2,5 --separator=%% 2>/dev/null) if [[ $? -eq 1 ]]; then return_from_table=1 rm /tmp/dz.hist @@ -926,7 +926,7 @@ delete_or_connect(){ if [[ $delete -eq 1 ]]; then server_name=$(echo "$sel" | awk -F"%%" '{print $1}') server_id=$(echo "$sel" | awk -F"%%" '{print $2}') - $steamsafe_zenity --question --text="Delete this server? \n$server_name" --title=DZGUI --width=500 2>/dev/null + $steamsafe_zenity --question --text="Delete this server? \n$server_name" --title="DZGUI" --width=500 2>/dev/null if [[ $? -eq 0 ]]; then delete_by_id $server_id fi @@ -984,8 +984,9 @@ list_mods(){ else for d in $(find $game_dir/* -maxdepth 1 -type l); do dir=$(basename $d) - awk -v d=$dir -F\" '/name/ {printf "%s\t%s\n", $2,d}' "$gamedir"/$d/meta.cpp - done | sort + awk -v d=$dir -F\" '/name/ {printf "%s\t%s\t", $2,d}' "$gamedir"/$d/meta.cpp + printf "%s\n" "$(basename $(readlink -f $game_dir/$dir))" + done | sort -k1 fi } fetch_query_ports(){ @@ -1066,7 +1067,7 @@ find_default_path(){ echo "ENTER: ${FUNCNAME[0]}" >> /tmp/dzdebug.log discover(){ echo "# Searching for Steam" - default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path "$HOME/.var" -o -path \ + default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path \ "/tmp" -o -path "/usr" -o -path "/boot" -o -path "/proc" -o -path "/root" \ -o -path "/sys" -o -path "/etc" -o -path "/var" -o -path "/lost+found" \) -prune \ -o -regex ".*/Steam/ubuntu12_32$" -print -quit 2>/dev/null | sed 's@/ubuntu12_32@@') @@ -1074,12 +1075,19 @@ find_default_path(){ if [[ $is_steam_deck -eq 1 ]]; then default_steam_path="$HOME/.local/share/Steam" else - #default - if [[ -d "$HOME/.local/share/Steam" ]]; then - default_steam_path="$HOME/.local/share/Steam" - #ubuntu - elif [[ -d "$HOME/.steam/steam" ]]; then - default_steam_path="$HOME/.steam/steam" + local def_path + local ub_path + local flat_path + def_path="$HOME/.local/share/Steam" + ub_path="$HOME/.steam/steam" + flat_path="$HOME/.var/app/com.valvesoftware.Steam/data/Steam" + + if [[ -d "$def_path" ]]; then + default_steam_path="$def_path" + elif [[ -d "$ub_path" ]]; then + default_steam_path="$ub_path" + elif [[ -d $flat_path ]]; then + default_steam_path="$flat_path" else local res=$(echo -e "Let DZGUI auto-discover Steam path (accurate, slower)\nSelect the Steam path manually (less accurate, faster)" | $steamsafe_zenity --list --column="Choice" --title="DZGUI" --hide-header --text="Steam is not installed in a standard location." $sd_res) case "$res" in @@ -1096,7 +1104,7 @@ popup(){ $steamsafe_zenity --info --text="$1" --title="DZGUI" --width=500 2>/dev/null } case "$1" in - 100) pop "This feature requires xdotool.";; + 100) pop "This feature requires xdotool and wmctrl.";; 200) pop "This feature is not supported on Gaming Mode.";; 300) pop "\nThe Steam console will now open and briefly issue commands to\ndownload the workshop files, then return to the download progress page.\n\nEnsure that the Steam console has keyboard and mouse focus\n(keep hands off keyboard) while the commands are being issued.\n\nDepending on the number if mods, it may take some time to queue the downloads,\nbut if a popup or notification window steals focus, it could obstruct\nthe process." ;; 400) pop "Automod install enabled. Auto-downloaded mods will not appear\nin your Steam Workshop subscriptions, but DZGUI will\ntrack the version number of downloaded mods internally\nand trigger an update if necessary." ;; @@ -1104,12 +1112,13 @@ popup(){ 600) pop "No preferred servers set." ;; 700) pop "Toggled to Flatpak Steam." ;; 800) pop "Toggled to native Steam." ;; + 900) pop "This feature is not supported on Steam Deck." esac } toggle_console_dl(){ - [[ $is_steam_deck -eq 1 ]] && test_display_mode - [[ $gamemode -eq 1 ]] && { popup 200; return; } + [[ $is_steam_deck -eq 1 ]] && { popup 900; return; } [[ ! $(command -v xdotool) ]] && { popup 100; return; } + [[ ! $(command -v wmctrl) ]] && { popup 100; return; } mv $config_file ${config_path}dztuirc.old local nr=$(awk '/auto_install=/ {print NR}' ${config_path}dztuirc.old) if [[ $auto_install == "2" ]]; then @@ -1280,7 +1289,7 @@ pagination(){ printf "| Keyword: %s " "$search" fi printf "\nReturned: %s %s of %s | " "${#qport[@]}" "$entry" "$total_servers" - printf "Players online: %s" "$players_online" + printf "Players in-game: %s" "$players_online" } check_geo_file(){ local gzip="$helpers_path/ips.csv.gz" @@ -1316,7 +1325,6 @@ choose_filters(){ fi [[ -z $sels ]] && return filters=$(echo "$sels" | sed 's/|/, /g;s/ (untick to select from map list)//') - echo "[DZGUI] Filters: $filters" } get_dist(){ local given_ip="$1" @@ -1446,7 +1454,8 @@ server_browser(){ } fetch > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null) total_servers=$(echo "$response" | jq 'length' | numfmt --grouping) - players_online=$(echo "$response" | jq '.[].players' | awk '{s+=$1}END{print s}' | numfmt --grouping) + players_online=$(curl -Ls "https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=$aid" \ + | jq '.response.player_count' | numfmt --grouping) debug_log="$HOME/.local/share/dzgui/DEBUG.log" debug_servers local sel=$(munge_servers) @@ -1454,6 +1463,7 @@ server_browser(){ unset filters unset search ret=98 + sd_res="--width=1280 --height=800" return fi local sel_ip=$(echo "$sel" | awk -F%% '{print $1}') @@ -1461,7 +1471,9 @@ server_browser(){ qport_list="$sel_ip%%$sel_port" if [[ -n "$sel_ip" ]]; then connect "$sel_ip" "ip" + sd_res="--width=1280 --height=800" else + sd_res="--width=1280 --height=800" return fi } @@ -1504,7 +1516,7 @@ main_menu(){ elif [[ $sel == "${items[10]}" ]]; then : elif [[ $sel == "${items[11]}" ]]; then - list_mods | sed 's/\t/\n/g' | $steamsafe_zenity --list --column="Mod" --column="Symlink" \ + list_mods | sed 's/\t/\n/g' | $steamsafe_zenity --list --column="Mod" --column="Symlink" --column="Dir" \ --title="DZGUI" $sd_res --text="$(mods_disk_size)" \ --print-column="" 2>/dev/null elif [[ $sel == "${items[12]}" ]]; then @@ -1588,7 +1600,7 @@ create_array(){ declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping") fi let lc++ - done < "$tmp" + done < <(cat "$tmp" | sort -k1) for i in "${rows[@]}"; do echo -e "$i"; done > $tmp } @@ -1599,8 +1611,9 @@ set_fav(){ | jq -r '.data[] .attributes .name') if [[ -z $fav_label ]]; then fav_label=null + else + fav_label="'$fav_label'" fi - echo "[DZGUI] Setting favorite server to '$fav_label'" } check_unmerged(){ if [[ -f ${config_path}.unmerged ]]; then @@ -1631,7 +1644,6 @@ download_new_version(){ if [[ $rc -eq 0 ]]; then echo "[DZGUI] Wrote $upstream to $source_script" chmod +x $source_script - #FIXME: doesnt exist yet touch ${config_path}.unmerged echo "100" $steamsafe_zenity --question --width 500 --title="DZGUI" --text "DZGUI $upstream successfully downloaded.\nTo view the changelog, select Changelog.\nTo use the new version, select Exit and restart." --ok-label="Changelog" --cancel-label="Exit" 2>/dev/null @@ -1714,7 +1726,6 @@ add_by_id(){ mv $config_file ${config_path}dztuirc.old nr=$(awk '/whitelist=/ {print NR}' ${config_path}dztuirc.old) awk -v "var=$new_whitelist" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc - echo "[DZGUI] Added $id to key 'whitelist'" $steamsafe_zenity --info --title="DZGUI" --text="Added "$id" to:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" --width=500 2>/dev/null source $config_file return @@ -1847,6 +1858,7 @@ initial_setup(){ stale_symlinks init_items setup + check_news echo "100" } main(){ From 559386b1910cda3e9717ad79d5633e072c888f35 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 May 2023 20:04:06 +0900 Subject: [PATCH 37/65] docs: update changelog --- dzgui.adoc | 227 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 146 insertions(+), 81 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index 872d62e..d66ed7c 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -1,19 +1,24 @@ -= DZGUI documentation -DayZ official/community server graphical launcher for Linux | Last updated: 2022-10-11 -======= :nofooter: :toc: left :stylesheet: custom.css -== What this is -A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list official and community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. += DZGUI documentation +DayZ official/community server graphical launcher for Linux | Last updated: 2023-05-15 -Development on DZTUI (terminal client) has stopped at this time. DZGUI brings numerous functionality and security improvements and is intended to be a more user-friendly, turnkey solution for graphical desktop environments, and can also be used on the Steam Deck or similar devices. +Click https://aclist.github.io/dzgui/dzgui_dark.html[here] for dark mode + +== What this is +A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. +Used to list official and community server details and quick connect to preferred servers +by staging mods and concatenating launch options automatically. + +Development on DZTUI (terminal client) has stopped at this time. +Instead, DZGUI brings numerous functionality and security improvements and is intended to be a more user-friendly, +turnkey solution for graphical desktop environments, and can also be used on the Steam Deck or similar devices. == Setup === Dependencies If not already installed, the below can be found in your system's package manager. -With the exception of Steam (which presumably you already have), wmctrl, and xdotool, the other utilities should ship out of the box with mainstream distributions. They are provided here merely as a reference. If any dependencies are missing when the application starts, it will warn you, so you need not take any preemptive measures here. @@ -29,7 +34,7 @@ If any dependencies are missing when the application starts, it will warn you, s Automatic method: generic OS (skip to step 3 below when complete) ``` -curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash +curl -s "https://raw.githubusercontent.com/aclist/dztui/main/install.sh" | bash ``` Automatic method: nix-based systems (contributed by lelgenio) @@ -48,26 +53,38 @@ chmod +x dzgui.sh [start=2] . **Update the `vm.max_map_count` value (see https://www.protondb.com/app/221100)** -This is handled automatically by DZGUI if you just choose to run the application out of the box. You will be prompted for your sudo password in order to check whether the system map count is too small. This is a one-time check that will not be triggered again once the map count is updated. If using the automatic method, you can skip to Step 3 below. +**Automatic method:** + +This is handled automatically by DZGUI if you just choose to run the application out of the box. +You will be prompted for your sudo password in order to check whether the system map count is too small. +This is a one-time check that will not be triggered again once the map count is updated. +If you used the automatic method, you can skip to Step 3 below. + +This process writes the count to the file `/etc/sysctl.d/dayz.conf`. + +If the map count was lower than the threshold, it is updated to 1048576. +If the system map count was already higher, that value is interpolated into this file as a redundancy check. + +[NOTE] +If, for reasons unrelated to DayZ, you choose at a later time to raise your system map count higher than it originally was and +you find that the count is not sticking, check for the presence of the `dayz.conf` file to see if it is taking precedence and delete it accordingly. + +**Ephemeral method:** +the map count will revert after the system is rebooted. -Ephemeral method: ``` sudo sysctl -w vm.max_map_count=1048576 ``` -Persistent method: +**Persistent method:** ``` echo 'vm.max_map_count=1048576' | sudo tee /etc/sysctl.d/dayz.conf ``` -[NOTE] -If it detects an incorrect map count value, DZGUI will prompt you to permanently update the map count value when starting up. - [start=3] . **Prepare a Steam account with a DayZ license** . **Enable a Proton version ≥ `6.8` (or use Experimental) in the `Compatibility` field of the game's right-click options.** - === API key & server IDs ==== BattleMetrics API key 1. Register for an API key at https://www.battlemetrics.com/account/register?after=%2Fdevelopers[BattleMetrics] (free) @@ -75,16 +92,16 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently 3. Give the token any name in the field at the top 4. Leave all options **unchecked** and scroll to the bottom, select **Create Token** 5. Copy the access token for later use (see below). This is the unique token you will use to query servers. -6. (Post-setup) Use the https://www.battlemetrics.com/servers/dayz[DayZ server browser] to find servers of interest (proximity, player count, rules, etc.) -7. (Post-setup) Each server has a unique ID. This is the string of numbers at the end of the URL. Copy these IDs. For example, in the URL https://www.battlemetrics.com/servers/dayz/8039514, the ID is `8039514`. ==== Steam API key -1. Register for a https://steamcommunity.com/dev/apikey[Steam API key] using your Steam account. You will be asked for a unique URL for your app when registering. -2. Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1". +1. Register for a https://steamcommunity.com/dev/apikey[Steam API key] (free) using your Steam account. You will be asked for a unique URL for your app when registering. +2. Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1" or some other name that is meaningful to you. 3. Once configured, you can insert this key in the app when launching it for the first time. === First-time launch +0. It is always advised to have Steam running in the background. DayZ is meant to run "on top of" Steam. + 1. DZGUI can be launched one of two ways. **From the terminal:** @@ -93,11 +110,10 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently ./dzgui.sh ``` -Launching from the terminal gives more verbose information, and can be a good way of troubleshooting problems. +Launching from the terminal gives more verbose information in the event of a crash, +and can be a good way of troubleshooting problems. -**From the shortcut shipped with the application:** - -*If using a desktop environment based on the Freedesktop specification +**From the shortcut shipped with the application** (if using a desktop environment based on the Freedesktop specification): - Located under the "Games" category of your system's applications list. - Via the DZGUI desktop shortcut (Steam Deck only) @@ -105,14 +121,28 @@ Launching from the terminal gives more verbose information, and can be a good wa [start=2] 2. Follow the menu prompts given by the app. You will be asked to provide: -- API key (see above) - Player name (a generic handle, required by some servers) -- At least one server ID +- BM API key (see above) +- Steam API key -DZGUI will then attempt to locate your default Steam installation and DayZ path. If it detects multiple paths, you will be given a list to choose from. +==== Steam path discovery -[NOTE] -If the path was not detected correctly, you can manually edit the config file at `$HOME/.config/dztui/dztuirc`. +DZGUI will then attempt to locate your default Steam installation and DayZ path. You *must* have DayZ installed in your Steam library in order to proceed. (It can be installed to any drive of your choosing.) +If DZGUI cannot find Steam or cannot find DayZ installed at the detected Steam path, it will prompt you to manually specify the path to your Steam installation. + +Specify the top-level entry point to Steam, not DayZ. E.g., + +`/media/mydrive/Steam`, not `/media/mydrive/Steam/steamapps/common/DayZ` + +If your Steam installation is in a hidden folder but the file picker dialog does not show hidden folders, ensure that your GTK settings are set to show hidden files. + +For GTK 2, edit the file below so that `ShowHidden=true`: + +`~/.config/gtk-2.0/gtkfilechooser.ini` + +For GTK 3, invoke the command: + +`gsettings set org.gtk.Settings.FileChooser show-hidden true` === Steam integration & artwork @@ -187,14 +217,18 @@ image::https://github.com/aclist/dztui/raw/testing/images/tutorial/07.png[07,700 === Updating the app -If DZGUI detects a new upstream version, it will prompt you to download it automatically. It backs up the original version before fetching the new one, then updates your config file with your existing values. Once finished, it will ask you to relaunch the app. +If DZGUI detects a new upstream version, it will prompt you to download it automatically. +It backs up the original version before fetching the new one, then updates your config file with your existing values. Once finished, it will ask you to relaunch the app. If you decline to upgrade to the new version, DZGUI will continue to the main menu with the current version. [NOTE] -New versions may include changes to bugs that could prevent you from playing on certain servers. Upgrading is always advised. +New versions may include changes to bugs that could prevent you from playing on certain servers. +Upgrading is always advised. -If you experience a problem or need to restore the prior version of DZGUI and/or your configs, it is enough to simply replace the new version with the old one and relaunch the app. The files can be found at: +If you experience a problem or need to restore the prior version of DZGUI and/or your configs, +it is enough to simply replace the new version with the old one and relaunch the app. +The files can be found at: Script: ``` @@ -210,22 +244,27 @@ If launching DZGUI via its system shortcut, the backup file (similarly for log f $HOME/.local/share/dzgui ``` -Backup config files: +Backup config file: ``` $HOME/.config/dztui/dztuirc.old ``` == Usage -Select <> to fetch details for the server IDs you provided. Select the server you wish to connect to and click OK. +Select from among the <> below. -DZGUI will check the server's modset against your local mods. If you are missing any, it will prompt you to download them through the Steam Workshop and open a window in the background in the system browser. +Connecting to a server consists of fetching metadata for the server IDs you have previously saved/are searching for. + +DZGUI will check the server's modset against your local mods. If you are missing any, +it will prompt you to download them through the Steam Workshop and open a window in the background in the system browser. Open each link and click Subscribe to schedule these for download. [NOTE] -You must be logged into Steam for mod change to take effect. It can take some time for the subscribed mods to download and update. You can continue clicking Next to regenerate the list, or wait for all of them to complete. +You must be logged into Steam for mod changes to take effect. +It can take some time for the subscribed mods to download and update. -Once all of the mods are downloaded and staged, DZGUI will notify you that it is ready to connect. The app hands the launch parameters to Steam and exits. +Once all of the mods are downloaded and staged, DZGUI will notify you that it is ready to connect. +The app hands the launch parameters to Steam and exits. == Menu options @@ -235,11 +274,6 @@ These servers can be filtered by various parameters in order to display a more g After a server is selected from the list, the application continues to the mod validation step. -In order to use this feature, you must have a https://steamcommunity.com/dev/apikey[Steam API key]. You will be asked for a unique URL for your app when registering. -Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1". - -You will be prompted to insert this key into the app when launching the server browser for the first time. - [NOTE] It is not currently possible to save servers from the full server browser. @@ -255,20 +289,21 @@ You must have a minimum of one filter active to return any results. |Filter|Usage |All maps|Return all available map types being served. -Note: disabling this option will present a list from which you can select one specific map type (e.g., namalsk) +Note: unticking this filter will present a list from which you can select one specific map type (e.g., namalsk) |Daytime|Include servers with gametime between 0600 and 1659 |Nighttime|Include servers with gametime between 1700 and 0559 |Empty|Include servers with 0 current players |Full|Include servers at maximum capacity |Low population|Include servers with fewer than 10 players online |Non-ASCII titles|Include servers with special symbols, Unicode, or text in the title. -Note: disabling this filter will also exclude CJK languages, Cyrillic, and other special character sets. +Note: unticking this filter will also exclude CJK languages, Cyrillic, and other special character sets. |Keyword|Select this option to filter by server titles matching a specific word or phrase (case insensitive) |=== ===== Table details After retrieval, the browser presents a table of results with the following parameters. -Due to the density of information, the table will try to render at a minimum of 1920x1080 on a desktop or at fullscreen on a Steam Deck. +Due to the density of information, the table will try to render at a minimum of 1920x1080 +on a desktop or at fullscreen on a Steam Deck. - Total matches/total servers queried - Total players online on all servers @@ -277,13 +312,13 @@ Due to the density of information, the table will try to render at a minimum of - Gametime: the in-game time - Players: this is zero-padded for sorting purposes - Max players: this is zero-padded for sorting purposes -- Distance: the physical distance to the server in kilometers is calculated by geolocation +- Distance: the physical distance to the server in kilometers, calculated by geolocation - IP: the IP address and port - Qport: the query port used to retrieve metadata and rules - ==== My servers -Fetches detailed server information on the list of servers saved in the config file. This is the main place you interact with DZGUI when choosing a server from your list. These details are: +Fetches detailed server information on the list of servers saved by <>. +Outside of the server browser, this is the main place you interact with DZGUI when choosing a server from your list. These details are: - **Server**: name of the server, truncated to 50 chars - **IP/port**: IP address and port in the format `ip:port` @@ -293,56 +328,82 @@ Fetches detailed server information on the list of servers saved in the config f - **ID**: numerical ID from BattleMetrics, used as a reference when troubleshooting or sharing servers - **Ping**: round-trip response time from the server +In the event that a server has multiple maps behind different ports, these will all be displayed +after selecting the initial server. + ==== Quick connect to favorite server Bypasses the server list and quick-connects to a single favorite server specified in advance using the <> option. - ==== Connect by IP - -Instead of relying on server IDs, returns the list of maps behind a given IP. Provide only the IP; no port is necessary. This returns the server metadata for you to verify before connecting. +Instead of relying on server IDs, returns the list of maps behind a given IP. +Provide only the IP; no port is necessary. This returns the server metadata for you to verify before connecting. If there are multiple maps hosted behind an IP (e.g. different maps on varying ports), the application will list all of them. -In order to use this feature, you must have a https://steamcommunity.com/dev/apikey[Steam API key]. You will be asked for a unique URL for your app when registering. -Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1". - -You will be prompted to insert this key into the app when launching the "Connect by IP" feature for the first time. +==== Recent servers +This feature queries the history file for the last 10 servers connected to by any means +(server browser, favorite servers, connect-by-IP, etc.). ==== Add server by ID -Prompts you to add servers to the config file by ID. An indefinite number of servers can be added. These will be listed when using the <> option. +Use the https://www.battlemetrics.com/servers/dayz[BattleMetrics site] to find servers of interest (proximity, player count, rules, etc.) -==== Add favorite server +Each server has a unique ID. This is the string of numbers at the end of the URL. Copy these IDs. +For example, in the URL https://www.battlemetrics.com/servers/dayz/8039514, the ID is `8039514`. + +An indefinite number of servers can be added. These will be listed when using the <> option. + +==== Add (change) favorite server Prompts you to add/change a favorite server to the config file by ID. The name of the server will be updated in the header of the app. This server is used when selecting the <> option. If a favorite server is already enabled, this option switches to "Change favorite server." ==== Delete server Prints a list of human-readable servers currently saved, and lets you delete them by selecting one from the list. ==== List installed mods -Prints a scrollable dialog containing all locally-installed mods and their corresponding symlinks IDs. - -==== Toggle debug mode -Toggles debug mode, which is used to perform dry-runs and output what parameters would have been used to connect to a server. Enabling debug mode also exposes the <> menu, which contains some settings for advanced use. - -==== Report bug -Using the system browser, opens the project's GitHub issues page to submit a report. - -==== Help file -Using the system browser, opens this document. +Prints a scrollable dialog containing all locally-installed mods and their corresponding symlink IDs and directory names. ==== View changelog -Prints the entire changelog up to the current version (and unreleased changes) in-app. +Prints the entire changelog up to the current version in-app. -==== Debug options +==== Advanced options If enabled, this menu contains a sub-menu with various advanced features, enumerated below. ===== Toggle branch -Used to toggle the branch to fetch DZGUI from between `stable` and `testing`. The app ships with the stable branch enabled, with the testing branch being used to elaborate various experimental features. +Used to toggle the branch to fetch DZGUI from between `stable` and `testing`. +The app ships with the stable branch enabled, with the testing branch being used to elaborate various experimental features. + +===== Toggle debug mode +Toggles debug mode, which is used to perform dry-runs and output what parameters would have been used to connect to a server. ===== Generate debug log Writes a list of your current settings to a local file that can be pasted into bug reports. +===== Toggle auto mod install +This feature is experimental. It attempts to queue the mods requested for download +automatically, rather than prompting the user to subscribe to each one. + +Both `wmctrl` and `xdotool` must be installed to use this feature. + +[NOTE] +When using auto mod installation, the mods will not appear as subscribed to in the Steam Workshop. +DZGUI tracks their version internally and will trigger an update if necessary the next time you +attempt to connect. + +===== Force update local mods +A convenience function that attempts to redownload all local mods. Can be used in the event of corruption +or file integrity issues. In conjunction with the <> feature, this feature is experimental. + +==== Help file +Uses xdg-open to open this documentation in the system browser. + +==== Report bug +Uses xdg-open to open the https://github.com/aclist/dztui/issues[bug tracker] in the system browser. + +==== Forum +Uses xdg-open to open the https://github.com/aclist/dztui/discussions[discussion forum] in the system browser. + == Config file key/value pairs -Under normal usage, these values are populated and toggled automatically in-app. This config file is partially compatible DZTUI. +Under normal usage, these values are populated and toggled automatically in-app. This config file is partially compatible with DZTUI. + [%autowidth] |=== @@ -354,28 +415,32 @@ Under normal usage, these values are populated and toggled automatically in-app. |`name`|an arbitrary "handle" name used to identify the player on a server (required by some servers) |`debug`|by default, set to 0; set to `1` to print launch options that would have been run, instead of actually connecting (used for troubleshooting and submitting bug reports) |`branch`|by default, set to `stable`; set to `testing` to fetch the testing branch -|`seen_news`|stores a hash of the news item last seen by the client. This is used to suppress news messages until a new one is posted. +|`seen_news`|stores a hash of the news item last seen by the client. This is used to suppress news messages until a new one is posted +|`term`|the preferred terminal emulator. This key is deprecated. +|`auto_install`|permissible values are 0, 1, and 2. These are set internally depending on if the user enabled auto mod installation +|`staging_dir`|a directory used to stage mods while downloading. This feature is deprecated and is no longer user-configurable +|`default_steam_path`|the path to the default Steam client installation +|`preferred_client`|whether the user prefers native Steam or Flatpak. This value is only set if concurrent installations are found on the system |=== == Troubleshooting/FAQ .Mods take a long time to synchronize when subscribing from Workshop -Steam schedules the downloads in the background and processes them as they are subscribed to. This process is not instantaneous and can take some time. Check the **Downloads** pane of Steam to see live progress. +Steam schedules the downloads in the background and processes them as they are subscribed to. +This process is not instantaneous and can take some time. .Game does not launch through Steam Check the logs emitted by Steam in the terminal, or in `/error.log`. .Game launches, but throws a "mod missing/check PBO file" error when connecting -In rare cases, the server may be using misconfigured, malformed, or obsolete mods. This is out of our control and depends on server operators checking their mods for integrity. If you believe the mods are correct and this is a bug, please report it. +In rare cases, the server may be using misconfigured, malformed, or obsolete mods. +This depends on server operators checking their mods for integrity. .Game and server launches, but when joining the game world, an error occurs A mod is corrupted or the issue lies with the server. Replace the mods in question and reconnect. -== Testers wanted -If any of the below apply to you, your https://github.com/aclist/dztui/issues[reports] are encouraged: - -- Using a high resolution (4K) monitor -- Own a Steam Deck -- Seeking DZTUI functionality in DZGUI, or vice versa -- Playing on a server with an enormous amount of mods -- Playing on a server with non-English mod names (?) +.The game is slow or prone to crashing +DayZ does not manipulate the game itself and does not contribute to/degrade its performance. +If you are experiencing performance degradation, it can be caused by too many mods installed or +by a server-side problem (underpowered server, misconfiguration, etc.) Contract the server administrator +for assistance. From 59315d024af7f8e4caaf5bbfd72ed262170de857 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 May 2023 20:08:15 +0900 Subject: [PATCH 38/65] docs: update changelog --- changelog.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index b71e919..d801f30 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,27 @@ # Changelog -## [Unreleased] -- Clean up logging -- Standardize dialogs -- Custom query API -- Store favorites by IP +## [3.3.0] 2023-05-16 +### Added +- Fetch more inclusive global "players in-game" count +- List mod directory on installed mods list +- Detect default Flatpak Steam path +- Dark mode/light mode theme to help file +- Alpha-sort My Servers list +- Add description of how to enable hidden folders on GTK2/3 +- Initial logging framework + +### Changed +- Test for wmctrl when enabling full auto mod installation +- Steam Deck: block toggling full auto mod installation due to extra dependencies needed +- First-time setup: sudo escalation when checking system map count for the first time + +### Fixed +- Steam Deck: non-ASCII delimiter causing setup menu to despawn on some devices +- Don't add items in My Servers multiple times to array when the list of favorites is paginated +- Trigger progress dialogs sooner and in sequence to reduce appearance of visual lag +- First-time setup: break out of dialogs correctly when user backs out +- First-time setup: break out of automatic path discovery when user specifies a path manually +- More portable interpreter invocation ## [3.2.10] 2023-05-11 ### Fixed From b57fdb015d525b100c002b79da2dd74c9c87cb1f Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 May 2023 20:08:29 +0900 Subject: [PATCH 39/65] chore: bump version --- dzgui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index d9df189..97b5cd0 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=3.2.24 +version=3.3.0 aid=221100 game="dayz" From 88ffaf5c97335a994d1c0391198801b4ace33713 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 May 2023 20:09:43 +0900 Subject: [PATCH 40/65] docs: update changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index d801f30..2f919d9 100644 --- a/changelog.md +++ b/changelog.md @@ -22,6 +22,7 @@ - First-time setup: break out of dialogs correctly when user backs out - First-time setup: break out of automatic path discovery when user specifies a path manually - More portable interpreter invocation +- Properly size down window resolution when returning from server browser ## [3.2.10] 2023-05-11 ### Fixed From 4db53dcf16a019c16f8eefd00c5c1e96981a79a6 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 May 2023 20:12:16 +0900 Subject: [PATCH 41/65] docs: bump news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index dbfa68c..3024970 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Backend hotfixes to support Steam Beta UI. Version 3.3.0 release imminent +NEWS: Better first-time setup for Steam Deck/Flatpak installs & misc. hardening From 94670ff12a6d0a14e0371a4ca9946bd2d012519c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 19 May 2023 12:43:27 +0900 Subject: [PATCH 42/65] docs: update documentation --- docs/dzgui.adoc | 476 +++++++++++++++++++++++++++++++++++++++++++ docs/dzgui_dark.adoc | 476 +++++++++++++++++++++++++++++++++++++++++++ dzgui.sh | 121 +++++------ 3 files changed, 1002 insertions(+), 71 deletions(-) create mode 100644 docs/dzgui.adoc create mode 100644 docs/dzgui_dark.adoc diff --git a/docs/dzgui.adoc b/docs/dzgui.adoc new file mode 100644 index 0000000..554e9ef --- /dev/null +++ b/docs/dzgui.adoc @@ -0,0 +1,476 @@ +:nofooter: +:toc: left +:stylesheet: custom.css + += DZGUI documentation +DayZ official/community server graphical launcher for Linux | Last updated: 2023-05-15 + +Click https://aclist.github.io/dzgui/dzgui_dark.html[here] for dark mode + +== What this is +A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. +Used to list official and community server details and quick connect to preferred servers +by staging mods and concatenating launch options automatically. + +Development on DZTUI (terminal client) has stopped at this time. +Instead, DZGUI brings numerous functionality and security improvements and is intended to be a more user-friendly, +turnkey solution for graphical desktop environments, and can also be used on the Steam Deck or similar devices. + +== Setup +=== Dependencies +If not already installed, the below can be found in your system's package manager. + +If any dependencies are missing when the application starts, it will warn you, so you need not take any preemptive measures here. + +- `curl` +- `jq` +- `zenity` +- `steam` +- `wmctrl` or `xdotool` + +=== Preparation +. **Download DZGUI and make it executable:** + +Automatic method: generic OS (skip to step 3 below when complete) + +``` +curl -s "https://raw.githubusercontent.com/aclist/dztui/main/install.sh" | bash +``` + +Automatic method: nix-based systems (contributed by lelgenio) + +Follow the instructions at https://github.com/lelgenio/dzgui-nix to ingest the package and dependencies +into your system using flakes. + +Manual method + +``` +git clone https://github.com/aclist/dztui.git +chmod +x dzgui.sh +``` + +''' +[start=2] +. **Update the `vm.max_map_count` value (see https://www.protondb.com/app/221100)** + +**Automatic method:** + +This is handled automatically by DZGUI if you just choose to run the application out of the box. +You will be prompted for your sudo password in order to check whether the system map count is too small. +This is a one-time check that will not be triggered again once the map count is updated. +If you used the automatic method, you can skip to Step 3 below. + +[NOTE] +The map count check prompts for a sudo password. If you are using a Steam Deck and have never set a sudo password, +you must enter Desktop Mode, invoke `passwd` from Konsole, and type your desired password twice to set it. + +This process writes the count to the file `/etc/sysctl.d/dayz.conf`. + +If the map count was lower than the threshold, it is updated to 1048576. +If the system map count was already higher, that value is interpolated into this file as a redundancy check. + +[NOTE] +If, for reasons unrelated to DayZ, you choose at a later time to raise your system map count higher than it originally was and +you find that the count is not sticking, check for the presence of the `dayz.conf` file to see if it is taking precedence and delete it accordingly. + +**Ephemeral method:** +the map count will revert after the system is rebooted. + +``` +sudo sysctl -w vm.max_map_count=1048576 +``` + +**Persistent method:** +``` +echo 'vm.max_map_count=1048576' | sudo tee /etc/sysctl.d/dayz.conf +``` + +[start=3] +. **Prepare a Steam account with a DayZ license** +. **Enable a Proton version ≥ `6.8` (or use Experimental) in the `Compatibility` field of the game's right-click options.** + +=== API key & server IDs +==== BattleMetrics API key +1. Register for an API key at https://www.battlemetrics.com/account/register?after=%2Fdevelopers[BattleMetrics] (free) +2. From the **Personal Access Tokens** area, Select **New Token** +3. Give the token any name in the field at the top +4. Leave all options **unchecked** and scroll to the bottom, select **Create Token** +5. Copy the access token for later use (see below). This is the unique token you will use to query servers. + +==== Steam API key +1. Register for a https://steamcommunity.com/dev/apikey[Steam API key] (free) using your Steam account. You will be asked for a unique URL for your app when registering. +2. Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1" or some other name that is meaningful to you. +3. Once configured, you can insert this key in the app when launching it for the first time. + +=== First-time launch + +0. It is always advised to have Steam running in the background. DayZ is meant to run "on top of" Steam. + +1. DZGUI can be launched one of two ways. + +**From the terminal:** + +``` +./dzgui.sh +``` + +Launching from the terminal gives more verbose information in the event of a crash, +and can be a good way of troubleshooting problems. + +**From the shortcut shipped with the application** (if using a desktop environment based on the Freedesktop specification): + +- Located under the "Games" category of your system's applications list. +- Via the DZGUI desktop shortcut (Steam Deck only) + +[start=2] +2. Follow the menu prompts given by the app. You will be asked to provide: + +- Player name (a generic handle, required by some servers) +- BM API key (see above) +- Steam API key + +==== Steam path discovery + +DZGUI will then attempt to locate your default Steam installation and DayZ path. You *must* have DayZ installed in your Steam library in order to proceed. (It can be installed to any drive of your choosing.) +If DZGUI cannot find Steam or cannot find DayZ installed at the detected Steam path, it will prompt you to manually specify the path to your Steam installation. + +Specify the top-level entry point to Steam, not DayZ. E.g., + +`/media/mydrive/Steam`, not `/media/mydrive/Steam/steamapps/common/DayZ` + +If your Steam installation is in a hidden folder but the file picker dialog does not show hidden folders, ensure that your GTK settings are set to show hidden files. + +For GTK 2, edit the file below so that `ShowHidden=true`: + +`~/.config/gtk-2.0/gtkfilechooser.ini` + +For GTK 3, invoke the command: + +`gsettings set org.gtk.Settings.FileChooser show-hidden true` + +=== Steam integration & artwork + +==== Adding to steam + +DZGUI can be added to Steam as a "non-Steam game" in order to facilitate integration with Steam Deck or desktop environments. + +1. Launch Steam in the "Large" view. + +[NOTE] +Steam Deck: you must switch to "Desktop Mode" and launch Steam from the desktop. + +[start=2] +2. Select **Add a Game** > **Add a Non-Steam Game** from the lower left-hand corner. + +image::https://github.com/aclist/dztui/raw/testing/images/tutorial/01.png[01,500] + +[start=3] +3. Navigate to `$HOME/.local/share/applications/` and select `dzgui.desktop` +4. Select **Add Selected Programs**. + +==== Controller layout + +An official controller layout for Steam Deck is available in the Steam community layouts section. Search for "DZGUI Official Config" to download it. Long-press the View button and Select button (☰) to toggle D-pad navigation. This creates an additional layer that lets you navigate through menus using the D-pad and A/B to respectively confirm selections and go back. Remember to toggle this layer off again after launching your game to revert back to the master layer. + +==== Artwork + +The application also ships with Steam cover artwork. It is located under: + +``` +$HOME/.local/share/dzgui +``` + +The artwork consists of four parts: + +1. Grid: a vertical "box art" grid used on library pages +2. Hero: a large horizontal banner used on the app's details page +3. Logo: a transparent icon used to remove Steam's default app text +4. dzgui: used by freedesktop shortcut to generate a desktop icon; not intended for the user + +Updating the artwork: + +1. Navigate to the app's details page and right-click the blank image header at the top. + +image::https://github.com/aclist/dztui/raw/testing/images/tutorial/03.png[03,700] + +[start=2] +2. Select **Set Custom Background** +3. Select to display All Files from the File type dropdown +4. Navigate to the artwork path described above and select `hero.png`. +5. Next, right-click the image background and select **Set Custom Logo**. + +image::https://github.com/aclist/dztui/raw/testing/images/tutorial/04.png[04,700] + +[start=5] +5. Navigate to the same path and select `logo.png`. Notice that this removes the redundant app name that occluded the image. + +image::https://github.com/aclist/dztui/raw/testing/images/tutorial/05.png[05,700] + +[start=6] +6. Next, navigate to your Library index (looks like a bookshelf of cover art) and find the DZGUI app. + +[start=7] +7. Right-click its cover and select **Manage** > **Set custom artwork**. + +image::https://github.com/aclist/dztui/raw/testing/images/tutorial/06.png[06,700] + +[start=8] +8. Navigate to the same path and select `grid.png`. The final result: + +image::https://github.com/aclist/dztui/raw/testing/images/tutorial/07.png[07,700] + + +=== Updating the app +If DZGUI detects a new upstream version, it will prompt you to download it automatically. +It backs up the original version before fetching the new one, then updates your config file with your existing values. Once finished, it will ask you to relaunch the app. + +If you decline to upgrade to the new version, DZGUI will continue to the main menu with the current version. + +[NOTE] +New versions may include changes to bugs that could prevent you from playing on certain servers. +Upgrading is always advised. + +If you experience a problem or need to restore the prior version of DZGUI and/or your configs, +it is enough to simply replace the new version with the old one and relaunch the app. +The files can be found at: + +Script: +``` +