diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f3a913..c0f2434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,26 @@ # Changelog -## [5.3.3] 2024-08-27 +## [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] 2024-08-27 ### Added - Scan local area network for DayZ servers - Freedesktop application icons for system taskbar, tray, and other dialogs - Emit CPU model name when exporting system debug log ### Fixed -- Detect Steam Deck OLED APU variant during initial setup - Errors being printed to the console when Exit button was explicitly clicked -- Test if DayZ library location was moved internally on Steam by user -- Encapsulate player names correctly to support whitespace +- 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 - Report WM_CLASS name to the window manager ## [5.3.2] 2024-07-02 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 6cc655a..95ae2f5 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o pipefail -version=5.3.0 +version=5.4.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"]="819a30c43644817a4f4a009f3df52b77" + ["ui.py"]="9cac4d3b87ef292e7d30b25ca86cc438" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="e1998f02f17776ccf2108fe5e9396d75" + ["funcs"]="4a06a823b6240c518687d2a8ec20e914" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" diff --git a/helpers/funcs b/helpers/funcs index 13c693a..16030fd 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -o pipefail -version=5.3.0 +version=5.4.1 #CONSTANTS aid=221100 @@ -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}') diff --git a/helpers/ui.py b/helpers/ui.py index 298f3b2..5e77f68 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.0 +# 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,17 +1194,18 @@ 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 + 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)