From 7d7965b87464dc5c08d58e989307bbe8c33b96b6 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 18 Jul 2022 01:28:46 +0900 Subject: [PATCH 01/63] Add line break --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bcca7da..06c5eb7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ -A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. [Documentation](https://aclist.github.io/dzgui/dzgui.html) +A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. +[Documentation](https://aclist.github.io/dzgui/dzgui.html) ![Alt text](example.png) From 5947e04b32f684e693128c2f32e31a1de599bc0c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 18 Jul 2022 04:27:42 +0900 Subject: [PATCH 02/63] Add hotfix --- changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog.md b/changelog.md index f23c1ea..c1ebbab 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,13 @@ - Port DZTUI symlink logic to DZGUI - Add method of handling legacy symlinks +## [2.2.1] 2022-07-17 +### Fixed +- Hotfix for upstream API returning malformed modlists +- Handle servers with no mods +- Fix dialog window depending on browser exit +- Remove stray newlines in config file + ## [2.2.0] 2022-06-22 ### Added - Toggle debug mode in-app From e5e90a1b80adca45a202e243db3ea45377e1d6bb Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 18 Jul 2022 04:27:50 +0900 Subject: [PATCH 03/63] Hotfix for broken API --- dzgui.sh | 62 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 14101b7..4b61e70 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,10 +1,10 @@ #!/bin/bash set -o pipefail -version=2.2.0 +version=2.2.1 aid=221100 game="dayz" -workshop="https://steamcommunity.com/sharedfiles/filedetails/?id=" +workshop="steam://url/CommunityFilePage/" api="https://api.battlemetrics.com/servers" sd_res="--width=1280 --height=800" config_path="$HOME/.config/dztui/" @@ -17,6 +17,12 @@ help_url="https://aclist.github.io/dzgui/dzgui" upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') check_config_msg="Check config values and restart." +#TODO: prevent connecting to offline servers +#TODO: concat large mod links +#TODO: check map count and warn + #sysctl -q vm.max_map_count + #prompt password +#TODO: abstract zenity title params declare -A deps deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [zenity]="3.42.1") @@ -34,6 +40,7 @@ depcheck(){ done } init_items(){ + #array order determines menu selector; this is destructive items=( "Launch server list" "Quick connect to favorite server" @@ -46,10 +53,11 @@ items=( "View changelog" ) } -#exit_and_cleanup(){ -#rm $tmp -#rm $link_file -#} +exit_and_cleanup(){ + #TODO: this is currently unused + rm $tmp + rm $link_file +} warn_and_exit(){ zenity --info --title="DZGUI" --text="$1" --icon-name="dialog-warning" 2>/dev/null printf "[DZGUI] %s\n" "$check_config_msg" @@ -91,7 +99,6 @@ query_api(){ } write_config(){ cat <<-END - #Path to DayZ installation steam_path="$steam_path" @@ -109,7 +116,6 @@ name="$name" #Set to 1 to perform dry-run and print launch options debug="0" - END } guess_path(){ @@ -200,7 +206,7 @@ open_mod_links(){ echo "${workshop}$i
" done >> $link_file echo "" >> $link_file - browser "$link_file" + browser "$link_file" & } manual_mod_install(){ @@ -246,7 +252,7 @@ symlinks(){ printf "[DZGUI] Creating symlink for $mod\n" ln -fs "$d" "$game_dir/$link" fi - done + done } passed_mod_check(){ echo "[DZGUI] Passed mod check" @@ -258,7 +264,7 @@ connect(){ #TODO: sanitize/validate input ip=$(echo "$1" | awk -F"$separator" '{print $1}') bid=$(echo "$1" | awk -F"$separator" '{print $2}') - fetch_mods "$bid" + fetch_mods_sa "$ip" validate_mods rc=$? [[ $rc -eq 1 ]] && return @@ -270,11 +276,23 @@ connect(){ fi } +fetch_mods_sa(){ + sa_ip=$(echo $ip | awk -F: '{print $1}') + for i in ${qport_arr[@]}; do + if [[ -n $(echo "$i" | awk -v ip=$ip -F: '$0 ~ ip') ]]; then + sa_port=$(echo $i | awk -v ip=$ip -F: '$0 ~ ip {print $3}') + fi + done + echo "[DZGUI] Querying modlist on ${sa_ip}:${sa_port}" + remote_mods=$(curl -Ls "https://dayzsalauncher.com/api/v1/query/$sa_ip/$sa_port" | jq -r '.result.mods[].steamWorkshopId') +} fetch_mods(){ + #TODO: broken upstream remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \ | jq -r '.data[] .attributes .details .modIds[]') } check_workshop(){ + #TODO: legacy method is defunct curl -Ls "$url${modlist[$i]}" | grep data-appid | awk -F\" '{print $8}' } query_defunct(){ @@ -311,13 +329,17 @@ installed_mods(){ ls -1 "$workshop_dir" } concat_mods(){ - readarray -t serv <<< "$(server_modlist)" - for i in "${serv[@]}"; do - id=$(awk -F"= " '/publishedid/ {print $2}' "$workshop_dir"/$i/meta.cpp | awk -F\; '{print $1}') - mod=$(awk -F\" '/name/ {print $2}' "$workshop_dir"/$i/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g') - link="@$id-$mod;" - echo -e "$link" - done | tr -d '\n' | perl -ple 'chop' + if [[ -z ${remote_mods[@]} ]]; then + return 1 + else + readarray -t serv <<< "$(server_modlist)" + for i in "${serv[@]}"; do + id=$(awk -F"= " '/publishedid/ {print $2}' "$workshop_dir"/$i/meta.cpp | awk -F\; '{print $1}') + mod=$(awk -F\" '/name/ {print $2}' "$workshop_dir"/$i/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g') + link="@$id-$mod;" + echo -e "$link" + done | tr -d '\n' | perl -ple 'chop' + fi } launch(){ mods=$(concat_mods) @@ -456,7 +478,9 @@ main_menu(){ } parse_json(){ list=$(jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') + qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port):\(.portQuery)"') echo -e "$list" > $tmp + readarray -t qport_arr <<< "$qport_list" } check_ping(){ ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}') @@ -574,7 +598,7 @@ check_architecture(){ fi } add_by_id(){ - #TODO: prevent redundant creation of existent IDs + #TODO: prevent redundant creation of existent IDs (for neatness) while true; do id=$(zenity --entry --text="Enter server ID" --title="DZGUI" 2>/dev/null) rc=$? From ce8046e9540e7eae5979c2e6866520e9479deb2c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 18 Jul 2022 17:45:56 +0900 Subject: [PATCH 04/63] Hotfix for fav server select on main menu --- dzgui.sh | 94 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 18 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 4b61e70..8e50f09 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.2.1 +version=2.3.0 aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" @@ -11,10 +11,10 @@ config_path="$HOME/.config/dztui/" config_file="${config_path}dztuirc" tmp=/tmp/dztui.tmp separator="%%" -git_url="https://github.com/aclist/dztui/issues" -version_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" +git_url="https://github.com/aclist/dztui/issues/new/choose" +stable_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" +testing_url="https://raw.githubusercontent.com/aclist/dztui/testing/dzgui.sh" help_url="https://aclist.github.io/dzgui/dzgui" -upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') check_config_msg="Check config values and restart." #TODO: prevent connecting to offline servers @@ -116,6 +116,9 @@ name="$name" #Set to 1 to perform dry-run and print launch options debug="0" + +#Toggle stable/testing branch +branch="stable" END } guess_path(){ @@ -202,8 +205,10 @@ open_mod_links(){ echo "DZGUI" >> $link_file echo "

DZGUI

" >> $link_file echo "

Open these links and subscribe to them on the Steam Workshop, then continue with the application prompts.
Note: it may take some time for mods to synchronize before DZGUI can see them.
It can help to have Steam in an adjacent window so that you can see the downloads completing.

" >> $link_file - for i in $diff; do - echo "${workshop}$i
" + n=1 + for i in $diff; do + echo "$n. ${workshop}$i
" + let n++ done >> $link_file echo "" >> $link_file browser "$link_file" & @@ -262,7 +267,13 @@ passed_mod_check(){ } connect(){ #TODO: sanitize/validate input + readarray -t qport_arr <<< "$qport_list" + if [[ -z ${qport_arr[@]} ]]; then + err "Failed to process favorite server" + return + fi ip=$(echo "$1" | awk -F"$separator" '{print $1}') + #TODO: deprecated (for now) bid=$(echo "$1" | awk -F"$separator" '{print $2}') fetch_mods_sa "$ip" validate_mods @@ -279,12 +290,17 @@ connect(){ fetch_mods_sa(){ sa_ip=$(echo $ip | awk -F: '{print $1}') for i in ${qport_arr[@]}; do - if [[ -n $(echo "$i" | awk -v ip=$ip -F: '$0 ~ ip') ]]; then - sa_port=$(echo $i | awk -v ip=$ip -F: '$0 ~ ip {print $3}') + if [[ -n $(echo "$i" | awk -v ip=$ip '$0 ~ ip') ]]; then + sa_port=$(echo $i | awk -v ip=$ip -F$separator '$0 ~ ip {print $2}') fi done echo "[DZGUI] Querying modlist on ${sa_ip}:${sa_port}" remote_mods=$(curl -Ls "https://dayzsalauncher.com/api/v1/query/$sa_ip/$sa_port" | jq -r '.result.mods[].steamWorkshopId') + rc=$? + if [[ $rc -eq 1 ]]; then + err "Failed to fetch modlist" + return + fi } fetch_mods(){ #TODO: broken upstream @@ -388,10 +404,10 @@ populate(){ while true; do #TODO: add boolean statement for ping flag; affects all column ordinal output cols="--column="Server" --column="IP" --column="Players" --column="Gametime" --column="Status" --column="ID" --column="Ping"" - sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Fav: $fav_label" \ - --separator="$separator" --print-column=2,6 2>/dev/null) + set_header ${FUNCNAME[0]} rc=$? - if [[ $rc -eq 0 ]]; then if [[ -z $sel ]]; then + if [[ $rc -eq 0 ]]; then + if [[ -z $sel ]]; then warn "No item was selected." else connect $sel @@ -414,15 +430,47 @@ connect_to_fav(){ if [[ -n $fav ]]; then one_shot_launch=1 query_api - sel=$(jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.id)"' <<< $response) + qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"') echo "[DZGUI] Attempting connection to $fav_label" - connect "$sel" + connect "$qport_list" one_shot_launch=0 else warn "No fav server configured" fi } +set_header(){ + if [[ $1 == "populate" ]]; then + sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ + --separator="$separator" --print-column=2,6 2>/dev/null) + elif [[ $1 == "main_menu" ]]; then + sel=$(zenity --width=1280 --height=800 --list --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ + --cancel-label="Exit" --ok-label="Select" --column="Select launch option" "${items[@]}" 2>/dev/null) + fi +} +toggle_branch(){ + mv $config_file ${config_path}dztuirc.old + nr=$(awk '/branch=/ {print NR}' ${config_path}dztuirc.old) + if [[ $branch == "stable" ]]; then + branch="testing" + else + branch="stable" + fi + flip_branch="branch=\"$branch\"" + awk -v "var=$flip_branch" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > $config_file + printf "[DZGUI] Toggled branch to '$branch'\n" + source $config_file +} +debug_menu(){ + debug_list=( + "Toggle branch" + ) + debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" "${debug_list[@]}" 2>/dev/null) + if [[ $debug_sel == "${debug_list[0]}" ]]; then + toggle_branch + check_version + fi +} main_menu(){ if [[ $debug -eq 1 ]]; then items+=("Debug options") @@ -432,8 +480,7 @@ main_menu(){ items[3]="Change favorite server" fi while true; do - sel=$(zenity --width=1280 --height=800 --list --title="DZGUI" --text="DZGUI $version | Mode: $mode | Fav: $fav_label" \ - --cancel-label="Exit" --ok-label="Select" --column="Select launch option" "${items[@]}" 2>/dev/null) + set_header ${FUNCNAME[0]} rc=$? if [[ $rc -eq 0 ]]; then if [[ -z $sel ]]; then @@ -468,6 +515,8 @@ main_menu(){ help_file elif [[ $sel == "${items[8]}" ]]; then changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null + elif [[ $sel == "${items[9]}" ]]; then + debug_menu else warn "This feature is not yet implemented." fi @@ -478,9 +527,8 @@ main_menu(){ } parse_json(){ list=$(jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') - qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port):\(.portQuery)"') + qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"') echo -e "$list" > $tmp - readarray -t qport_arr <<< "$qport_list" } check_ping(){ ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}') @@ -573,12 +621,22 @@ download_new_version(){ fi } +check_branch(){ + if [[ $branch == "stable" ]]; then + version_url="$stable_url" + elif [[ $branch == "testing" ]]; then + version_url="$testing_url" + fi + upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') +} check_version(){ + source $config_file + check_branch if [[ $version == $upstream ]]; then check_unmerged else echo "[DZGUI] Upstream ($upstream) is > local ($version)" - zenity --question --title="DZGUI" --text "Newer version available.\n\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null + zenity --question --title="DZGUI" --text "Newer version available.\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 48c66e2df2dde9bf82ea0becfc7eb4415543afd6 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 18 Jul 2022 17:45:58 +0900 Subject: [PATCH 05/63] Bump minor version --- changelog.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index c1ebbab..a989eb1 100644 --- a/changelog.md +++ b/changelog.md @@ -2,8 +2,17 @@ ## [Unreleased] - Clean up logging -- Port DZTUI symlink logic to DZGUI -- Add method of handling legacy symlinks +- Concatenate long mod launch params +- Port DZTUI method of handling legacy symlinks + +## [2.3.0] 2022-07-18 +### Added +- Numbered mod links in browser +- Admonition to upgrade versions for bug fixes +- Toggle branch between stable/testing + +### Fixed +- Hotfix for fav server select on main menu ## [2.2.1] 2022-07-17 ### Fixed From 9b783564532e53df8d84cd04696a59e6de67737c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sat, 23 Jul 2022 02:11:14 +0900 Subject: [PATCH 06/63] Reformat --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06c5eb7..820716d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. -[Documentation](https://aclist.github.io/dzgui/dzgui.html) + +**Setup and usage** +Refer to the [documentation](https://aclist.github.io/dzgui/dzgui.html) ![Alt text](example.png) From 7b820242eb4a27770acb289d915ddd2b5cb152e3 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sat, 23 Jul 2022 02:11:24 +0900 Subject: [PATCH 07/63] Reformat --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 820716d..f5ccdfc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. **Setup and usage** + Refer to the [documentation](https://aclist.github.io/dzgui/dzgui.html) ![Alt text](example.png) From c0dc49a30e6aa411c0a4ee46d7d6a51261693722 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sat, 23 Jul 2022 02:12:01 +0900 Subject: [PATCH 08/63] Reformat --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5ccdfc..a06e251 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ +## What this is + A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. -**Setup and usage** +## Setup and usage Refer to the [documentation](https://aclist.github.io/dzgui/dzgui.html) From d4ba87a5c6030bbc9802d083cd52f61d7d749222 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 24 Jul 2022 20:57:04 +0900 Subject: [PATCH 09/63] Add news file --- news | 1 + 1 file changed, 1 insertion(+) create mode 100644 news diff --git a/news b/news new file mode 100644 index 0000000..6a116a5 --- /dev/null +++ b/news @@ -0,0 +1 @@ +NEWS: test From 98a9e5bfc1f218f9a75500cd669804dbddafb2bd Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 24 Jul 2022 21:44:17 +0900 Subject: [PATCH 10/63] Test news update --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index 6a116a5..e231dc3 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: test +NEWS: test 2 From 680d741a4cc4a30838c15b91113f2def8038bedb Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 24 Jul 2022 22:18:15 +0900 Subject: [PATCH 11/63] Update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index e231dc3..2417cf0 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: test 2 +NEWS: Initial prototype of over-the-air news updates. Once seen, this message will be suppressed on next restart. From fcb3e905e4f91d7f85a2b022b1500d3f85283fce Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 24 Jul 2022 22:40:39 +0900 Subject: [PATCH 12/63] Update docs --- dzgui.adoc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index ccec409..f0105f3 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -36,6 +36,10 @@ 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=2] . 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. @@ -120,10 +124,16 @@ Bypasses the server list and quick-connects to a single favorite server specifie 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. ==== Add favorite server -Prompts you to add 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. +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. +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. @@ -134,8 +144,14 @@ 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. + == Config file key/value pairs -Under normal usage, these values are populated automatically in-app. In the future, this config file will also be compatible with DZTUI. +Under normal usage, these values are populated and toggled automatically in-app. This config file is partially compatible DZTUI. [%autowidth] |=== @@ -146,6 +162,8 @@ Under normal usage, these values are populated automatically in-app. In the futu |`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 @@ -169,4 +187,4 @@ If any of the below apply to you, your https://github.com/aclist/dztui/issues[re - 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 (?) +- Playing on a server with non-ASCII mod names (?) From d1f7cacf15607e7ffd5a7e3edfc7325106dda4cf Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 4 Aug 2022 20:59:27 +0900 Subject: [PATCH 13/63] Prompt to restart first-time setup if failed --- dzgui.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 8e50f09..9465ada 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,8 @@ + #!/bin/bash set -o pipefail -version=2.3.0 +version=2.3.1 aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" @@ -15,7 +16,7 @@ git_url="https://github.com/aclist/dztui/issues/new/choose" stable_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" testing_url="https://raw.githubusercontent.com/aclist/dztui/testing/dzgui.sh" help_url="https://aclist.github.io/dzgui/dzgui" -check_config_msg="Check config values and restart." +check_config_msg="Check config file for errors." #TODO: prevent connecting to offline servers #TODO: concat large mod links @@ -115,10 +116,10 @@ fav="$fav" name="$name" #Set to 1 to perform dry-run and print launch options -debug="0" +debug="$debug" #Toggle stable/testing branch -branch="stable" +branch="$branch" END } guess_path(){ @@ -147,13 +148,40 @@ guess_path(){ echo "[DZGUI] Set Steam path to $steam_path" } create_config(){ + while true; do player_input="$(zenity --forms --add-entry="Player name (required for some servers)" --add-entry="API key" --add-entry="Server 1 (you can add more later)" --title=DZGUI --text=DZGUI --add-entry="Server 2" --add-entry="Server 3" --add-entry="Server 4" $sd_res --separator="│")" - name=$(echo "$player_input" | awk -F│ '{print $1}') - api_key=$(echo "$player_input" | awk -F│ '{print $2}') - whitelist=$(echo "$player_input" | awk -F"│" '{OFS=","}{print $3,$4,$5}' | sed 's/,*$//g' | sed 's/^,*//g') + #explicitly setting IFS crashes 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') + name="${args[0]}" + api_key="${args[1]}" + server_1="${args[2]}" + server_2="${args[3]}" + server_3="${args[4]}" + server_4="${args[5]}" + + [[ -z $player_input ]] && exit + if [[ -z $api_key ]]; then + warn "API key: invalid value" + elif [[ -z $server_1 ]]; then + warn "Server 1: cannot be empty" + elif [[ ! $server_1 =~ ^[0-9]+$ ]]; then + warn "Server 1: only numeric IDs" + elif [[ -n $server_2 ]] && [[ ! $server_2 =~ ^[0-9]+$ ]]; then + warn "Server 2: only numeric IDs" + elif [[ -n $server_3 ]] && [[ ! $server_3 =~ ^[0-9]+$ ]]; then + warn "Server 3: only numeric IDs" + elif [[ -n $server_4 ]] && [[ ! $server_3 =~ ^[0-9]+$ ]]; then + warn "Server 4: only numeric IDs" + else + whitelist=$(echo "$player_input" | awk -F"│" '{OFS=","}{print $3,$4,$5,$6}' | sed 's/,*$//g' | sed 's/^,*//g') guess_path > >(zenity --progress --auto-close --pulsate) mkdir -p $config_path; write_config > $config_file info "Config file created at $config_file." + return + fi + done } err(){ @@ -164,6 +192,7 @@ varcheck(){ [[ -z $whitelist ]] && (err "Error in key: 'whitelist'") [[ ! -d $game_dir ]] && (err "Malformed game path") [[ $whitelist =~ [[:space:]] ]] && (err "Separate whitelist values with commas") + } run_depcheck() { if [[ -z $(depcheck) ]]; then @@ -180,9 +209,15 @@ run_varcheck(){ if [[ -z $(varcheck) ]]; then : else - zenity --warning --ok-label="Exit" --text="$(varcheck)" 2>/dev/null + zenity --warning --text="$(varcheck)" 2>/dev/null printf "[DZGUI] %s\n" "$check_config_msg" - exit + zenity --question --cancel-label="Exit" --text="Malformed config file. This is probably user error.\nStart first-time setup process again?" 2>/dev/null + code=$? + if [[ $code -eq 1 ]]; then + exit + else + create_config + fi fi } config(){ From 1d020f4233d0e674487e70bd43586877b6048b34 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 4 Aug 2022 20:59:31 +0900 Subject: [PATCH 14/63] Bump version --- changelog.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index a989eb1..ed31d32 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,22 @@ # Changelog -## [Unreleased] +## [Unreleased] +Fields marked with [Testing] are live in Testing branch - Clean up logging -- Concatenate long mod launch params -- Port DZTUI method of handling legacy symlinks +- Concatenate long mod launch params [Testing] +- Port DZTUI method of handling legacy symlinks [Testing] +- Delete server [Testing] +- Better SD handling [Testing] +- Write log to file for bug reports [Testing] +- Prompt to increase map count size [Testing] + +## [2.3.1] 2022-08-04 +### Fixed +- Improved error handling of first-time setup fields +- Interpolate config file values for debug, branch when writing file + +### Changed +- Prompt user to restart first-time setup if broken config is found ## [2.3.0] 2022-07-18 ### Added From c838f90861741ef04c041a66bdb2ee987cf4edc2 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 5 Aug 2022 03:27:29 +0900 Subject: [PATCH 15/63] Set branch to stable if no config file present --- dzgui.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index 9465ada..3113baf 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -665,7 +665,10 @@ check_branch(){ upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') } check_version(){ - source $config_file + if [[ ! -f $config_file ]]; then : else source $config_file; fi + if [[ -z $branch ]]; then + branch="stable" + fi check_branch if [[ $version == $upstream ]]; then check_unmerged From cfc1edc2f51f318fa675f4314cfb25fc0ceda5b9 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 5 Aug 2022 03:28:23 +0900 Subject: [PATCH 16/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index ed31d32..ea7ad3a 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,10 @@ Fields marked with [Testing] are live in Testing branch - Write log to file for bug reports [Testing] - Prompt to increase map count size [Testing] +## [2.3.2] 2022-08-04 +### Fixed +Set branch flag to 'stable' if no config file present + ## [2.3.1] 2022-08-04 ### Fixed - Improved error handling of first-time setup fields From a5bc902b7c03d505cc65795260ca727037b23f9c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 5 Aug 2022 03:28:46 +0900 Subject: [PATCH 17/63] Config flag hotfix --- dzgui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index 3113baf..c0890cf 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -2,7 +2,7 @@ #!/bin/bash set -o pipefail -version=2.3.1 +version=2.3.2 aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" From e5378a85d5193b81a27cc0231cfdde81539c3c91 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 5 Aug 2022 04:10:07 +0900 Subject: [PATCH 18/63] Fix typo --- dzgui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index c0890cf..b745e9b 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -665,7 +665,7 @@ check_branch(){ upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') } check_version(){ - if [[ ! -f $config_file ]]; then : else source $config_file; fi + if [[ ! -f $config_file ]]; then : ; else source $config_file; fi if [[ -z $branch ]]; then branch="stable" fi From 5f5cb0afa4b0d337a6a6b7d7b9071a2dbe4e3c2c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 5 Aug 2022 04:10:32 +0900 Subject: [PATCH 19/63] Bump version --- dzgui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index b745e9b..33f0d4a 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -2,7 +2,7 @@ #!/bin/bash set -o pipefail -version=2.3.2 +version=2.3.3 aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" From 475e830ea80920402657b791fec70cea35cfb88e Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 7 Aug 2022 10:49:05 +0900 Subject: [PATCH 20/63] Prepare news blurb --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index 2417cf0..3ed3be0 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Initial prototype of over-the-air news updates. Once seen, this message will be suppressed on next restart. +NEWS: This update includes numerous QOL and backend fixes. If you encounter problems, please submit a report. From a4244e79b8e75b6f2e122f96e666888abcff451b Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 7 Aug 2022 10:49:37 +0900 Subject: [PATCH 21/63] Add license --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 65168bd616162400ac32c56b627f2f66e7e7cd01 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 7 Aug 2022 14:31:28 +0900 Subject: [PATCH 22/63] Bump version --- changelog.md | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index ea7ad3a..804ce7d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,14 +1,31 @@ # Changelog ## [Unreleased] -Fields marked with [Testing] are live in Testing branch - Clean up logging -- Concatenate long mod launch params [Testing] -- Port DZTUI method of handling legacy symlinks [Testing] -- Delete server [Testing] -- Better SD handling [Testing] -- Write log to file for bug reports [Testing] -- Prompt to increase map count size [Testing] +- Custom query API + +## [2.4.0] 2022-08-07 +### Added +- Delete server command added to main menu +- Write log to file for bug reports +- Prompt to permanently increase map count size +- Dependency check for Steam +- Cover artwork +- News backend for OTA updates +- Clean up stale symlinks when checking mods + +### Fixed +- Minify long mod launch params for servers with launch params breaking the upper limit +- Port DZTUI method of handling legacy symlinks +- Prevent user from entering invalid data on first-time setup +- Prompt to re-run first-time setup if config is malformed +- Better handling of field output from table +- Better Steam Deck detection and handling +- Prevent garbage in error messages +- Miscellaneous backend improvements + +### Changed +- Enforce download when switching branches ## [2.3.2] 2022-08-04 ### Fixed From e2ee67bccd0b045b4d19592361ba489e50d40b89 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 7 Aug 2022 14:41:31 +0900 Subject: [PATCH 23/63] Bump version --- dzgui.sh | 411 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 290 insertions(+), 121 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 33f0d4a..b180783 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,8 +1,7 @@ - #!/bin/bash set -o pipefail -version=2.3.3 +version=2.4.0 aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" @@ -12,23 +11,49 @@ config_path="$HOME/.config/dztui/" config_file="${config_path}dztuirc" tmp=/tmp/dztui.tmp separator="%%" -git_url="https://github.com/aclist/dztui/issues/new/choose" +git_url="https://github.com/aclist/dztui/issues" stable_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" testing_url="https://raw.githubusercontent.com/aclist/dztui/testing/dzgui.sh" help_url="https://aclist.github.io/dzgui/dzgui" -check_config_msg="Check config file for errors." +check_config_msg="Check config values and restart." +news_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/news" +freedesktop_path="$HOME/.local/share/applications" +sd_install_path="$HOME/.local/share/dzgui" +update_last_seen(){ + mv $config_file ${config_path}dztuirc.old + nr=$(awk '/seen_news=/ {print NR}' ${config_path}dztuirc.old) + seen_news="seen_news=\"$sum\"" + awk -v "var=$seen_news" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > $config_file + printf "[DZGUI] Updated last seen news item to '$sum'\n" + source $config_file +} +check_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="" + else + hchar="─" + news="$result\n$(awk -v var="$hchar" 'BEGIN{for(c=0;c<90;c++) printf var;}')\n" + update_last_seen + fi +} #TODO: prevent connecting to offline servers -#TODO: concat large mod links -#TODO: check map count and warn - #sysctl -q vm.max_map_count - #prompt password #TODO: abstract zenity title params declare -A deps -deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [zenity]="3.42.1") +deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [zenity]="3.42.1" [steam]="1.0.0") changelog(){ - md="https://raw.githubusercontent.com/aclist/dztui/dzgui/changelog.md" + if [[ $branch == "stable" ]]; then + md="https://raw.githubusercontent.com/aclist/dztui/dzgui/changelog.md" + else + md="https://raw.githubusercontent.com/aclist/dztui/testing/changelog.md" + fi prefix="This window can be scrolled." echo $prefix echo "" @@ -37,7 +62,7 @@ changelog(){ depcheck(){ for dep in "${!deps[@]}"; do - command -v $dep 2>&1>/dev/null || (printf "[ERROR] Requires %s >= %s\nCheck your system package manager." $dep ${deps[$dep]}; exit 1) + command -v $dep 2>&1>/dev/null || (printf "Requires %s >=%s\n" $dep ${deps[$dep]}; exit 1) done } init_items(){ @@ -47,6 +72,7 @@ items=( "Quick connect to favorite server" "Add server by ID" "Add favorite server" + "Delete server" "List installed mods" "Toggle debug mode" "Report bug (opens in browser)" @@ -87,7 +113,6 @@ query_api(){ code=$(jq -r '.errors[] .status' <<< $response) #TODO: fix granular api codes if [[ $code -eq 401 ]]; then - echo "$code" >> outfile warn_and_exit "Error $code: malformed API key" elif [[ $code -eq 500 ]]; then warn_and_exit "Error $code: malformed server list" @@ -120,32 +145,59 @@ debug="$debug" #Toggle stable/testing branch branch="$branch" + +#Last seen news item +seen_news="$seen_news" END } -guess_path(){ +write_desktop_file(){ +cat <<-END +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Exec=$sd_install_path/dzgui.sh +Name=DZGUI +Comment=dzgui +Icon=$sd_install_path/dzgui +Categories=Game + END +} +freedesktop_dirs(){ + mkdir -p "$sd_install_path" + mkdir -p "$freedesktop_path" + #TODO: update url + curl -s "$version_url" > "$sd_install_path/dzgui.sh" + chmod +x "$sd_install_path/dzgui.sh" + img_url="https://raw.githubusercontent.com/aclist/dztui/testing/images" + for i in dzgui grid.png hero.png logo.png; do + curl -s "$img_url/$i" > "$sd_install_path/$i" + done + write_desktop_file > "$freedesktop_path/dzgui.desktop" if [[ $is_steam_deck -eq 1 ]]; then - steam_path="/home/deck/.local/share/Steam" + write_desktop_file > "$HOME/Desktop/dzgui.desktop" + fi +} +guess_path(){ + echo "# Checking for default DayZ path" + path=$(find $HOME -path "*.local/share/Steam/steamapps/common/DayZ" | wc -c) + if [[ ! $path -eq 0 ]]; then + steam_path="$HOME/.local/share/Steam" else - echo "# Checking for default DayZ path" - path=$(find $HOME -path "*.local/share/Steam/steamapps/common/DayZ" | wc -c) - if [[ ! $path -eq 0 ]]; then - steam_path="$HOME/.local/share/Steam" + echo "# Searching for alternate DayZ path (make take some time)" + path=$(find / -path "*/steamapps/common/DayZ" 2>/dev/null) + if [[ $(echo "$path" | wc -l) -gt 1 ]]; then + path_sel=$(echo -e "$path" | zenity --list --title="DZGUI" --text="Multiple paths found. Select correct DayZ path" --column="Paths" --width 1200 --height 800) + clean_path=$(echo -e "$path_sel" | awk -F"/steamapps" '{print $1}') + steam_path="$clean_path" + elif [[ ! $(echo $path | wc -c) -eq 0 ]]; then + clean_path=$(echo -e "$path" | awk -F"/steamapps" '{print $1}') + steam_path="$clean_path" else - echo "# Searching for alternate DayZ path" - path=$(find / -path "*/steamapps/common/DayZ" 2>/dev/null) - if [[ $(echo "$path" | wc -l) -gt 1 ]]; then - path_sel=$(echo -e "$path" | zenity --list --title="DZGUI" --text="Multiple paths found. Select correct DayZ path" --column="Paths" --width 1200 --height 800) - clean_path=$(echo -e "$path_sel" | awk -F"/steamapps" '{print $1}') - steam_path="$clean_path" - elif [[ ! $(echo $path | wc -c) -eq 0 ]]; then - clean_path=$(echo -e "$path" | awk -F"/steamapps" '{print $1}') - steam_path="$clean_path" - else - steam_path="" - fi + steam_path="" fi fi - echo "[DZGUI] Set Steam path to $steam_path" + echo "[DZGUI] Set Steam path to $steam_path" } create_config(){ while true; do @@ -176,7 +228,7 @@ create_config(){ warn "Server 4: only numeric IDs" else whitelist=$(echo "$player_input" | awk -F"│" '{OFS=","}{print $3,$4,$5,$6}' | sed 's/,*$//g' | sed 's/^,*//g') - guess_path > >(zenity --progress --auto-close --pulsate) + guess_path > >(zenity --width 500 --progress --auto-close --pulsate) mkdir -p $config_path; write_config > $config_file info "Config file created at $config_file." return @@ -192,13 +244,12 @@ varcheck(){ [[ -z $whitelist ]] && (err "Error in key: 'whitelist'") [[ ! -d $game_dir ]] && (err "Malformed game path") [[ $whitelist =~ [[:space:]] ]] && (err "Separate whitelist values with commas") - } run_depcheck() { if [[ -z $(depcheck) ]]; then : else - zenity --warning --ok-label="Exit" --text="$(depcheck)" + zenity --warning --ok-label="Exit" --title="DZGUI" --text="$(depcheck)" exit fi } @@ -209,7 +260,7 @@ run_varcheck(){ if [[ -z $(varcheck) ]]; then : else - zenity --warning --text="$(varcheck)" 2>/dev/null + zenity --warning --width 500 --text="$(varcheck)" 2>/dev/null printf "[DZGUI] %s\n" "$check_config_msg" zenity --question --cancel-label="Exit" --text="Malformed config file. This is probably user error.\nStart first-time setup process again?" 2>/dev/null code=$? @@ -222,8 +273,9 @@ run_varcheck(){ } config(){ if [[ ! -f $config_file ]]; then - zenity --question --cancel-label="Exit" --text="Config file not found. Should DZGUI create one for you?" 2>/dev/null + zenity --width 500 --info --text="Config file not found. Click OK to proceed to first-time setup." 2>/dev/null code=$? + #prevent progress if user hits ESC if [[ $code -eq 1 ]]; then exit else @@ -249,6 +301,21 @@ open_mod_links(){ browser "$link_file" & } +steam_deck_mods(){ + until [[ -z $diff ]]; do + next=$(echo -e "$diff" | head -n1) + zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." 2>/dev/null + rc=$? + if [[ $rc -eq 0 ]]; then + echo "[DZGUI] Opening ${workshop}$next" + steam steam://url/CommunityFilePage/$next 2>/dev/null & + zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." 2>/dev/null + else + return + fi + compare + done +} manual_mod_install(){ l=0 if [[ $is_steam_deck -eq 0 ]]; then @@ -264,38 +331,43 @@ manual_mod_install(){ fi done else - - until [[ -z $diff ]]; do - next=$(echo -e "$diff" | head -n1) - zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." 2>/dev/null - rc=$? - if [[ $rc -eq 0 ]]; then - echo "[DZGUI] Opening ${workshop}$next" - steam steam://url/CommunityFilePage/$next 2>/dev/null & - zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." 2>/dev/null - else - return - fi - compare - done + steam_deck_mods fi passed_mod_check } +encode(){ + echo "$1" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g' +} +stale_symlinks(){ + for l in $(find "$game_dir" -xtype l); do + unlink $l + done +} +legacy_symlinks(){ + for d in "$game_dir"/*; do + if [[ $d =~ @[0-9]+-.+ ]]; then + unlink "$d" + fi + done +} symlinks(){ for d in "$workshop_dir"/*; do id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}') + encoded_id=$(encode "$id") mod=$(awk -F\" '/name/ {print $2}' "$d"/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g') - link="@$id-$mod" + link="@$encoded_id" if [[ -h "$game_dir/$link" ]]; then - : - else - printf "[DZGUI] Creating symlink for $mod\n" + : + else + printf "[DZGUI] Creating symlink for $mod\n" ln -fs "$d" "$game_dir/$link" - fi + fi done } passed_mod_check(){ echo "[DZGUI] Passed mod check" + stale_symlinks + legacy_symlinks symlinks launch @@ -338,14 +410,9 @@ fetch_mods_sa(){ fi } fetch_mods(){ - #TODO: broken upstream remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \ | jq -r '.data[] .attributes .details .modIds[]') } -check_workshop(){ - #TODO: legacy method is defunct - curl -Ls "$url${modlist[$i]}" | grep data-appid | awk -F\" '{print $8}' -} query_defunct(){ max=${#modlist[@]} concat(){ @@ -386,8 +453,8 @@ concat_mods(){ readarray -t serv <<< "$(server_modlist)" for i in "${serv[@]}"; do id=$(awk -F"= " '/publishedid/ {print $2}' "$workshop_dir"/$i/meta.cpp | awk -F\; '{print $1}') - mod=$(awk -F\" '/name/ {print $2}' "$workshop_dir"/$i/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g') - link="@$id-$mod;" + encoded_id=$(encode $id) + link="@$encoded_id;" echo -e "$link" done | tr -d '\n' | perl -ple 'chop' fi @@ -395,8 +462,17 @@ concat_mods(){ launch(){ mods=$(concat_mods) if [[ $debug -eq 1 ]]; then - zenity --warning --title="DZGUI" \ - --text="$(printf "[DEBUG] This is a dry run. These options would have been used to launch the game:\n\nsteam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro \"-mod=$mods\"\n")" 2>/dev/null + launch_options="steam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro \"-mod=$mods\"" + print_launch_options="$(printf "[DEBUG] This is a dry run. These options would have been used to launch the game:\n\n$launch_options\n" | fold -w 60)" + zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\ + --text="$print_launch_options" 2>/dev/null + if [[ $? -eq 0 ]]; then + source_script=$(realpath "$0") + source_dir=$(dirname "$source_script") + echo "$launch_options" > "$source_dir"/options.log + echo "[DZGUI] Wrote 'options.log' to $source_dir" + fi + else echo "[DZGUI] All OK. Launching DayZ" zenity --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null @@ -417,7 +493,7 @@ report_bug(){ if [[ $is_steam_deck -eq 1 ]]; then steam steam://openurl/"$git_url" 2>/dev/null elif [[ $is_steam_deck -eq 0 ]]; then - browser "$git_url" 2>/dev/null + browser "$git_url" 2>/dev/null & fi } help_file(){ @@ -425,7 +501,7 @@ help_file(){ if [[ $is_steam_deck -eq 1 ]]; then steam steam://openurl/"$help_url" 2>/dev/null elif [[ $is_steam_deck -eq 0 ]]; then - browser "$help_url" 2>/dev/null + browser "$help_url" 2>/dev/null & fi } set_mode(){ @@ -435,19 +511,46 @@ set_mode(){ mode=normal fi } +delete_by_id(){ + new_whitelist="whitelist=\"$(echo "$whitelist" | sed "s/,$server_id$//;s/^$server_id,//;s/,$server_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] Removed $server_id from key 'whitelist'" + zenity --info --title="DZGUI" --text="Removed "$server_id" from:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null + 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}') + zenity --question --text="Delete this server? \n$server_name" + if [[ $? -eq 0 ]]; then + delete_by_id $server_id + fi + else + connect $sel + fi +} populate(){ while true; do - #TODO: add boolean statement for ping flag; affects all column ordinal output - cols="--column="Server" --column="IP" --column="Players" --column="Gametime" --column="Status" --column="ID" --column="Ping"" - set_header ${FUNCNAME[0]} + if [[ $delete -eq 1 ]]; then + cols="--column="Server" --column="ID"" + set_header "delete" + else + cols="--column="Server" --column="IP" --column="Players" --column="Gametime" --column="Status" --column="ID" --column="Ping"" + set_header ${FUNCNAME[0]} + fi rc=$? if [[ $rc -eq 0 ]]; then if [[ -z $sel ]]; then warn "No item was selected." else - connect $sel + delete_or_connect + return fi else + delete=0 return fi done @@ -456,16 +559,20 @@ list_mods(){ if [[ -z $(installed_mods) || -z $(find $workshop_dir -maxdepth 2 -name "*.cpp" | grep .cpp) ]]; then zenity --info --text="No mods currently installed or incorrect path given" $sd_res 2>/dev/null else - for d in $(installed_mods); do - awk -F\" '/name/ {print $2}' "$workshop_dir"/$d/meta.cpp - done | sort | zenity --text-info --title="DZGUI" $sd_res 2>/dev/null + 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 fi } +fetch_query_ports(){ + qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"') +} connect_to_fav(){ if [[ -n $fav ]]; then one_shot_launch=1 query_api - qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"') + fetch_query_ports echo "[DZGUI] Attempting connection to $fav_label" connect "$qport_list" one_shot_launch=0 @@ -475,12 +582,15 @@ connect_to_fav(){ } set_header(){ - if [[ $1 == "populate" ]]; then - sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ + if [[ $1 == "delete" ]]; then + sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ + --separator="$separator" --print-column=1,2 --ok-label="Delete" 2>/dev/null) + elif [[ $1 == "populate" ]]; then + sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ --separator="$separator" --print-column=2,6 2>/dev/null) elif [[ $1 == "main_menu" ]]; then - sel=$(zenity --width=1280 --height=800 --list --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ - --cancel-label="Exit" --ok-label="Select" --column="Select launch option" "${items[@]}" 2>/dev/null) + sel=$(zenity $sd_res --list --title="DZGUI" --text="${news}DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \ + --cancel-label="Exit" --ok-label="Select" --column="Select launch option" --hide-header "${items[@]}" 2>/dev/null) fi } toggle_branch(){ @@ -496,21 +606,56 @@ toggle_branch(){ printf "[DZGUI] Toggled branch to '$branch'\n" source $config_file } +generate_log(){ + cat <<-DOC + Version: $version + Branch: $branch + Whitelist: $whitelist + Path: $steam_path + Linux: $(uname -mrs) + + Mods: + $(list_mods) + DOC +} debug_menu(){ debug_list=( "Toggle branch" + "Generate debug log" ) - debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" "${debug_list[@]}" 2>/dev/null) + debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null) if [[ $debug_sel == "${debug_list[0]}" ]]; then - toggle_branch + enforce_dl=1 + toggle_branch && check_version + elif [[ $debug_sel == "${debug_list[1]}" ]]; then + source_script=$(realpath "$0") + source_dir=$(dirname "$source_script") + generate_log > "$source_dir/log" + printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir" + zenity --info --width 500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null fi } +query_and_connect(){ + query_api + parse_json <<< "$response" + #TODO: create logger function + echo "[DZGUI] Checking response time of servers" + create_array | zenity --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null + rc=$? + if [[ $rc -eq 1 ]]; then + : + else + populate + fi +} + main_menu(){ + print_news + set_mode if [[ $debug -eq 1 ]]; then items+=("Debug options") fi - set_mode if [[ -n $fav ]]; then items[3]="Change favorite server" fi @@ -521,17 +666,7 @@ main_menu(){ if [[ -z $sel ]]; then warn "No item was selected." elif [[ $sel == "${items[0]}" ]]; then - query_api - parse_json <<< "$response" - #TODO: create logger function - echo "[DZGUI] Checking response time of servers" - create_array | zenity --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null - rc=$? - if [[ $rc -eq 1 ]]; then - : - else - populate - fi + query_and_connect elif [[ $sel == "${items[1]}" ]]; then connect_to_fav elif [[ $sel == "${items[2]}" ]]; then @@ -539,18 +674,21 @@ main_menu(){ elif [[ $sel == "${items[3]}" ]]; then add_by_fav elif [[ $sel == "${items[4]}" ]]; then - list_mods + delete=1 + query_and_connect elif [[ $sel == "${items[5]}" ]]; then + list_mods | sed 's/\t/\n/g' | zenity --list --column="Mod" --column="Symlink" --title="DZGUI" $sd_res --print-column="" 2>/dev/null + elif [[ $sel == "${items[6]}" ]]; then toggle_debug main_menu return - elif [[ $sel == "${items[6]}" ]]; then - report_bug elif [[ $sel == "${items[7]}" ]]; then - help_file + report_bug elif [[ $sel == "${items[8]}" ]]; then - changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null + help_file elif [[ $sel == "${items[9]}" ]]; then + changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null + elif [[ $sel == "${items[10]}" ]]; then debug_menu else warn "This feature is not yet implemented." @@ -562,17 +700,17 @@ main_menu(){ } parse_json(){ list=$(jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') - qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"') + fetch_query_ports echo -e "$list" > $tmp } check_ping(){ - ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}') - ms=$(ping -c 1 -W 1 "$ping_ip" | awk -Ftime= '/time=/ {print $2}') - if [[ -z $ms ]]; then - echo "Timeout" - else - echo "$ms" - fi + ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}') + ms=$(ping -c 1 -W 1 "$ping_ip" | awk -Ftime= '/time=/ {print $2}') + if [[ -z $ms ]]; then + echo "Timeout" + else + echo "$ms" + fi } create_array(){ list=$(cat $tmp) @@ -597,10 +735,14 @@ create_array(){ #TODO: probe offline return codes id=$(echo "$line" | awk -F'\t' '{print $6}') tc=$(awk 'END{print NR}' $tmp) - echo "$lc/$tc" - echo "# Checking ping: $lc/$tc" - ping=$(check_ping "$line") - declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping") + if [[ $delete -eq 1 ]]; then + declare -g -a rows=("${rows[@]}" "$name" "$id") + else + echo "$lc/$tc" + echo "# Checking ping: $lc/$tc" + ping=$(check_ping "$line") + declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping") + fi let lc++ done <<< "$list" @@ -628,10 +770,13 @@ merge_config(){ mv $config_file ${config_path}dztuirc.old write_config > $config_file printf "[DZGUI] Wrote new config file to %sdztuirc\n" $config_path - zenity --info --title="DZGUI" --text="Wrote new config format to \n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null + zenity --info --width 500 --title="DZGUI" --text="Wrote new config format to \n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null } download_new_version(){ + if [[ $is_steam_deck -eq 1 ]]; then + freedesktop_dirs + fi source_script=$(realpath "$0") source_dir=$(dirname "$source_script") mv $source_script $source_script.old @@ -641,7 +786,7 @@ download_new_version(){ echo "[DZGUI] Wrote $upstream to $source_script" chmod +x $source_script touch ${config_path}.unmerged - zenity --question --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 + 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 code=$? if [[ $code -eq 0 ]]; then changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null @@ -664,28 +809,39 @@ check_branch(){ fi upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') } +enforce_dl(){ + download_new_version +} +prompt_dl(){ + zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t$branch\nYour version\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 + else + download_new_version + fi +} check_version(){ if [[ ! -f $config_file ]]; then : ; else source $config_file; fi if [[ -z $branch ]]; then branch="stable" fi check_branch + [[ ! -d "$HOME/dzgui" ]] && freedesktop_dirs if [[ $version == $upstream ]]; then check_unmerged else - echo "[DZGUI] Upstream ($upstream) is > local ($version)" - zenity --question --title="DZGUI" --text "Newer version available.\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 + echo "[DZGUI] Upstream ($upstream) != local ($version)" + if [[ $enforce_dl -eq 1 ]]; then + enforce_dl else - download_new_version + prompt_dl fi fi } check_architecture(){ - os_release=$(awk '/SteamOS/' "/etc/os-release") - if [[ -f "/etc/os-release" ]] && [[ -n $os_releasec ]]; then + cpu=$(cat /proc/cpuinfo | grep "AMD Custom APU 0405") + if [[ -n "$cpu" ]]; then is_steam_deck=1 echo "[DZGUI] Setting architecture to 'Steam Deck'" else @@ -694,7 +850,7 @@ check_architecture(){ fi } add_by_id(){ - #TODO: prevent redundant creation of existent IDs (for neatness) + #FIXME: prevent redundant creation of existent IDs (for neatness) while true; do id=$(zenity --entry --text="Enter server ID" --title="DZGUI" 2>/dev/null) rc=$? @@ -738,6 +894,18 @@ setup(){ items[3]="Change favorite server" fi } +check_map_count(){ + count=1048576 + if [[ $(sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then + map_warning=$(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) + if [[ $? -eq 0 ]]; then + pass=$(zenity --password) + sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" + echo "" + + fi + fi +} add_by_fav(){ while true; do fav_id=$(zenity --entry --text="Enter server ID" --title="DZGUI" 2>/dev/null) @@ -764,8 +932,9 @@ done } main(){ run_depcheck - check_version check_architecture + check_version + check_map_count config run_varcheck init_items From 470ccdfc8df8299c461a5f858193fce61085465f Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 7 Aug 2022 14:46:38 +0900 Subject: [PATCH 24/63] Add install.sh --- install.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..152526d --- /dev/null +++ b/install.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl "https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" > dzgui.sh +chmod +x dzgui.sh +./dzgui.sh From a734b670ff60f7d22c9964536f34bb33c28f7070 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 7 Aug 2022 14:47:44 +0900 Subject: [PATCH 25/63] Update docs --- dzgui.adoc | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 5 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index f0105f3..e371495 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -1,7 +1,8 @@ = DZGUI documentation -DayZ community server graphical launcher for Linux +DayZ community server graphical launcher for Linux | Last updated: 2022-08-05 :nofooter: :toc: left +:stylesheet: custom.css == What this is A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. @@ -22,9 +23,19 @@ If not already installed, the below can be found in your system's package manage === Preparation . Download DZGUI and make it executable: + +**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 ``` +[start=2] . Update the `vm.max_map_count` value (see https://www.protondb.com/app/221100) Ephemeral method: @@ -40,7 +51,7 @@ 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=2] +[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. @@ -59,7 +70,26 @@ You will be prompted to enter these IDs when starting the app, so you could refe === First-time launch -Follow the menu prompts provided by the app. You will be asked to provide: + +1. DZGUI can be launched one of two ways. + +**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) + +[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) @@ -70,6 +100,69 @@ DZGUI will then attempt to locate your default Steam installation and DayZ path. [NOTE] If the path was not detected correctly, you can manually edit the config file at `$HOME/.config/dztui/dztuirc`. +=== Steam integration & artwork + +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**. + +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. Navigate to the artwork path described above and select `hero.png`. +4. 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. @@ -88,11 +181,18 @@ E.g., if DZGUI is named `dzgui`, in the path `$HOME/bin`, it will be located at ``` $HOME/bin/dzgui.old ``` -Config: +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 <> to fetch details for the server IDs you provided. Select the server you wish to connect to and click OK. @@ -187,4 +287,4 @@ If any of the below apply to you, your https://github.com/aclist/dztui/issues[re - 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-ASCII mod names (?) +- Playing on a server with non-English mod names (?) From f2d0f88f3eeeebd7d1f00468cfeadc7391a94574 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 10 Aug 2022 08:51:28 +0900 Subject: [PATCH 26/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 804ce7d..6b3f179 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,10 @@ - Clean up logging - Custom query API +## [2.4.1] 2022-08-09 +### Fixed +- Hotfix for progress bar breaking table when >9 servers in list + ## [2.4.0] 2022-08-07 ### Added - Delete server command added to main menu From ea2007357c4efc45d2131c1eff286e50560e9845 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 10 Aug 2022 08:51:30 +0900 Subject: [PATCH 27/63] Hotfix for create_array --- dzgui.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index b180783..020d7f1 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.4.0 +version=2.4.1 aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" @@ -641,7 +641,7 @@ query_and_connect(){ parse_json <<< "$response" #TODO: create logger function echo "[DZGUI] Checking response time of servers" - create_array | zenity --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null + create_array | zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null rc=$? if [[ $rc -eq 1 ]]; then : @@ -720,7 +720,7 @@ create_array(){ name=$(echo "$line" | awk -F'\t' '{print $1}') #truncate names if [[ $(echo "$name" | wc -m) -gt 50 ]]; then - name="$(echo $name | awk '{print substr($0,1,50) "..."}')" + name="$(echo "$name" | awk '{print substr($0,1,50) "..."}')" else : fi @@ -738,7 +738,6 @@ create_array(){ if [[ $delete -eq 1 ]]; then declare -g -a rows=("${rows[@]}" "$name" "$id") else - echo "$lc/$tc" echo "# Checking ping: $lc/$tc" ping=$(check_ping "$line") declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping") From b2dcbbd51073ec7801e759289226851f3171d8f4 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 Aug 2022 19:29:19 +0900 Subject: [PATCH 28/63] Bump version --- changelog.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/changelog.md b/changelog.md index 6b3f179..9cbba34 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,19 @@ ## [Unreleased] - Clean up logging - Custom query API +- Standardize dialogs +- Connect by IP + +## [2.5.0] 2022-08-16 +### Added +- Lockfile: prevent concurrent instances of DZGUI from being opened + +### Changed +- Faster path discovery on first-time setup + +### Fixed +- Symlink collision on servers with many mods +- API response pagination for large server lists ## [2.4.1] 2022-08-09 ### Fixed From 78caecc4b48505f4736a81d8f2747165a1bd39bc Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 Aug 2022 19:29:33 +0900 Subject: [PATCH 29/63] Merge testing changes --- dzgui.sh | 126 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 91 insertions(+), 35 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 020d7f1..a61cabb 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,8 @@ #!/bin/bash set -o pipefail -version=2.4.1 +version=2.5.0 + aid=221100 game="dayz" workshop="steam://url/CommunityFilePage/" @@ -44,7 +45,7 @@ print_news(){ fi } #TODO: prevent connecting to offline servers -#TODO: abstract zenity title params +#TODO: abstract zenity title params and dimensions declare -A deps deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [zenity]="3.42.1" [steam]="1.0.0") @@ -80,11 +81,6 @@ items=( "View changelog" ) } -exit_and_cleanup(){ - #TODO: this is currently unused - rm $tmp - rm $link_file -} warn_and_exit(){ zenity --info --title="DZGUI" --text="$1" --icon-name="dialog-warning" 2>/dev/null printf "[DZGUI] %s\n" "$check_config_msg" @@ -96,6 +92,12 @@ warn(){ info(){ zenity --info --title="DZGUI" --text="$1" 2>/dev/null } +set_api_params(){ + response=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "sort=-players" \ + -d "filter[game]=$game" -d "filter[ids][whitelist]=$list_of_ids") + list_response=$response + first_entry=1 +} query_api(){ #TODO: prevent drawing list if null values returned without API error if [[ $one_shot_launch -eq 1 ]]; then @@ -107,8 +109,7 @@ query_api(){ list_of_ids="$whitelist" fi fi - response=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "sort=-players" \ - -d "filter[game]=$game" -d "filter[ids][whitelist]=$list_of_ids") + set_api_params if [[ "$(jq -r 'keys[]' <<< "$response")" == "errors" ]]; then code=$(jq -r '.errors[] .status' <<< $response) #TODO: fix granular api codes @@ -178,30 +179,35 @@ freedesktop_dirs(){ write_desktop_file > "$HOME/Desktop/dzgui.desktop" fi } -guess_path(){ - echo "# Checking for default DayZ path" - path=$(find $HOME -path "*.local/share/Steam/steamapps/common/DayZ" | wc -c) - if [[ ! $path -eq 0 ]]; then - steam_path="$HOME/.local/share/Steam" - else - echo "# Searching for alternate DayZ path (make take some time)" - path=$(find / -path "*/steamapps/common/DayZ" 2>/dev/null) - if [[ $(echo "$path" | wc -l) -gt 1 ]]; then - path_sel=$(echo -e "$path" | zenity --list --title="DZGUI" --text="Multiple paths found. Select correct DayZ path" --column="Paths" --width 1200 --height 800) - clean_path=$(echo -e "$path_sel" | awk -F"/steamapps" '{print $1}') - steam_path="$clean_path" - elif [[ ! $(echo $path | wc -c) -eq 0 ]]; then +file_picker(){ + #TODO: unimplemented + while true; do + local path=$(zenity --file-selection --directory 2>/dev/null) + if [[ -z "$path" ]] || [[ ! -d "$path" ]] || [[ ! "$path" =~ steamapps/common/DayZ ]]; then + continue + else + echo "[DZGUI]" Set path to $path clean_path=$(echo -e "$path" | awk -F"/steamapps" '{print $1}') steam_path="$clean_path" - else - steam_path="" + return fi + done +} +guess_path(){ + echo "# Checking for default DayZ path" + path=$(find $HOME -type d -regex ".*/steamapps/common/DayZ$" -print -quit) + if [[ -n $path ]]; then + steam_path="$path" + else + echo "# Searching for alternate DayZ path. This may take some time." + 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 "/run" -o -path "/sys" -o -path "/etc" -o -path "/var" -o -path "/run" -o -path "/lost+found" \) -prune -o -regex ".*/steamapps/common/DayZ$" -print -quit 2>/dev/null) + clean_path=$(echo -e "$path" | awk -F"/steamapps" '{print $1}') + steam_path="$clean_path" fi - echo "[DZGUI] Set Steam path to $steam_path" } create_config(){ while true; do - player_input="$(zenity --forms --add-entry="Player name (required for some servers)" --add-entry="API key" --add-entry="Server 1 (you can add more later)" --title=DZGUI --text=DZGUI --add-entry="Server 2" --add-entry="Server 3" --add-entry="Server 4" $sd_res --separator="│")" + player_input="$(zenity --forms --add-entry="Player name (required for some servers)" --add-entry="API key" --add-entry="Server 1 (you can add more later)" --title=DZGUI --text=DZGUI --add-entry="Server 2" --add-entry="Server 3" --add-entry="Server 4" $sd_res --separator="│" 2>/dev/null)" #explicitly setting IFS crashes zenity in loop #and mapfile does not support high ascii delimiters #so split fields with newline @@ -228,7 +234,9 @@ create_config(){ warn "Server 4: only numeric IDs" else whitelist=$(echo "$player_input" | awk -F"│" '{OFS=","}{print $3,$4,$5,$6}' | sed 's/,*$//g' | sed 's/^,*//g') - guess_path > >(zenity --width 500 --progress --auto-close --pulsate) + guess_path > >(zenity --width 500 --progress --auto-close --pulsate 2>/dev/null) && + echo "[DZGUI] Set path to $steam_path" + #FIXME: tech debt: gracefully exit if user cancels search process mkdir -p $config_path; write_config > $config_file info "Config file created at $config_file." return @@ -336,7 +344,7 @@ manual_mod_install(){ passed_mod_check } encode(){ - echo "$1" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g' + echo "$1" | md5sum | cut -c -8 } stale_symlinks(){ for l in $(find "$game_dir" -xtype l); do @@ -349,6 +357,13 @@ legacy_symlinks(){ unlink "$d" fi done + for d in "$workshop_dir"/*; do + local id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}') + local encoded_id=$(echo "$id" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g') + if [[ -h "$game_dir/@$encoded_id" ]]; then + unlink "$game_dir/@$encoded_id" + fi + done } symlinks(){ for d in "$workshop_dir"/*; do @@ -376,7 +391,7 @@ connect(){ #TODO: sanitize/validate input readarray -t qport_arr <<< "$qport_list" if [[ -z ${qport_arr[@]} ]]; then - err "Failed to process favorite server" + err "Failed to obtain query ports" return fi ip=$(echo "$1" | awk -F"$separator" '{print $1}') @@ -470,12 +485,13 @@ launch(){ source_script=$(realpath "$0") source_dir=$(dirname "$source_script") echo "$launch_options" > "$source_dir"/options.log - echo "[DZGUI] Wrote 'options.log' to $source_dir" + echo "[DZGUI] Wrote launch options to $source_dir/options.log" + zenity --info --width 500 --title="DZGUI" --text="Wrote launch options to \n$source_dir/options.log" 2>/dev/null fi else echo "[DZGUI] All OK. Launching DayZ" - zenity --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null + 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\" exit fi @@ -638,7 +654,7 @@ debug_menu(){ } query_and_connect(){ query_api - parse_json <<< "$response" + parse_json #TODO: create logger function echo "[DZGUI] Checking response time of servers" create_array | zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null @@ -698,10 +714,28 @@ main_menu(){ fi done } +page_through(){ + list_response=$(curl -s "$page") + list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') + idarr+=("$list") + parse_json +} parse_json(){ - list=$(jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') - fetch_query_ports - echo -e "$list" > $tmp + page=$(echo "$list_response" | jq -r '.links.next?') + if [[ $first_entry -eq 1 ]]; then + list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') + idarr+=("$list") + first_entry=0 + fi + if [[ "$page" != "null" ]]; then + 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 + idarr=() + fetch_query_ports + fi } check_ping(){ ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}') @@ -749,6 +783,7 @@ create_array(){ } set_fav(){ #TODO: test API key here and return errors + echo "[DZGUI] Querying favorite server" query_api fav_label=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "filter[game]=$game" -d "filter[ids][whitelist]=$fav" \ | jq -r '.data[] .attributes .name') @@ -929,7 +964,27 @@ while true; do fi done } +#cleanup(){ +# rm $config_path/.lockfile +#} +lock(){ + if [[ ! -f $config_path/.lockfile ]]; then + touch $config_path/.lockfile + fi + pid=$(cat $config_path/.lockfile) + ps -p $pid -o pid= >/dev/null 2>&1 + res=$? + if [[ $res -eq 0 ]]; then + echo "[DZGUI] Already running ($pid)" + exit + elif [[ $pid == $$ ]]; then + : + else + echo $$ > $config_path/.lockfile + fi +} main(){ + lock run_depcheck check_architecture check_version @@ -942,3 +997,4 @@ main(){ } main +#trap cleanup EXIT From ade568c0e09d8cd535d7d22168d7ee1728c14a72 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 16 Aug 2022 19:29:34 +0900 Subject: [PATCH 30/63] Update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index 3ed3be0..a0378c6 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: This update includes numerous QOL and backend fixes. If you encounter problems, please submit a report. +NEWS: Backend fixes for very large/small server lists, servers with numerous mods. From 64e87d35ad303d8d5513d11b6a6c4ea1cd598731 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 17 Aug 2022 11:25:56 +0900 Subject: [PATCH 31/63] Hotfix for malformed paths --- dzgui.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index a61cabb..e1845c8 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.5.0 +version=2.5.1 aid=221100 game="dayz" @@ -196,8 +196,9 @@ file_picker(){ guess_path(){ echo "# Checking for default DayZ path" path=$(find $HOME -type d -regex ".*/steamapps/common/DayZ$" -print -quit) - if [[ -n $path ]]; then - steam_path="$path" + if [[ -n "$path" ]]; then + clean_path=$(echo -e "$path" | awk -F"/steamapps" '{print $1}') + steam_path="$clean_path" else echo "# Searching for alternate DayZ path. This may take some time." 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 "/run" -o -path "/sys" -o -path "/etc" -o -path "/var" -o -path "/run" -o -path "/lost+found" \) -prune -o -regex ".*/steamapps/common/DayZ$" -print -quit 2>/dev/null) @@ -250,7 +251,7 @@ err(){ varcheck(){ [[ -z $api_key ]] && (err "Error in key: 'api_key'") [[ -z $whitelist ]] && (err "Error in key: 'whitelist'") - [[ ! -d $game_dir ]] && (err "Malformed game path") + [[ ! -d "$game_dir" ]] && (err "Malformed game path") [[ $whitelist =~ [[:space:]] ]] && (err "Separate whitelist values with commas") } run_depcheck() { From 82ed8ee860a78e624aa6ec481d84327ec7e6d0a3 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 17 Aug 2022 11:26:31 +0900 Subject: [PATCH 32/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 9cbba34..2eb701d 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Standardize dialogs - Connect by IP +## [2.5.1] 2022-08-17 +### Fixed +- Hotfix for malformed paths during first-time setup + ## [2.5.0] 2022-08-16 ### Added - Lockfile: prevent concurrent instances of DZGUI from being opened From e879ceb28871c3babedb270a9c86391e155153ba Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:37:53 +0900 Subject: [PATCH 33/63] Update docs --- dzgui.adoc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index e371495..fe405a3 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -27,7 +27,7 @@ If not already installed, the below can be found in your system's package manage **Automatic method (skip to 3 below when complete)** ``` -curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash +curl -s "https://raw.githubusercontent.com/aclist/dztui/testing/install.sh" | bash ``` **Manual method** @@ -139,8 +139,9 @@ image::https://github.com/aclist/dztui/raw/testing/images/tutorial/03.png[03,700 [start=2] 2. Select **Set Custom Background** -3. Navigate to the artwork path described above and select `hero.png`. -4. Next, right-click the image background and select **Set Custom Logo**. +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] @@ -220,6 +221,18 @@ Fetches detailed server information on the list of servers saved in the config f ==== 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 servers 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". + +Once configured, you can insert this key in 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 <> option. @@ -275,7 +288,7 @@ Steam schedules the downloads in the background and processes them as they are s 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 -You are missing mods or mods did not download correctly. Re-run the app to verify and link missing mods. +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. From 1d8f2275d84972ff46e57d7a24424749772a4bfc Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:40:38 +0900 Subject: [PATCH 34/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 2eb701d..2d7c5f0 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Standardize dialogs - Connect by IP +## [2.6.0] 2022-09-05 +### Added +- Connect by IP method + ## [2.5.1] 2022-08-17 ### Fixed - Hotfix for malformed paths during first-time setup From a19d1b875bf78f891ae99d20399e3cd3a009be39 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:41:31 +0900 Subject: [PATCH 35/63] Add connect by IP --- dzgui.sh | 146 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 130 insertions(+), 16 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index e1845c8..f329db6 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,8 @@ + #!/bin/bash set -o pipefail -version=2.5.1 +version=2.6.0 aid=221100 game="dayz" @@ -71,6 +72,7 @@ init_items(){ items=( "Launch server list" "Quick connect to favorite server" + "Connect by IP" "Add server by ID" "Add favorite server" "Delete server" @@ -149,6 +151,9 @@ branch="$branch" #Last seen news item seen_news="$seen_news" + +#Steam API key +steam_api="$steam_api" END } write_desktop_file(){ @@ -396,9 +401,12 @@ connect(){ return fi ip=$(echo "$1" | awk -F"$separator" '{print $1}') - #TODO: deprecated (for now) bid=$(echo "$1" | awk -F"$separator" '{print $2}') - fetch_mods_sa "$ip" + if [[ $2 == "ip" ]]; then + fetch_mods_sa "$ip" + else + fetch_mods "$bid" + fi validate_mods rc=$? [[ $rc -eq 1 ]] && return @@ -409,9 +417,13 @@ connect(){ passed_mod_check fi } - +fetch_mods(){ + remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \ + | jq -r '.data[] .attributes .details .modIds[]') +} +#TODO: deprecated (for now) fetch_mods_sa(){ - sa_ip=$(echo $ip | awk -F: '{print $1}') + sa_ip=$(echo "$1" | awk -F: '{print $1}') for i in ${qport_arr[@]}; do if [[ -n $(echo "$i" | awk -v ip=$ip '$0 ~ ip') ]]; then sa_port=$(echo $i | awk -v ip=$ip -F$separator '$0 ~ ip {print $2}') @@ -424,6 +436,105 @@ fetch_mods_sa(){ err "Failed to fetch modlist" return fi + qport_arr=() +} +prepare_ip_list(){ + ct=$(< "$1" jq '[.response.servers[]]|length') + for((i=0;i<$ct;i++));do + name=$(< $json jq --arg i $i -r '[.servers[]][($i|tonumber)].name') + addr=$(< $json jq --arg i $i -r '[.servers[]][($i|tonumber)].addr') + ip=$(echo "$addr" | awk -F: '{print $1}') + players=$(< $json jq --arg i $i -r '[.servers[]][($i|tonumber)].players') + max_players=$(< $json jq --arg i $i -r '[.servers[]][($i|tonumber)].max_players') + gameport=$(< $json jq --arg i $i -r '[.servers[]][($i|tonumber)].gameport') + ip_port=$(echo "$ip:$gameport") + time=$(< $json jq --arg i $i -r '[.servers[]][($i|tonumber)].gametype' | grep -oP '(?/dev/null) + if [[ $? -eq 1 ]]; then + return_from_table=1 + return + fi + if [[ -z $sel ]]; then + echo "No selection" + else + local gameport="$(echo "$sel" | awk -F: '{print $2}')" + local ip="$(echo "$sel" | awk -F: '{print $1}')" + local addr=$(< $json jq -r --arg gameport $gameport '.servers[]|select(.gameport == ($gameport|tonumber)).addr') + local qport=$(echo "$addr" | awk -F: '{print $2}') + local sa_ip=$(echo "$ip:$gameport%%$qport") + qport_list="$sa_ip" + connect "$sel" "ip" + fi + done +} +fetch_ip_metadata(){ + local 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 "Failed to retrieve IP metadata. Check IP or API key and try again." + echo "[DZGUI] Failed to retrieve IP metadata" + + else + ip_table + fi +} + +#TODO: local servers +#local_ip(){ +#(^127\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.) +#} +add_steam_api(){ + mv $config_file ${config_path}dztuirc.old + nr=$(awk '/steam_api=/ {print NR}' ${config_path}dztuirc.old) + steam_api="steam_api=\"$steam_api\"" + awk -v "var=$steam_api" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc + echo "[DZGUI] Added Steam API key" + zenity --info --title="DZGUI" --text="Added Steam API key to:\n\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null + source $config_file +} +validate_ip(){ + echo "$1" | grep -qP '^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$' +} +connect_by_ip(){ + source $config_file + if [[ -z $steam_api ]]; then + steam_api=$(zenity --entry --text="Key 'steam_api' not present in config file. Enter Steam API key:" --title="DZGUI" 2>/dev/null) + if [[ $? -eq 1 ]] ; then + return + elif [[ $steam_api -lt 32 ]]; then + zenity --warning --title="DZGUI" --text="Check API key and try again." + return + else + add_steam_api + fi + fi + while true; do + if [[ $return_from_table -eq 1 ]]; then + return_from_table=0 + return + fi + ip=$(zenity --entry --text="Enter server IP" --title="DZGUI" 2>/dev/null) + [[ $? -eq 1 ]] && return + if validate_ip "$ip"; then + fetch_ip_metadata + else + continue + fi + done } fetch_mods(){ remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \ @@ -674,7 +785,7 @@ main_menu(){ items+=("Debug options") fi if [[ -n $fav ]]; then - items[3]="Change favorite server" + items[4]="Change favorite server" fi while true; do set_header ${FUNCNAME[0]} @@ -687,25 +798,27 @@ main_menu(){ elif [[ $sel == "${items[1]}" ]]; then connect_to_fav elif [[ $sel == "${items[2]}" ]]; then - add_by_id + connect_by_ip elif [[ $sel == "${items[3]}" ]]; then - add_by_fav + add_by_id elif [[ $sel == "${items[4]}" ]]; then + add_by_fav + elif [[ $sel == "${items[5]}" ]]; then delete=1 query_and_connect - elif [[ $sel == "${items[5]}" ]]; then - list_mods | sed 's/\t/\n/g' | zenity --list --column="Mod" --column="Symlink" --title="DZGUI" $sd_res --print-column="" 2>/dev/null elif [[ $sel == "${items[6]}" ]]; then + list_mods | sed 's/\t/\n/g' | zenity --list --column="Mod" --column="Symlink" --title="DZGUI" $sd_res --print-column="" 2>/dev/null + elif [[ $sel == "${items[7]}" ]]; then toggle_debug main_menu return - elif [[ $sel == "${items[7]}" ]]; then - report_bug elif [[ $sel == "${items[8]}" ]]; then - help_file + report_bug elif [[ $sel == "${items[9]}" ]]; then - changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null + help_file elif [[ $sel == "${items[10]}" ]]; then + changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null + elif [[ $sel == "${items[11]}" ]]; then debug_menu else warn "This feature is not yet implemented." @@ -926,11 +1039,12 @@ toggle_debug(){ setup(){ if [[ -n $fav ]]; then set_fav - items[3]="Change favorite server" + items[4]="Change favorite server" fi } 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 map_warning=$(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) if [[ $? -eq 0 ]]; then @@ -959,7 +1073,7 @@ while true; do zenity --info --title="DZGUI" --text="Added "$fav_id" to:\n${config_path}dztuirc\nIf errors occurred, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null source $config_file set_fav - items[3]="Change favorite server" + items[4]="Change favorite server" return fi fi From 32a1dbc19ce9fd3091d95aa046b6a30d04effc22 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:42:21 +0900 Subject: [PATCH 36/63] Update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index a0378c6..2f87514 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Backend fixes for very large/small server lists, servers with numerous mods. +NEWS: Connect by IP added. Requires Steam API key. See documentation From 55522af6ddd0eeafab218ddf5957600b99dae49b Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 6 Sep 2022 12:38:33 +0900 Subject: [PATCH 37/63] Clean unreleased section --- changelog.md | 1 - 1 file changed, 1 deletion(-) diff --git a/changelog.md b/changelog.md index 2d7c5f0..2b93670 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,6 @@ - Clean up logging - Custom query API - Standardize dialogs -- Connect by IP ## [2.6.0] 2022-09-05 ### Added From 87f70bf992b0955356a9f2de3859b620dc44b206 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 8 Sep 2022 17:17:56 +0900 Subject: [PATCH 38/63] Fix url --- dzgui.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.adoc b/dzgui.adoc index fe405a3..47783f3 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -27,7 +27,7 @@ If not already installed, the below can be found in your system's package manage **Automatic method (skip to 3 below when complete)** ``` -curl -s "https://raw.githubusercontent.com/aclist/dztui/testing/install.sh" | bash +curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash ``` **Manual method** From 8a1d335c6de9e64badee279a2ff437fb8d66db6e Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 8 Sep 2022 17:23:24 +0900 Subject: [PATCH 39/63] Update timestamp --- dzgui.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.adoc b/dzgui.adoc index 47783f3..7c10d28 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -1,5 +1,5 @@ = DZGUI documentation -DayZ community server graphical launcher for Linux | Last updated: 2022-08-05 +DayZ community server graphical launcher for Linux | Last updated: 2022-09-08 :nofooter: :toc: left :stylesheet: custom.css From e5c5c34ffa158d172062c58906a709e103addb3b Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 8 Sep 2022 17:41:36 +0900 Subject: [PATCH 40/63] Remarks about controller layout --- dzgui.adoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dzgui.adoc b/dzgui.adoc index 7c10d28..2156e55 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -102,6 +102,8 @@ If the path was not detected correctly, you can manually edit the config file at === 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. @@ -118,6 +120,12 @@ image::https://github.com/aclist/dztui/raw/testing/images/tutorial/01.png[01,500 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. You can navigate through menus using the D-pad and use A/B to respectively confirm selections and go back. + +==== Artwork + The application also ships with Steam cover artwork. It is located under: ``` From c62469bb66923d3dee5c75143597ded115ad66c9 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 8 Sep 2022 19:30:47 +0900 Subject: [PATCH 41/63] Update explanation --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a06e251..185fdf4 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,14 @@ A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. +DZGUI allows you to connect to 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: + +1. Display server metadata in a table (server data and ID, player count, ping, current gametime) +2. Find and prepare mods being requested by the server +3. Concatenate launch options to pass to Steam + ## Setup and usage -Refer to the [documentation](https://aclist.github.io/dzgui/dzgui.html) +Refer to the [manual](https://aclist.github.io/dzgui/dzgui.html) for installation and setup instructions, a feature-by-feature breakdown, and Steam integration tutorials. ![Alt text](example.png) From 9e0336f3702c945d787d8d96ac1ac635c8725cd7 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 21 Sep 2022 22:18:16 +0900 Subject: [PATCH 42/63] Update docs --- dzgui.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.adoc b/dzgui.adoc index 2156e55..86c9de8 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -1,5 +1,5 @@ = DZGUI documentation -DayZ community server graphical launcher for Linux | Last updated: 2022-09-08 +DayZ community server graphical launcher for Linux | Last updated: 2022-09-17 :nofooter: :toc: left :stylesheet: custom.css From f1fbbc9acdba806041ca2d4171b0f16ed474c4f1 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 26 Sep 2022 04:33:17 +0900 Subject: [PATCH 43/63] Fix newline --- dzgui.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index f329db6..5a2d184 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,8 +1,7 @@ - #!/bin/bash set -o pipefail -version=2.6.0 +version=2.6.1 aid=221100 game="dayz" From db66745e3a01d07731e77895f70c7a4a949b7e49 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 26 Sep 2022 04:39:56 +0900 Subject: [PATCH 44/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 2b93670..e44402f 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [2.6.1] 2022-09-25 +### Fixed +- Freedesktop shortcut errors + ## [2.6.0] 2022-09-05 ### Added - Connect by IP method From 75d442135a3acc13b20c367ccd9162073d6c6149 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 2 Oct 2022 18:28:20 +0900 Subject: [PATCH 45/63] Hotfix for #36 --- dzgui.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 5a2d184..68a4cf1 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.6.1 +version=2.6.2 aid=221100 game="dayz" @@ -10,7 +10,7 @@ api="https://api.battlemetrics.com/servers" sd_res="--width=1280 --height=800" config_path="$HOME/.config/dztui/" config_file="${config_path}dztuirc" -tmp=/tmp/dztui.tmp +tmp=/tmp/dzgui.tmp separator="%%" git_url="https://github.com/aclist/dztui/issues" stable_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" @@ -311,18 +311,18 @@ open_mod_links(){ let n++ done >> $link_file echo "" >> $link_file - browser "$link_file" & + browser "$link_file" 2>/dev/null & } steam_deck_mods(){ until [[ -z $diff ]]; do next=$(echo -e "$diff" | head -n1) - zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." 2>/dev/null + zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." --width=500 2>/dev/null rc=$? if [[ $rc -eq 0 ]]; then echo "[DZGUI] Opening ${workshop}$next" steam steam://url/CommunityFilePage/$next 2>/dev/null & - zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." 2>/dev/null + zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null else return fi @@ -656,7 +656,13 @@ delete_or_connect(){ delete_by_id $server_id fi else - connect $sel + #hotfix for bug #36 + local lookup_ip=$(echo "$sel" | awk -F%% '{print $1}') + local lookup_id="$(echo "$sel" | awk -F%% '{print $2}')" + local qport=$(echo "$response" | jq --arg id $lookup_id '.data[]|select(.id==$id).attributes.portQuery') + qport_list="$lookup_ip%%$qport" + connect "$sel" "ip" + fi } populate(){ From be1c53c40a1c34182aa724cb2389cbe2442525a7 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 2 Oct 2022 18:29:10 +0900 Subject: [PATCH 46/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index e44402f..2f8458a 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [2.6.2] 2022-10-02 +### Fixed +- Hotfix for BM API returning malformed publishedfileids + ## [2.6.1] 2022-09-25 ### Fixed - Freedesktop shortcut errors From f3046078be97ded8daefb5986ebcda2d45a22628 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 3 Oct 2022 07:06:31 +0900 Subject: [PATCH 47/63] Fix connect to fav --- dzgui.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 68a4cf1..c9ed54c 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.6.2 +version=2.6.3 aid=221100 game="dayz" @@ -707,7 +707,7 @@ connect_to_fav(){ query_api fetch_query_ports echo "[DZGUI] Attempting connection to $fav_label" - connect "$qport_list" + connect "$qport_list" "ip" one_shot_launch=0 else warn "No fav server configured" From 339d82cc38536fd4260f4594183584f87a3cb515 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 3 Oct 2022 07:15:08 +0900 Subject: [PATCH 48/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 2f8458a..5469e5d 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [2.6.3] 2022-10-02 +### Fixed +- Hotfix for connect-to-fav not getting modlist + ## [2.6.2] 2022-10-02 ### Fixed - Hotfix for BM API returning malformed publishedfileids From 4dfac043a5d114bd46fec99f7b4c743c1d8a1e6a Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 3 Oct 2022 11:34:50 +0900 Subject: [PATCH 49/63] Update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index 2f87514..febe110 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Connect by IP added. Requires Steam API key. See documentation +NEWS: Restored connect-to-fav option to a working state. From 94708df4706a54a4f9bdd16cac0432e34b9afba7 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:28:53 +0900 Subject: [PATCH 50/63] Update documentation --- dzgui.adoc | 80 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 10 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index 86c9de8..709f3b3 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -1,5 +1,5 @@ = DZGUI documentation -DayZ community server graphical launcher for Linux | Last updated: 2022-09-17 +DayZ community server graphical launcher for Linux | Last updated: 2022-09-08 :nofooter: :toc: left :stylesheet: custom.css @@ -13,14 +13,17 @@ DZGUI contains some expanded functionality that will eventually be backported to == Setup === Dependencies -If not already installed, the below can be found in your system's package manager. +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` - === Preparation . Download DZGUI and make it executable: @@ -36,7 +39,8 @@ curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash 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: ``` @@ -122,7 +126,7 @@ image::https://github.com/aclist/dztui/raw/testing/images/tutorial/01.png[01,500 ==== 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. You can navigate through menus using the D-pad and use A/B to respectively confirm selections and go back. +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 @@ -203,7 +207,7 @@ $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 <> 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. @@ -215,7 +219,60 @@ Once all of the mods are downloaded and staged, DZGUI will notify you that it is == Menu options -==== Launch server list +==== 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 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. + +===== Filters + +[%autowidth] +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. + +|=== +|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) +|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 @@ -232,14 +289,14 @@ Bypasses the server list and quick-connects to a single favorite server specifie ==== Connect by IP -Instead of relying on server IDs, returns the list of servers 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". -Once configured, you can insert this key in the app when launching the "Connect by IP" feature for the first time. +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 <> option. @@ -271,12 +328,15 @@ If enabled, this menu contains a sub-menu with various advanced features, enumer ===== 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. [%autowidth] |=== -|key|value +|Key|Value |`api_key`|the API key generated at BattleMetrics. See <> |`whitelist`|comma-separated list of server IDs from BattleMetrics; integer-values only From a3f7fdce19b6fae825492f00030406aa37cef433 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:54:42 +0900 Subject: [PATCH 51/63] Bump version --- changelog.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/changelog.md b/changelog.md index 5469e5d..9a97712 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,21 @@ - Custom query API - Standardize dialogs +## [2.7.0] 2022-10-04 +### Added +- Server browser and geolocation algorithm +- More verbose error codes +- Additional progress bar setup and destruction throughout the application +- Additional API response validation +### Fixed +- Encapsulate title strings to prevent leaky arguments in title bars +- Remove erroneous slow boot process if first-time setup was already complete +- Delete server list not emptying when returning to main menu +### Changed +- Group main menu entries in advance of future functionality +- Better abstraction of paths +- Clarification of certain options and errors + ## [2.6.3] 2022-10-02 ### Fixed - Hotfix for connect-to-fav not getting modlist From 4cc598d99a9fdc5ac645d96b6eaf8bdb8b94e5fd Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:55:26 +0900 Subject: [PATCH 52/63] Add server browser --- dzgui.sh | 510 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 420 insertions(+), 90 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index c9ed54c..f5db638 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.6.3 +version=2.7.0 aid=221100 game="dayz" @@ -11,15 +11,25 @@ sd_res="--width=1280 --height=800" config_path="$HOME/.config/dztui/" config_file="${config_path}dztuirc" tmp=/tmp/dzgui.tmp +fifo=/tmp/table.tmp separator="%%" -git_url="https://github.com/aclist/dztui/issues" -stable_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" -testing_url="https://raw.githubusercontent.com/aclist/dztui/testing/dzgui.sh" -help_url="https://aclist.github.io/dzgui/dzgui" check_config_msg="Check config values and restart." -news_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/news" +issues_url="https://github.com/aclist/dztui/issues" +url_prefix="https://raw.githubusercontent.com/aclist/dztui" +stable_url="$url_prefix/dzgui" +testing_url="$url_prefix/testing" +releases_url="https://github.com/aclist/dztui/releases/download/browser" +help_url="https://aclist.github.io/dzgui/dzgui" +news_url="$stable_url/news" freedesktop_path="$HOME/.local/share/applications" sd_install_path="$HOME/.local/share/dzgui" +helpers_path="$sd_install_path/helpers" +geo_file="$helpers_path/ips.csv" +km_helper="$helpers_path/latlon" +sums_path="$helpers_path/sums.md5" +km_helper_url="$releases_url/latlon" +db_file="$releases_url/ips.csv.gz" +sums_url="$testing_url/helpers/sums.md5" update_last_seen(){ mv $config_file ${config_path}dztuirc.old @@ -69,17 +79,21 @@ depcheck(){ init_items(){ #array order determines menu selector; this is destructive items=( - "Launch server list" - "Quick connect to favorite server" - "Connect by IP" - "Add server by ID" - "Add favorite server" - "Delete server" - "List installed mods" - "Toggle debug mode" - "Report bug (opens in browser)" - "Help file (opens in browser)" - "View changelog" + "[Connect]" + " NEW: Server browser" + " My servers" + " Quick connect to favorite server" + "[Manage servers]" + " Connect by IP" + " Add server by ID" + " Add favorite server" + " Delete server" + "[Options]" + " List installed mods" + " Toggle debug mode" + " Report bug (opens in browser)" + " Help file (opens in browser)" + " View changelog" ) } warn_and_exit(){ @@ -115,14 +129,17 @@ query_api(){ code=$(jq -r '.errors[] .status' <<< $response) #TODO: fix granular api codes if [[ $code -eq 401 ]]; then - warn_and_exit "Error $code: malformed API key" + warn "Error $code: malformed API key" + return elif [[ $code -eq 500 ]]; then - warn_and_exit "Error $code: malformed server list" + warn "Error $code: malformed server list" + return fi fi if [[ -z $(echo $response | jq '.data[]') ]]; then - warn_and_exit "API returned empty response. Check config file." + warn "95: API returned empty response. Check config file." + return fi } write_config(){ @@ -212,7 +229,7 @@ guess_path(){ } create_config(){ while true; do - player_input="$(zenity --forms --add-entry="Player name (required for some servers)" --add-entry="API key" --add-entry="Server 1 (you can add more later)" --title=DZGUI --text=DZGUI --add-entry="Server 2" --add-entry="Server 3" --add-entry="Server 4" $sd_res --separator="│" 2>/dev/null)" + player_input="$(zenity --forms --add-entry="Player name (required for some servers)" --add-entry="API key" --add-entry="Server 1 (you can add more later)" --title="DZGUI" --text="DZGUI" --add-entry="Server 2" --add-entry="Server 3" --add-entry="Server 4" $sd_res --separator="│" 2>/dev/null)" #explicitly setting IFS crashes zenity in loop #and mapfile does not support high ascii delimiters #so split fields with newline @@ -258,7 +275,7 @@ varcheck(){ [[ ! -d "$game_dir" ]] && (err "Malformed game path") [[ $whitelist =~ [[:space:]] ]] && (err "Separate whitelist values with commas") } -run_depcheck() { +run_depcheck(){ if [[ -z $(depcheck) ]]; then : else @@ -280,6 +297,7 @@ run_varcheck(){ if [[ $code -eq 1 ]]; then exit else + echo "100" create_config fi fi @@ -334,7 +352,7 @@ manual_mod_install(){ if [[ $is_steam_deck -eq 0 ]]; then open_mod_links until [[ -z $diff ]]; do - zenity --question --title="DZGUI" --ok-label="Next" --cancel-label="Cancel" --text="Opened mod links in browser. Click [Next] when all mods have been subscribed to. This dialog may reappear if clicking [Next] too soon before mods are synchronized in the background." 2>/dev/null + zenity --question --title="DZGUI" --ok-label="Next" --cancel-label="Cancel" --text="Opened mod links in browser.\nClick [Next] when all mods have been subscribed to.\nThis dialog may reappear if clicking [Next] too soon\nbefore mods are synchronized in the background." --width=500 2>/dev/null rc=$? if [[ $rc -eq 0 ]]; then compare @@ -346,7 +364,7 @@ manual_mod_install(){ else steam_deck_mods fi - passed_mod_check + passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) } encode(){ echo "$1" | md5sum | cut -c -8 @@ -386,9 +404,11 @@ symlinks(){ } passed_mod_check(){ echo "[DZGUI] Passed mod check" + echo "# Preparing symlinks" stale_symlinks legacy_symlinks symlinks + echo "100" launch } @@ -396,16 +416,20 @@ connect(){ #TODO: sanitize/validate input readarray -t qport_arr <<< "$qport_list" if [[ -z ${qport_arr[@]} ]]; then - err "Failed to obtain query ports" + err "98: Failed to obtain query ports" return fi ip=$(echo "$1" | awk -F"$separator" '{print $1}') bid=$(echo "$1" | awk -F"$separator" '{print $2}') if [[ $2 == "ip" ]]; then - fetch_mods_sa "$ip" + fetch_mods_sa "$ip" > >(zenity --pulsate --progress --auto-close --no-cancel --width=500 2>/dev/null) else fetch_mods "$bid" fi + if [[ $ret -eq 96 ]]; then + unset ret + return + fi validate_mods rc=$? [[ $rc -eq 1 ]] && return @@ -413,14 +437,13 @@ connect(){ if [[ -n $diff ]]; then manual_mod_install else - passed_mod_check + passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) fi } fetch_mods(){ remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \ | jq -r '.data[] .attributes .details .modIds[]') } -#TODO: deprecated (for now) fetch_mods_sa(){ sa_ip=$(echo "$1" | awk -F: '{print $1}') for i in ${qport_arr[@]}; do @@ -429,12 +452,17 @@ fetch_mods_sa(){ fi done echo "[DZGUI] Querying modlist on ${sa_ip}:${sa_port}" - remote_mods=$(curl -Ls "https://dayzsalauncher.com/api/v1/query/$sa_ip/$sa_port" | jq -r '.result.mods[].steamWorkshopId') - rc=$? - if [[ $rc -eq 1 ]]; then - err "Failed to fetch modlist" + echo "# Querying modlist on ${sa_ip}:${sa_port}" + local response=$(curl -Ls "https://dayzsalauncher.com/api/v1/query/$sa_ip/$sa_port") + local status=$(echo "$response" | jq '.status') + if [[ $status -eq 1 ]]; then + echo "100" + err "97: Failed to fetch modlist" + zenity --error --title="DZGUI" --width=500 --text="[ERROR] 97: Failed to fetch modlist" 2>/dev/null && + ret=96 return fi + remote_mods=$(echo "$response" | jq -r '.result.mods[].steamWorkshopId') qport_arr=() } prepare_ip_list(){ @@ -484,8 +512,8 @@ fetch_ip_metadata(){ < $meta_file jq '.response' > $json res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null) if [[ ! $? -eq 0 ]]; then - warn "Failed to retrieve IP metadata. Check IP or API key and try again." - echo "[DZGUI] Failed to retrieve IP metadata" + 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 @@ -496,7 +524,13 @@ fetch_ip_metadata(){ #local_ip(){ #(^127\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.) #} +test_steam_api(){ + local code=$(curl -ILs "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api" \ + | grep -E "^HTTP") + [[ $code =~ 403 ]] && return 1 +} add_steam_api(){ + [[ ! $(test_steam_api) ]] && return 1 mv $config_file ${config_path}dztuirc.old nr=$(awk '/steam_api=/ {print NR}' ${config_path}dztuirc.old) steam_api="steam_api=\"$steam_api\"" @@ -505,28 +539,32 @@ add_steam_api(){ zenity --info --title="DZGUI" --text="Added Steam API key to:\n\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null source $config_file } +check_steam_api(){ + if [[ -z $steam_api ]]; then + steam_api=$(zenity --entry --text="Key 'steam_api' not present in config file. Enter Steam API key:" --title="DZGUI" 2>/dev/null) + if [[ $? -eq 1 ]] ; then + return + elif [[ ${#steam_api} -lt 32 ]] || [[ ! $(test_steam_api) ]]; then + zenity --warning --title="DZGUI" --text="Check API key and try again." 2>/dev/null + return 1 + else + add_steam_api + fi + fi +} validate_ip(){ echo "$1" | grep -qP '^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$' } connect_by_ip(){ source $config_file - if [[ -z $steam_api ]]; then - steam_api=$(zenity --entry --text="Key 'steam_api' not present in config file. Enter Steam API key:" --title="DZGUI" 2>/dev/null) - if [[ $? -eq 1 ]] ; then - return - elif [[ $steam_api -lt 32 ]]; then - zenity --warning --title="DZGUI" --text="Check API key and try again." - return - else - add_steam_api - fi - fi + check_steam_api + [[ $? -eq 1 ]] && return while true; do if [[ $return_from_table -eq 1 ]]; then return_from_table=0 return fi - ip=$(zenity --entry --text="Enter server IP" --title="DZGUI" 2>/dev/null) + ip=$(zenity --entry --text="Enter server IP (omit port)" --title="DZGUI" 2>/dev/null) [[ $? -eq 1 ]] && return if validate_ip "$ip"; then fetch_ip_metadata @@ -589,7 +627,7 @@ launch(){ mods=$(concat_mods) if [[ $debug -eq 1 ]]; then launch_options="steam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro \"-mod=$mods\"" - print_launch_options="$(printf "[DEBUG] This is a dry run. These options would have been used to launch the game:\n\n$launch_options\n" | fold -w 60)" + 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)" zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\ --text="$print_launch_options" 2>/dev/null if [[ $? -eq 0 ]]; then @@ -618,9 +656,9 @@ browser(){ report_bug(){ echo "[DZGUI] Opening issues page in browser" if [[ $is_steam_deck -eq 1 ]]; then - steam steam://openurl/"$git_url" 2>/dev/null + steam steam://openurl/"$issues_url" 2>/dev/null elif [[ $is_steam_deck -eq 0 ]]; then - browser "$git_url" 2>/dev/null & + browser "$issues_url" 2>/dev/null & fi } help_file(){ @@ -675,7 +713,7 @@ populate(){ set_header ${FUNCNAME[0]} fi rc=$? - if [[ $rc -eq 0 ]]; then + if [[ $rc -eq 0 ]]; then if [[ -z $sel ]]; then warn "No item was selected." else @@ -689,8 +727,8 @@ populate(){ done } list_mods(){ - if [[ -z $(installed_mods) || -z $(find $workshop_dir -maxdepth 2 -name "*.cpp" | grep .cpp) ]]; then - zenity --info --text="No mods currently installed or incorrect path given" $sd_res 2>/dev/null + if [[ -z $(installed_mods) ]] || [[ -z $(find $workshop_dir -maxdepth 2 -name "*.cpp" | grep .cpp) ]]; then + zenity --info --text="94: No mods currently installed or incorrect path given" $sd_res 2>/dev/null else for d in $(find $game_dir/* -maxdepth 1 -type l); do dir=$(basename $d) @@ -710,7 +748,7 @@ connect_to_fav(){ connect "$qport_list" "ip" one_shot_launch=0 else - warn "No fav server configured" + warn "93: No fav server configured" fi } @@ -771,10 +809,14 @@ debug_menu(){ } query_and_connect(){ query_api - parse_json + parse_json #TODO: create logger function - echo "[DZGUI] Checking response time of servers" - create_array | zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null + if [[ ! $delete -eq 1 ]]; then + echo "[DZGUI] Checking response time of servers" + create_array | zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null + else + create_array + fi rc=$? if [[ $rc -eq 1 ]]; then : @@ -782,15 +824,282 @@ query_and_connect(){ populate fi } +exclude_full(){ + response=$(echo "$response" | jq '[.[]|select(.players!=.max_players)]') +} +exclude_empty(){ + response=$(echo "$response" | jq '[.[]|select(.players!=0)]') +} +filter_maps(){ + echo "# Filtering maps" + [[ $ret -eq 98 ]] && return + local maps=$(echo "$response" | jq -r '.[].map//empty|ascii_downcase' | sort -u) + local map_ct=$(echo "$maps" | wc -l) + local map_sel=$(echo "$maps" | zenity --list --column="Check" --width=1200 --height=800 2>/dev/null --title="DZGUI" --text="Found $map_ct map types") + echo "[DZGUI] Selected '$map_sel'" + if [[ -z $map_sel ]]; then + ret=97 + return + fi + echo "100" + response=$(echo "$response" | jq --arg map "$map_sel" '[.[]|select(.map)//empty|select(.map|ascii_downcase == $map)]') +} +exclude_daytime(){ + response=$(echo "$response" | jq '[.[]|select(.gametype|test(",[0][6-9]:|,[1][0-6]:")|not)]') +} +exclude_nighttime(){ + response=$(echo "$response" | jq '[.[]|select(.gametype|test(",[1][7-9]:|,[2][0-4]:|[0][0-5]:")|not)]') +} +keyword_filter(){ + response=$(echo "$response" | jq --arg search "$search" '[.[]|select(.name|ascii_downcase | contains($search))]') +} +exclude_lowpop(){ + response=$(echo "$response" | jq '[.[]|select(.players > 9)]') +} +exclude_nonascii(){ + response=$(echo "$response" | jq -r '[.[]|select(.name|test("^([[:ascii:]])*$"))]') +} +strip_null(){ + response=$(echo "$response" | jq -r '[.[]|select(.map//empty)]') +} +local_latlon(){ + if [[ -z $(command -v dig) ]]; then + local local_ip=$(curl -Ls "https://ipecho.net/plain") + else + local local_ip=$(dig +short myip.opendns.com @resolver1.opendns.com) + fi + local url="http://ip-api.com/json/$local_ip" + local res=$(curl -Ls "$url" | jq -r '"\(.lat),\(.lon)"') + local_lat=$(echo "$res" | awk -F, '{print $1}') + local_lon=$(echo "$res" | awk -F, '{print $2}') +} +disabled(){ + if [[ -z ${disabled[@]} ]]; then + printf "%s" "-" + else + for((i=0;i<${#disabled[@]};i++)); do + if [[ $i < $((${#disabled[@]}-1)) ]]; then + printf "%s, " "${disabled[$i]}" + else + printf "%s" "${disabled[$i]}" + fi + + done + fi +} +pagination(){ + if [[ ${#qport[@]} -eq 1 ]]; then + entry=server + else + entry=servers + fi + printf "DZGUI %s | " "$version" + printf "Mode: %s |" "$mode" + printf "Fav: %s " "$fav_label" + printf "\nIncluded: %s | " "$filters" + printf "Excluded: %s " "$(disabled)" + if [[ -n $search ]]; then + printf "| Keyword: %s " "$search" + fi + printf "\nReturned: %s %s of %s | " "${#qport[@]}" "$entry" "$total_servers" + printf "Players online: %s" "$players_online" +} +check_geo_file(){ + local gzip="$helpers_path/ips.csv.gz" + curl -Ls "$sums_url" > "$sums_path" + cd "$helpers_path" + md5sum -c "$sums_path" 2>/dev/null 1>&2 + local res=$? + if [[ $res -eq 1 ]]; then + run(){ + mkdir -p "$helpers_path" + echo "# Fetching new geolocation DB" + curl -Ls "$db_file" > "$gzip" + echo "# Extracting coordinates" + #force overwrite + gunzip -f "$gzip" + echo "# Preparing helper file" + curl -Ls "$km_helper_url" > "$km_helper" + chmod +x $km_helper + echo "100" + } + run > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) + fi +} +choose_filters(){ + if [[ $is_steam_deck -eq 0 ]]; then + sd_res="--width=1920 --height=1080" + fi + sels=$(zenity --title="DZGUI" --text="Server search" --list --checklist --column "Check" --column "Option" --hide-header TRUE "All maps (untick to select from map list)" TRUE "Daytime" TRUE "Nighttime" False "Empty" False "Full" False "Low population" FALSE "Non-ASCII titles" FALSE "Keyword search" $sd_res 2>/dev/null) + if [[ $sels =~ Keyword ]]; then + search=$(zenity --entry --text="Search (case insensitive)" --width=500 --title="DZGUI" 2>/dev/null | awk '{print tolower($0)}') + [[ -z $search ]] && { ret=97; return; } + 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" + local network="$(echo "$given_ip" | awk -F. '{OFS="."}{print $1"."$2}')" + local binary=$(grep -E "^$network\." $geo_file) + local three=$(echo $given_ip | awk -F. '{print $3}') + local host=$(echo $given_ip | awk -F. '{print $4}') + local res=$(echo "$binary" | awk -F[.,] -v three=$three -v host=$host '$3 <=three && $7 >= three{if($3>three || ($3==three && $4 > host) || $7 < three || ($7==three && $8 < host)){next}{print}}' | awk -F, '{print $7,$8}') + local remote_lat=$(echo "$res" | awk '{print $1}') + local remote_lon=$(echo "$res" | awk '{print $2}') + if [[ -z $remote_lat ]]; then + local dist="Unknown" + echo "$dist" + else + local dist=$($km_helper "$local_lat" "$local_lon" "$remote_lat" "$remote_lon") + printf "%05.0f %s" "$dist" "km" + fi +} +prepare_filters(){ + echo "# Filtering list" + [[ ! "$sels" =~ "Full" ]] && { exclude_full; disabled+=("Full") ; } + [[ ! "$sels" =~ "Empty" ]] && { exclude_empty; disabled+=("Empty") ; } + [[ ! "$sels" =~ "Daytime" ]] && { exclude_daytime; disabled+=("Daytime") ; } + [[ ! "$sels" =~ "Nighttime" ]] && { exclude_nighttime; disabled+=("Nighttime") ; } + [[ ! "$sels" =~ "Low population" ]] && { exclude_lowpop; disabled+=("Low-pop") ; } + [[ ! "$sels" =~ "Non-ASCII titles" ]] && { exclude_nonascii; disabled+=("Non-ASCII") ; } + [[ -n "$search" ]] && keyword_filter + strip_null + echo "100" +} +write_fifo(){ + [[ -p $fifo ]] && rm $fifo + mkfifo $fifo + for((i=0;i<${#qport[@]};i++)); do + printf "%s\n%s\n%s\n%03d\n%03d\n%s\n%s:%s\n%s\n" "${map[$i]}" "${name[$i]}" "${gametime[$i]}" \ + "${players[$i]}" "${max[$i]}" "$(get_dist ${addr[$i]})" "${addr[$i]}" "${gameport[$i]}" "${qport[$i]}" >> $fifo + done +} +munge_servers(){ + if [[ ! "$sels" =~ "All maps" ]]; then + filter_maps > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) + disabled+=("All maps") + fi + [[ $ret -eq 97 ]] && return + prepare_filters > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) + if [[ $(echo "$response" | jq 'length') -eq 0 ]]; then + zenity --error --text="No matching servers" 2>/dev/null + return + fi + local addr=$(echo "$response" | jq -r '.[].addr' | awk -F: '{print $1}') + local gameport=$(echo "$response" | jq -r '.[].gameport') + local qport=$(echo "$response" | jq -r '.[].addr' | awk -F: '{print $2}') + #jq bug #1788, raw output cannot be used with ASCII + local name=$(echo "$response" | jq -a '.[].name' | sed 's/\\u[0-9a-z]\{4\}//g;s/^"//;s/"$//') + local players=$(echo "$response" | jq -r '.[].players') + local max=$(echo "$response" | jq -r '.[].max_players') + local map=$(echo "$response" | jq -r '.[].map|ascii_downcase') + local gametime=$(echo "$response" | jq -r '.[].gametype' | grep -oE '[0-9]{2}:[0-9]{2}$') + readarray -t qport <<< $qport + readarray -t gameport <<< $gameport + readarray -t addr <<< $addr + readarray -t name <<< $name + readarray -t players <<< $players + readarray -t map <<< $map + readarray -t max <<< $max + readarray -t gametime <<< $gametime + if [[ $is_steam_deck -eq 0 ]]; then + sd_res="--width=1920 --height=1080" + fi + + write_fifo & + pid=$! + local sel=$(zenity --text="$(pagination)" --title="DZGUI" --list --column=Map --column=Name --column=Gametime --column=Players --column=Max --column=Distance --column=IP --column=Qport $sd_res --print-column=7,8 --separator=%% 2>/dev/null < <(while true; do cat $fifo; done)) + if [[ -z $sel ]]; then + rm $fifo + kill -9 $pid + else + rm $fifo + kill -9 $pid + echo $sel + fi +} +debug_servers(){ + [[ -f $debug_log ]] && rm $debug_log + if [[ -n $steam_api ]]; then + exists=true + else + exists=false + fi + key_len=${#steam_api} + first_char=${steam_api:0:1} + last_char=${steam_api:0-1} + debug_res=$(curl -Ls "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api") + debug_len=$(echo "$debug_res" | jq '[.response.servers[]]|length') + [[ -z $debug_len ]] && debug_len=0 + cat <<-DOC > $debug_log + ======START DEBUG====== + Key exists: $exists + First char: $first_char + Last char: $last_char + Key length: $key_len + ======Short query====== + Expected: 10 + Found: $debug_len + Response follows----> + $debug_res + ======END DEBUG======= + DOC +} +server_browser(){ + check_steam_api + [[ $? -eq 1 ]] && return + + unset ret + file=$(mktemp) + local limit=20000 + local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=$limit&key=$steam_api" + check_geo_file + local_latlon + choose_filters + [[ -z $sels ]] && return + [[ $ret -eq 97 ]] && return + #TODO: some error handling here + fetch(){ + echo "# Getting server list" + curl -Ls "$url" > $file + } + fetch > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) + response=$(< $file jq -r '.response.servers') + total_servers=$(echo "$response" | jq 'length') + players_online=$(echo "$response" | jq '.[].players' | awk '{s+=$1}END{print s}') + debug_log="$HOME/.local/share/dzgui/DEBUG.log" + debug_servers + local sel=$(munge_servers) + if [[ -z $sel ]]; then + unset filters + unset search + ret=98 + return + fi + local sel_ip=$(echo "$sel" | awk -F%% '{print $1}') + local sel_port=$(echo "$sel" | awk -F%% '{print $2}') + qport_list="$sel_ip%%$sel_port" + if [[ -n "$sel_ip" ]]; then + connect "$sel_ip" "ip" + else + return + fi +} + +mods_disk_size(){ + printf "Total size on disk: %s" $(du -sh "$game_dir" | awk '{print $1}') +} main_menu(){ print_news set_mode if [[ $debug -eq 1 ]]; then - items+=("Debug options") + items+=(" Debug options") fi if [[ -n $fav ]]; then - items[4]="Change favorite server" + items[7]=" Change favorite server" fi while true; do set_header ${FUNCNAME[0]} @@ -799,31 +1108,41 @@ main_menu(){ if [[ -z $sel ]]; then warn "No item was selected." elif [[ $sel == "${items[0]}" ]]; then - query_and_connect + : elif [[ $sel == "${items[1]}" ]]; then - connect_to_fav + server_browser elif [[ $sel == "${items[2]}" ]]; then - connect_by_ip + query_and_connect elif [[ $sel == "${items[3]}" ]]; then - add_by_id + connect_to_fav elif [[ $sel == "${items[4]}" ]]; then - add_by_fav + : elif [[ $sel == "${items[5]}" ]]; then + connect_by_ip + elif [[ $sel == "${items[6]}" ]]; then + add_by_id + elif [[ $sel == "${items[7]}" ]]; then + add_by_fav + elif [[ $sel == "${items[8]}" ]]; then delete=1 query_and_connect - elif [[ $sel == "${items[6]}" ]]; then - list_mods | sed 's/\t/\n/g' | zenity --list --column="Mod" --column="Symlink" --title="DZGUI" $sd_res --print-column="" 2>/dev/null - elif [[ $sel == "${items[7]}" ]]; then + elif [[ $sel == "${items[9]}" ]]; then + : + elif [[ $sel == "${items[10]}" ]]; then + list_mods | sed 's/\t/\n/g' | zenity --list --column="Mod" --column="Symlink" \ + --title="DZGUI" $sd_res --text="$(mods_disk_size)" \ + --print-column="" 2>/dev/null + elif [[ $sel == "${items[11]}" ]]; then toggle_debug main_menu return - elif [[ $sel == "${items[8]}" ]]; then + elif [[ $sel == "${items[12]}" ]]; then report_bug - elif [[ $sel == "${items[9]}" ]]; then + elif [[ $sel == "${items[13]}" ]]; then help_file - elif [[ $sel == "${items[10]}" ]]; then + elif [[ $sel == "${items[14]}" ]]; then changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null - elif [[ $sel == "${items[11]}" ]]; then + elif [[ $sel == "${items[15]}" ]]; then debug_menu else warn "This feature is not yet implemented." @@ -842,12 +1161,12 @@ page_through(){ parse_json(){ page=$(echo "$list_response" | jq -r '.links.next?') if [[ $first_entry -eq 1 ]]; then - list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') + 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") first_entry=0 fi if [[ "$page" != "null" ]]; then - list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"') + 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 @@ -866,6 +1185,7 @@ check_ping(){ fi } create_array(){ + rows=() list=$(cat $tmp) #TODO: improve error handling for null values lc=1 @@ -896,9 +1216,9 @@ create_array(){ declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping") fi let lc++ - done <<< "$list" + done <<< "$list" - for i in "${rows[@]}"; do echo -e "$i"; done > $tmp + for i in "${rows[@]}"; do echo -e "$i"; done > $tmp } set_fav(){ #TODO: test API key here and return errors @@ -933,12 +1253,14 @@ download_new_version(){ source_script=$(realpath "$0") source_dir=$(dirname "$source_script") mv $source_script $source_script.old + echo "# Downloading version $upstream" curl -Ls "$version_url" > $source_script rc=$? if [[ $rc -eq 0 ]]; then echo "[DZGUI] Wrote $upstream to $source_script" chmod +x $source_script touch ${config_path}.unmerged + echo "100" 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 code=$? if [[ $code -eq 0 ]]; then @@ -948,39 +1270,39 @@ download_new_version(){ exit fi else + echo "100" mv $source_script.old $source_script - zenity --info --title="DZGUI" --text "Failed to download new version." 2>/dev/null + zenity --info --title="DZGUI" --text "[ERROR] 99: Failed to download new version." 2>/dev/null return fi } check_branch(){ if [[ $branch == "stable" ]]; then - version_url="$stable_url" + version_url="$stable_url/dzgui.sh" elif [[ $branch == "testing" ]]; then - version_url="$testing_url" + version_url="$testing_url/dzgui.sh" fi upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}') } enforce_dl(){ - download_new_version + download_new_version > >(zenity --progress --pulsate --auto-close --no-cancel --width=500) } -prompt_dl(){ - zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t$branch\nYour version\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 +prompt_dl(){ + 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 else - download_new_version + echo "100" + download_new_version > >(zenity --progress --pulsate --auto-close --no-cancel --width=500) fi } check_version(){ - if [[ ! -f $config_file ]]; then : ; else source $config_file; fi - if [[ -z $branch ]]; then - branch="stable" - fi + [[ -f $config_file ]] && source $config_file + [[ -z $branch ]] && branch="stable" check_branch - [[ ! -d "$HOME/dzgui" ]] && freedesktop_dirs + [[ ! -d "$freedesktop_path" ]] && freedesktop_dirs if [[ $version == $upstream ]]; then check_unmerged else @@ -1044,7 +1366,7 @@ toggle_debug(){ setup(){ if [[ -n $fav ]]; then set_fav - items[4]="Change favorite server" + items[7]=" Change favorite server" fi } check_map_count(){ @@ -1078,7 +1400,7 @@ while true; do zenity --info --title="DZGUI" --text="Added "$fav_id" to:\n${config_path}dztuirc\nIf errors occurred, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null source $config_file set_fav - items[4]="Change favorite server" + items[7]=" Change favorite server" return fi fi @@ -1096,6 +1418,7 @@ lock(){ res=$? if [[ $res -eq 0 ]]; then echo "[DZGUI] Already running ($pid)" + zenity --info --text="DZGUI already running (pid $pid)" --width=500 --title="DZGUI" 2>/dev/null exit elif [[ $pid == $$ ]]; then : @@ -1103,8 +1426,8 @@ lock(){ echo $$ > $config_path/.lockfile fi } -main(){ - lock +initial_setup(){ + echo "# Initial setup" run_depcheck check_architecture check_version @@ -1113,7 +1436,14 @@ main(){ run_varcheck init_items setup + echo "100" +} +main(){ + lock + initial_setup > >(zenity --pulsate --progress --auto-close --title="DZGUI" --width=500 2>/dev/null) main_menu + #cruddy handling for steam forking + [[ $? -eq 1 ]] && pkill -f dzgui.sh } main From 8ecf9a35d9bb29d808a756e31be47735e9168c3e Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:55:32 +0900 Subject: [PATCH 53/63] Update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index febe110..e08d8d3 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Restored connect-to-fav option to a working state. +NEWS: Full server browser. Search and filter 20K servers. Requires Steam API key (see help file). From 69a5f61c18e39e96839851c55928f01c24d9ef77 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 6 Oct 2022 07:49:43 +0900 Subject: [PATCH 54/63] Fix server launch --- dzgui.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index f5db638..eae640a 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.7.0 +version=2.7.1 aid=221100 game="dayz" @@ -409,7 +409,6 @@ passed_mod_check(){ legacy_symlinks symlinks echo "100" - launch } connect(){ @@ -438,6 +437,7 @@ connect(){ manual_mod_install else passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) + launch fi } fetch_mods(){ @@ -626,7 +626,7 @@ concat_mods(){ launch(){ mods=$(concat_mods) if [[ $debug -eq 1 ]]; then - launch_options="steam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro \"-mod=$mods\"" + launch_options="steam -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)" zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\ --text="$print_launch_options" 2>/dev/null From 95838a9dfc4c9807e1b40fed3a5a69ed1bffa989 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 6 Oct 2022 07:50:45 +0900 Subject: [PATCH 55/63] Bump version --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 9a97712..5101391 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [2.7.1] 2022-10-05 +### Fixed +- Server launch not kicking off after symlink creation + ## [2.7.0] 2022-10-04 ### Added - Server browser and geolocation algorithm From 2c98774a1e44730fd0af7a52dda6499bf83cd6cd Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 6 Oct 2022 07:51:10 +0900 Subject: [PATCH 56/63] Bump news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index e08d8d3..10321c6 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Full server browser. Search and filter 20K servers. Requires Steam API key (see help file). +NEWS: Fixed game launch not kicking off. From 83766f2a736ac1ceafbd4020fc1d6eb5db70d12d Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 6 Oct 2022 07:51:26 +0900 Subject: [PATCH 57/63] Reword --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 5101391..2f8816a 100644 --- a/changelog.md +++ b/changelog.md @@ -7,7 +7,7 @@ ## [2.7.1] 2022-10-05 ### Fixed -- Server launch not kicking off after symlink creation +- Game launch not kicking off after symlink creation ## [2.7.0] 2022-10-04 ### Added From 73ed9fb1c7adde3572ab6dce4c8d2298538369bf Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 7 Oct 2022 13:32:52 +0900 Subject: [PATCH 58/63] Stage helpers dir --- helpers/sums | 1 + 1 file changed, 1 insertion(+) create mode 100644 helpers/sums diff --git a/helpers/sums b/helpers/sums new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/helpers/sums @@ -0,0 +1 @@ + From a2cfcadc5eb005d579b2ee16067e33e159b76d9c Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 7 Oct 2022 13:34:03 +0900 Subject: [PATCH 59/63] Add checksums --- helpers/sums | 1 - helpers/sums.md5 | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 helpers/sums create mode 100644 helpers/sums.md5 diff --git a/helpers/sums b/helpers/sums deleted file mode 100644 index 8b13789..0000000 --- a/helpers/sums +++ /dev/null @@ -1 +0,0 @@ - diff --git a/helpers/sums.md5 b/helpers/sums.md5 new file mode 100644 index 0000000..ee37c2e --- /dev/null +++ b/helpers/sums.md5 @@ -0,0 +1,2 @@ +e7f3b25223ac4dfd5e30a0b55bb3ff6c ips.csv +b038fdb8f655798207bd28de3a004706 latlon From 7c20f5597fd48a2116f7e6936e5ce0881ba3c922 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 7 Oct 2022 13:34:43 +0900 Subject: [PATCH 60/63] Add latlon.c --- helpers/latlon.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 helpers/latlon.c diff --git a/helpers/latlon.c b/helpers/latlon.c new file mode 100644 index 0000000..4c1788a --- /dev/null +++ b/helpers/latlon.c @@ -0,0 +1,36 @@ +#include +#include +#include + +#define R 6371 +#define TO_RAD (3.1415926536 / 180) +double dist(double th1, double ph1, double th2, double ph2) +{ + double dx, dy, dz; + ph1 -= ph2; + ph1 *= TO_RAD, th1 *= TO_RAD, th2 *= TO_RAD; + + dz = sin(th1) - sin(th2); + dx = cos(ph1) * cos(th1) - cos(th2); + dy = sin(ph1) * cos(th1); + return asin(sqrt(dx * dx + dy * dy + dz * dz) / 2) * 2 * R; +} + +int main(int argc, const char * argv[]) +{ + if(argc < 5 || argc > 5){ + return 1; + } + float coords[4]; + for(int i=1;i<5;i++){ + if(atof(argv[i]) == 0){ + return 1; + } + coords[i] = atof(argv[i]); + } + + double d = dist(coords[1], coords[2], coords[3], coords[4]); + printf("%.1f\n", d); + + return 0; +} From a7e2de9104fd5f99876dca4280c05f73360b3c70 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 7 Oct 2022 13:35:22 +0900 Subject: [PATCH 61/63] Fix URL --- dzgui.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index eae640a..127e8e5 100644 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.7.1 +version=2.7.2 aid=221100 game="dayz" @@ -29,7 +29,7 @@ km_helper="$helpers_path/latlon" sums_path="$helpers_path/sums.md5" km_helper_url="$releases_url/latlon" db_file="$releases_url/ips.csv.gz" -sums_url="$testing_url/helpers/sums.md5" +sums_url="$stable_url/helpers/sums.md5" update_last_seen(){ mv $config_file ${config_path}dztuirc.old From c15b516f36957c112c7ec5b56c52ef81f1a752c7 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 11 Oct 2022 16:09:08 +0900 Subject: [PATCH 62/63] Update news --- news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news b/news index 10321c6..4c1eda9 100644 --- a/news +++ b/news @@ -1 +1 @@ -NEWS: Fixed game launch not kicking off. +NEWS: Next update will have a simplified mod installation method. Ensure that your system has wmctrl or xdotool installed. From c293fcd8c5136b6578f519b2f400d45bc01335cc Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 11 Oct 2022 21:50:05 +0900 Subject: [PATCH 63/63] Update readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 185fdf4..6aaeac2 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ ## What this is -A GUI version of [DZTUI](https://github.com/aclist/dztui) for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. +A GUI version of [DZTUI](https://githubom/aclist/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 allows you to connect to 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: +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: -1. Display server metadata in a table (server data and ID, player count, ping, current gametime) -2. Find and prepare mods being requested by the server +1. Display server metadata in a table (server name, player count, ping, current gametime, distance, IP) +2. Find and prepare mods being requested by the server (choose from manual or automatic installation) 3. Concatenate launch options to pass to Steam ## Setup and usage