From 64eb4bff9dca21e50520331bc8de9b9e02ca4a18 Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 17:19:14 +0900 Subject: [PATCH 1/7] Fix popup widths --- dzgui.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 1d2fe9c..4f6003e 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.8.0-rc.4 +version=2.8.0-rc.5 aid=221100 game="dayz" @@ -315,7 +315,7 @@ run_varcheck(){ else 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 + zenity --question --cancel-label="Exit" --text="Malformed config file. This is probably user error.\nStart first-time setup process again?" --width=500 2>/dev/null code=$? if [[ $code -eq 1 ]]; then exit @@ -833,7 +833,7 @@ delete_by_id(){ 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 + 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" --width=500 2>/dev/null source $config_file } delete_or_connect(){ @@ -1539,7 +1539,7 @@ add_by_id(){ nr=$(awk '/whitelist=/ {print NR}' ${config_path}dztuirc.old) awk -v "var=$new_whitelist" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc echo "[DZGUI] Added $id to key 'whitelist'" - zenity --info --title="DZGUI" --text="Added "$id" to:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null + zenity --info --title="DZGUI" --text="Added "$id" to:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" --width=500 2>/dev/null source $config_file return fi From 05af345a116d2343b55553e820b114c301e98bee Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 20:58:00 +0900 Subject: [PATCH 2/7] Enforce Steam API --- changelog.md | 17 ++++++++++++++- dzgui.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index 0fb994c..5b596f4 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,22 @@ - Custom query API - Standardize dialogs -## [2.8.0-rc.2] 2022-10-11 +## [2.8.0-rc.6] 2022-10-11 +### Dropped +- Stop using BM for query ports +### Added +- Deprecation warning/enforced Steam API + +## [2.8.0-rc.5] 2022-10-11 +### Fixed +- Width of some popups on Steam Deck + +## [2.8.0-rc.4] 2022-10-11 +### Changed +- Abstract news urls +- Clarify dependency warning + +## [2.8.0-rc.3] 2022-10-11 ### Added - Add forums link diff --git a/dzgui.sh b/dzgui.sh index 4f6003e..637f4ad 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.8.0-rc.5 +version=2.8.0-rc.6 aid=221100 game="dayz" @@ -93,7 +93,7 @@ init_items(){ #array order determines menu selector; this is destructive items=( "[Connect]" - " NEW: Server browser" + " Server browser" " My servers" " Quick connect to favorite server" "[Manage servers]" @@ -668,10 +668,11 @@ fetch_ip_metadata(){ 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 + [[ $code =~ 403 ]] && echo 1 + [[ $code =~ 200 ]] && echo 0 } add_steam_api(){ - [[ ! $(test_steam_api) ]] && return 1 + [[ $(test_steam_api) -eq 1 ]] && 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\"" @@ -685,7 +686,7 @@ check_steam_api(){ 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 + elif [[ ${#steam_api} -lt 32 ]] || [[ $(test_steam_api) -eq 1 ]]; then zenity --warning --title="DZGUI" --text="Check API key and try again." 2>/dev/null return 1 else @@ -847,10 +848,16 @@ delete_or_connect(){ else #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') + local lookup_port=$(echo "$lookup_ip" | awk -F: '{print $2}') + source $config_file + file=$(mktemp) + url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$lookup_ip&key=$steam_api" + curl -Ls "$url" > $file + local qport_res=$(< $file jq -r --arg port $lookup_port '.response.servers[]|select(.gameport==($port|tonumber)).addr') + local qport=$(echo "$qport_res" | awk -F: '{print $2}') qport_list="$lookup_ip%%$qport" - connect "$sel" "ip" + echo "$response" > resp + connect "$qport_list" "ip" fi } @@ -1628,6 +1635,40 @@ fetch_scmd_helper(){ [[ ! -f "$helpers_path/d.html" ]] && curl -Ls "$notify_url" > "$helpers_path/d.html" [[ ! -f "$helpers_path/d.webp" ]] && curl -Ls "$notify_img_url" > "$helpers_path/d.webp" } +deprecation_warning(){ + warn(){ + cat <<- HERE + IMPORTANT ANNOUNCEMENT + (Steam API key not found) + + A Steam API key is now mandatory to run the app. + The BM API returns incorrect mod data on some servers + and cannot be relied upon for up to date information. + + Going forward, we will only use the BM API as a convenience + function to manage server names and your favorite servers list, + and migrate to indexing servers on an IP basis. + + This is a backend change. You can continue adding servers by ID, + but we will retrieve information from Valve instead, as we do for the + server browser and connect-by-ip methods. + + Click [OK] to open the help page describing how to set up your key. + After you input a valid key, the app will resume. + HERE + } + if [[ -z $steam_api ]]; then + echo "100" + zenity --info --text="$(warn)" + key_setup_url="https://aclist.github.io/dzgui/dzgui.html#_api_key_server_ids" + browser "$key_setup_url" 2>/dev/null & + while true; do + if [[ $(check_steam_api) ]]; then + break + fi + done + fi +} initial_setup(){ echo "# Initial setup" run_depcheck @@ -1640,6 +1681,7 @@ initial_setup(){ run_varcheck init_items setup + deprecation_warning echo "100" } main(){ From a0757a1c88a5688885067df4e7ab7843249b266c Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 21:04:38 +0900 Subject: [PATCH 3/7] Reword forums --- changelog.md | 6 ++++++ dzgui.sh | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 5b596f4..52bcaa4 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,12 @@ - Custom query API - Standardize dialogs +## [2.8.0-rc.7] 2022-10-11 +### Changed +- Reword menu option +### Fixed +- Redirect stderr on popup + ## [2.8.0-rc.6] 2022-10-11 ### Dropped - Stop using BM for query ports diff --git a/dzgui.sh b/dzgui.sh index 637f4ad..922db62 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.8.0-rc.6 +version=2.8.0-rc.7 aid=221100 game="dayz" @@ -105,7 +105,7 @@ items=( " List installed mods" " Report bug (opens in browser)" " Help file (opens in browser)" - " Forum (opens in browser)" + " Become a beta tester (opens in browser)" " View changelog" " Advanced options" ) @@ -982,7 +982,7 @@ toggle_automods(){ source $config_file local big_prompt [[ $is_steam_deck -eq 1 ]] && big_prompt="--width=800" - [[ $auto_install == "1" ]] && zenity --info --text="$(automods_prompt)" $big_prompt + [[ $auto_install == "1" ]] && zenity --info --text="$(automods_prompt)" $big_prompt 2>/dev/null } options_menu(){ debug_list=( From 0953444ad1770db5790088b0b231c9b17d9730c1 Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 21:14:54 +0900 Subject: [PATCH 4/7] Change notification title --- helpers/scmd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/scmd.sh b/helpers/scmd.sh index 8375011..7a30202 100644 --- a/helpers/scmd.sh +++ b/helpers/scmd.sh @@ -297,7 +297,7 @@ return_to_dzg(){ done cleanup else - $(cd $HOME/.local/share/dzgui/helpers; zenity --text-info --html --width=390 --height=452 --filename="d.html" 2>/dev/null) + $(cd $HOME/.local/share/dzgui/helpers; zenity --text-info --title=DZGUI --html --width=390 --height=452 --filename="d.html" 2>/dev/null) cleanup fi } From 8f422125ec7b0990b019f344abb4683d98cdcbe4 Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 21:16:05 +0900 Subject: [PATCH 5/7] Bump version --- changelog.md | 4 ++++ dzgui.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 52bcaa4..ed846ea 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [2.8.0-rc.8] 2022-10-11 +### Changed +- Changed notification title + ## [2.8.0-rc.7] 2022-10-11 ### Changed - Reword menu option diff --git a/dzgui.sh b/dzgui.sh index 922db62..d6aa965 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.8.0-rc.7 +version=2.8.0-rc.8 aid=221100 game="dayz" From 6d378da50849748f90f5f09666072edc107da570 Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 21:43:52 +0900 Subject: [PATCH 6/7] Reorder main menu --- changelog.md | 4 ++++ dzgui.sh | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/changelog.md b/changelog.md index ed846ea..eb8253c 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [2.8.0-rc.9] 2022-10-11 +### Changed +- Reordered main menu elements + ## [2.8.0-rc.8] 2022-10-11 ### Changed - Changed notification title diff --git a/dzgui.sh b/dzgui.sh index d6aa965..20dffd8 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o pipefail -version=2.8.0-rc.8 +version=2.8.0-rc.9 aid=221100 game="dayz" @@ -103,11 +103,12 @@ items=( " Delete server" "[Options]" " List installed mods" - " Report bug (opens in browser)" - " Help file (opens in browser)" - " Become a beta tester (opens in browser)" " View changelog" " Advanced options" + "[Help]" + " Help file ⧉" + " Report bug ⧉" + " Become a beta tester ⧉" ) } warn_and_exit(){ @@ -1337,17 +1338,19 @@ main_menu(){ --title="DZGUI" $sd_res --text="$(mods_disk_size)" \ --print-column="" 2>/dev/null elif [[ $sel == "${items[11]}" ]]; then - report_bug - elif [[ $sel == "${items[12]}" ]]; then - help_file - elif [[ $sel == "${items[13]}" ]]; then - forum - elif [[ $sel == "${items[14]}" ]]; then changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null - elif [[ $sel == "${items[15]}" ]]; then + elif [[ $sel == "${items[12]}" ]]; then options_menu main_menu return + elif [[ $sel == "${items[13]}" ]]; then + : + elif [[ $sel == "${items[14]}" ]]; then + help_file + elif [[ $sel == "${items[15]}" ]]; then + report_bug + elif [[ $sel == "${items[16]}" ]]; then + forum else warn "This feature is not yet implemented." fi From f3e86426014ec972b5fa568aac2364df56c20090 Mon Sep 17 00:00:00 2001 From: aclist Date: Tue, 11 Oct 2022 21:48:15 +0900 Subject: [PATCH 7/7] Update docs --- dzgui.adoc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dzgui.adoc b/dzgui.adoc index 972e7f4..8b53c65 100644 --- a/dzgui.adoc +++ b/dzgui.adoc @@ -1,16 +1,14 @@ = DZGUI documentation -DayZ community server graphical launcher for Linux | Last updated: 2022-09-08 +DayZ community server graphical launcher for Linux | Last updated: 2022-10-11 :nofooter: :toc: left :stylesheet: custom.css == What this is -A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. +A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list official and community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically. DZGUI contains some expanded functionality that will eventually be backported to DZTUI. It is intended to be more of a user-friendly, turnkey solution for graphical desktop environments, and could also be used on the Steam Deck or similar devices. - - == Setup === Dependencies If not already installed, the below can be found in your system's package manager. @@ -19,7 +17,7 @@ If not already installed, the below can be found in your system's package manage - `jq` - `zenity` - `steam` - +- `wmctrl` or `xdotool` === Preparation . Download DZGUI and make it executable: @@ -57,6 +55,7 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently === API key & server IDs +==== BattleMetrics API key 1. Register for an API key at https://www.battlemetrics.com/account/register?after=%2Fdevelopers[BattleMetrics] (free) 2. From the **Personal Access Tokens** area, Select **New Token** 3. Give the token any name in the field at the top @@ -68,6 +67,10 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently [NOTE] You will be prompted to enter these IDs when starting the app, so you could refer to them in another window while you complete setup. More IDs can be added later. +==== Steam API key +1. Register for a https://steamcommunity.com/dev/apikey[Steam API key] using your Steam account. You will be asked for a unique URL for your app when registering. +2. Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1". +3. Once configured, you can insert this key in the app when launching the "Connect by IP" feature for the first time. === First-time launch