From 24a1a8211e7f20dfe9551343c963c8354078adb7 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 28 Aug 2024 07:34:09 +0900 Subject: [PATCH 1/6] chore: bump version --- dzgui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dzgui.sh b/dzgui.sh index 3e764be..9f0982e 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.3.3-beta.5 +version=5.3.3-beta.6 #CONSTANTS aid=221100 From 80babbfea89f0c50f882df1d198b6bf4802a9c80 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 28 Aug 2024 07:52:20 +0900 Subject: [PATCH 2/6] fix: conditional operator --- dzgui.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index 9f0982e..fd08763 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.3.3-beta.6 +version=5.3.3-beta.7 #CONSTANTS aid=221100 @@ -380,7 +380,7 @@ test_display_mode(){ check_architecture(){ local cpu=$(< /proc/cpuinfo awk -F": " '/AMD Custom APU [0-9]{4}$/ {print $2; exit}') read -a APU_MODEL <<< "$cpu" - if [[ ${APU_MODEL[3]} != "0932" ]] || [[ ${APU_MODEL[3]} != "0405" ]]; then + if [[ ${APU_MODEL[3]} != "0932" ]] && [[ ${APU_MODEL[3]} != "0405" ]]; then is_steam_deck=0 logger INFO "Setting architecture to 'desktop'" return From 06359a40aeb6d615441fbb4d528c9524edd0e592 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:42:51 +0900 Subject: [PATCH 3/6] fix: block/unblock signal handlers --- CHANGELOG.md | 19 ++++++++++++++----- docs/dzgui.adoc | 4 ++++ docs/dzgui_dark.adoc | 4 ++++ dzgui.sh | 10 +++++++--- helpers/funcs | 2 +- helpers/ui.py | 15 ++++++++++----- 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7831b8..9b61325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,27 +1,36 @@ # Changelog -## [5.3.3-beta.5] 2024-08-27 +## [5.4.1-beta.5] 2024-09-10 +### Added +- Pre-boot validation check for users with self-compiled version of jq +### Fixed +- When reloading the server browser, the map combobox selection would revert to the last selected map instead of All Maps +- Server filter toggle signals were accessible from the main menu when switching between menu contexts +- Global cooldown dialog could sometimes block filter toggles after cooldown reset +- Normalized minor version number due to a previous clerical error + +## [5.4.0-beta.5] 2024-08-27 ### Added - Freedesktop application icons for system taskbar, tray, and other dialogs ### Fixed - Errors being printed to the console when Exit button was explicitly clicked -## [5.3.3-beta.4] 2024-08-21 +## [5.4.0-beta.4] 2024-08-21 ### Added - Emit CPU model name when exporting system debug log ### Fixed - Detect Steam Deck OLED APU variant during initial setup -## [5.3.3-beta.3] 2024-08-04 +## [5.4.0-beta.3] 2024-08-04 ### Added - Scan local area network for DayZ servers -## [5.3.3-beta.2] 2024-08-03 +## [5.4.0-beta.2] 2024-08-03 ### Fixed - Clerical hotfix for previous player names fix - Test if DayZ directory is empty at startup, implying that the game was moved to a new library collection -## [5.3.3-beta.1] 2024-07-16 +## [5.4.0-beta.1] 2024-07-16 ### Fixed - Encapsulate player names correctly so that names with whitespace in them are supported diff --git a/docs/dzgui.adoc b/docs/dzgui.adoc index e18dcff..e059491 100644 --- a/docs/dzgui.adoc +++ b/docs/dzgui.adoc @@ -33,6 +33,10 @@ All dependencies are installed out of the box on Steam Deck. - `wmctrl` or `xdotool` - `PyGObject` (`python-gobject`) + +[NOTE] +If you are using a self-compiled version of jq (e.g. gentoo), it must be configured with support for oniguruma (this is the default setting on most distributions). + === Preparation ==== Step 1: Download DZGUI and make it executable diff --git a/docs/dzgui_dark.adoc b/docs/dzgui_dark.adoc index 004be46..967ffa5 100644 --- a/docs/dzgui_dark.adoc +++ b/docs/dzgui_dark.adoc @@ -33,6 +33,10 @@ All dependencies are installed out of the box on Steam Deck. - `wmctrl` or `xdotool` - `PyGObject` (`python-gobject`) + +[NOTE] +If you are using a self-compiled version of jq (e.g. gentoo), it must be configured with support for oniguruma (this is the default setting on most distributions). + === Preparation ==== Step 1: Download DZGUI and make it executable diff --git a/dzgui.sh b/dzgui.sh index fd08763..0a1d3e2 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.3.3-beta.7 +version=5.4.1-beta.1 #CONSTANTS aid=221100 @@ -220,6 +220,10 @@ depcheck(){ raise_error_and_quit "$msg" fi done + local jqmsg="jq must be compiled with support for oniguruma" + local jqtest + jqtest=$(echo '{"test": "foo"}' | jq '.test | test("^foo$")') + [[ $? -ne 0 ]] && raise_error_and_quit "$jqmsg" logger INFO "Initial dependencies satisfied" } check_pyver(){ @@ -562,10 +566,10 @@ fetch_helpers_by_sum(){ [[ -f "$config_file" ]] && source "$config_file" declare -A sums sums=( - ["ui.py"]="f89047e3fde843dbb52d343daf8d2675" + ["ui.py"]="9a5df05a4b67af3be06e39d9d7cebff3" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="44eca80b207057423c2d298cc7cf1e29" + ["funcs"]="b73289e0aa71a91da539c28707a6405c" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" diff --git a/helpers/funcs b/helpers/funcs index 7d19b29..59bf84e 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -o pipefail -version=5.3.3 +version=5.4.1 #CONSTANTS aid=221100 diff --git a/helpers/ui.py b/helpers/ui.py index a15fc50..37b56d6 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -19,7 +19,7 @@ gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GLib, Gdk, GObject, Pango from enum import Enum -# 5.3.3 +# 5.4.1 app_name = "DZGUI" start_time = 0 @@ -574,6 +574,7 @@ class ButtonBox(Gtk.Box): column = Gtk.TreeViewColumn(column_title, renderer, text=i) treeview.append_column(column) self._populate(context) + toggle_signal(treeview, treeview, '_on_keypress', False) treeview.set_model(row_store) treeview.grab_focus() @@ -1033,7 +1034,6 @@ class TreeView(Gtk.TreeView): # Local server lists may have different filter toggles from remote list # FIXME: tree selection updates twice here. attach signal later toggle_signal(self, self.selected_row, '_on_tree_selection_changed', False) - # toggle_signal(self, self.selected_row, '_on_check_toggled', False) for column in self.get_columns(): self.remove_column(column) row_store.clear() @@ -1071,6 +1071,10 @@ class TreeView(Gtk.TreeView): self.update_first_col(mode) transient_parent = self.get_outer_window() + # Reset map selection + selected_map.clear() + selected_map.append("Map=All maps") + for check in checks: toggle_signal(self.get_outer_grid().right_panel.filters_vbox, check, '_on_check_toggle', True) toggle_signal(self, self, '_on_keypress', True) @@ -1190,20 +1194,20 @@ class TreeView(Gtk.TreeView): valid_contexts = ["Server browser", "My saved servers", "Recent servers", "Scan LAN servers"] if chosen_row in valid_contexts: # server contexts share the same model type - for check in checks: - toggle_signal(filters_vbox, check, '_on_check_toggle', False) if chosen_row == "Server browser": - reinit_checks() cooldown = call_out(self, "test_cooldown", "", "") if cooldown.returncode == 1: spawn_dialog(self.get_outer_window(), cooldown.stdout, "NOTIFY") return 1 + reinit_checks() else: for check in checks: if check.get_label() not in toggled_checks: toggled_checks.append(check.get_label()) check.set_active(True) + for check in checks: + toggle_signal(filters_vbox, check, '_on_check_toggle', False) self._update_multi_column(chosen_row) map_store.clear() @@ -1812,6 +1816,7 @@ class App(Gtk.Application): is_steam_deck = False is_game_mode = False + GLib.set_prgname(app_name) self.win = OuterWindow(is_steam_deck, is_game_mode) self.win.set_icon_name("dzgui") From 523ff2c32d732e0934e79a2a058a9f68054309fc Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:57:33 +0900 Subject: [PATCH 4/6] fix: signal control flow --- CHANGELOG.md | 6 +++++- dzgui.sh | 2 +- helpers/ui.py | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b61325..0ca8908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## [5.4.1-beta.5] 2024-09-10 +## [5.4.1-beta.2] 2024-09-10 +### Fixed +- Checkbox toggle signal handling control flow + +## [5.4.1-beta.1] 2024-09-10 ### Added - Pre-boot validation check for users with self-compiled version of jq ### Fixed diff --git a/dzgui.sh b/dzgui.sh index 0a1d3e2..e8ae0de 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -566,7 +566,7 @@ fetch_helpers_by_sum(){ [[ -f "$config_file" ]] && source "$config_file" declare -A sums sums=( - ["ui.py"]="9a5df05a4b67af3be06e39d9d7cebff3" + ["ui.py"]="9cac4d3b87ef292e7d30b25ca86cc438" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" ["funcs"]="b73289e0aa71a91da539c28707a6405c" diff --git a/helpers/ui.py b/helpers/ui.py index 37b56d6..5e77f68 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -1200,14 +1200,15 @@ class TreeView(Gtk.TreeView): if cooldown.returncode == 1: spawn_dialog(self.get_outer_window(), cooldown.stdout, "NOTIFY") return 1 + for check in checks: + toggle_signal(filters_vbox, check, '_on_check_toggle', False) reinit_checks() else: for check in checks: + toggle_signal(filters_vbox, check, '_on_check_toggle', False) if check.get_label() not in toggled_checks: toggled_checks.append(check.get_label()) check.set_active(True) - for check in checks: - toggle_signal(filters_vbox, check, '_on_check_toggle', False) self._update_multi_column(chosen_row) map_store.clear() From 3e1170ffd8adfb1da72d95c3e11feb46ddf88a31 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:42:47 +0900 Subject: [PATCH 5/6] fix: fallback logic for network traversal (#128) --- CHANGELOG.md | 6 +++++- dzgui.sh | 4 ++-- helpers/funcs | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ca8908..c62e093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog +## [5.4.1-beta.2] 2024-09-12 +### Fixed +- Use fallback logic for modlist queries when user traverses networks + ## [5.4.1-beta.2] 2024-09-10 ### Fixed -- Checkbox toggle signal handling control flow +- Fix signal handling control flow for checkbox toggles ## [5.4.1-beta.1] 2024-09-10 ### Added diff --git a/dzgui.sh b/dzgui.sh index e8ae0de..420b769 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.4.1-beta.1 +version=5.4.1-beta.3 #CONSTANTS aid=221100 @@ -569,7 +569,7 @@ fetch_helpers_by_sum(){ ["ui.py"]="9cac4d3b87ef292e7d30b25ca86cc438" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="b73289e0aa71a91da539c28707a6405c" + ["funcs"]="4a06a823b6240c518687d2a8ec20e914" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" diff --git a/helpers/funcs b/helpers/funcs index 59bf84e..16030fd 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -285,7 +285,15 @@ a2s(){ local qport="$2" local mode="$3" logger INFO "Querying '$ip:$qport' with mode '$mode'" - python3 "$query_helper" "$ip" "$qport" "$mode" + local res + res=$(python3 "$query_helper" "$ip" "$qport" "$mode") + if [[ $? -eq 1 ]]; then + res=$(try_fallback "$ip" "$qport" "$mode") + if [[ $? -eq 1 ]]; then + return 1 + fi + fi + printf "%s\n" "$res" } is_in_favs(){ shift @@ -1064,6 +1072,34 @@ update_symlinks(){ legacy_symlinks symlinks } +try_fallback(){ + local ip="$1" + local qport="$2" + local mode="$3" + if [[ $mode != "rules" ]] && [[ $mode != "names" ]]; then + return 1 + fi + [[ -z $api_key ]] && return 1 + local res=$(curl -s "$bm_api" -H "Authorization: Bearer "$api_key"" \ + -G -d "filter[game]=$game" \ + -d "filter[search]=%22${ip}:${qport}%22") + [[ -z $res ]] && return 1 + local len=$(<<< "$res" jq '.data|length') + [[ $len -eq 0 ]] && return 1 + local record=$(<<< "$res" jq -r ' + .data[].attributes + |select(.status != "removed").details') + case "$mode" in + "rules") + <<< "$record" jq '.modIds[]' + ;; + "names") + <<< "$record" jq ' + [.modNames, .modIds] as [$n, $i] + | {names: $n, ids: $i}' + ;; + esac +} try_connect(){ local record="$1" local ip=$(<<< $record awk -F: '{print $1}') From ed07fd03435adcf6ef985367b22dca1774663224 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Wed, 25 Sep 2024 23:08:29 +0900 Subject: [PATCH 6/6] chore: normalize changelog --- CHANGELOG.md | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c62e093..7c4bd94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,46 +1,26 @@ # Changelog -## [5.4.1-beta.2] 2024-09-12 -### Fixed -- Use fallback logic for modlist queries when user traverses networks - -## [5.4.1-beta.2] 2024-09-10 -### Fixed -- Fix signal handling control flow for checkbox toggles - -## [5.4.1-beta.1] 2024-09-10 +## [5.4.1] 2024-09-25 ### Added - Pre-boot validation check for users with self-compiled version of jq ### Fixed +- Use fallback logic for modlist queries when user traverses networks +- Fix signal handling control flow for checkbox toggles - When reloading the server browser, the map combobox selection would revert to the last selected map instead of All Maps - Server filter toggle signals were accessible from the main menu when switching between menu contexts - Global cooldown dialog could sometimes block filter toggles after cooldown reset - Normalized minor version number due to a previous clerical error -## [5.4.0-beta.5] 2024-08-27 -### Added -- Freedesktop application icons for system taskbar, tray, and other dialogs -### Fixed -- Errors being printed to the console when Exit button was explicitly clicked - -## [5.4.0-beta.4] 2024-08-21 -### Added -- Emit CPU model name when exporting system debug log -### Fixed -- Detect Steam Deck OLED APU variant during initial setup - -## [5.4.0-beta.3] 2024-08-04 +## [5.4.0] 2024-08-27 ### Added - Scan local area network for DayZ servers - -## [5.4.0-beta.2] 2024-08-03 -### Fixed -- Clerical hotfix for previous player names fix -- Test if DayZ directory is empty at startup, implying that the game was moved to a new library collection - -## [5.4.0-beta.1] 2024-07-16 +- Freedesktop application icons for system taskbar, tray, and other dialogs +- Emit CPU model name when exporting system debug log ### Fixed +- Errors being printed to the console when Exit button was explicitly clicked +- Detect Steam Deck OLED APU variant during initial setup - Encapsulate player names correctly so that names with whitespace in them are supported +- Test if DayZ directory is empty at startup, implying that the game was moved to a new library collection ## [5.3.2] 2024-07-02 ### Fixed