From bb9a331e6d58f5090bb5fd8318e0db0ff6d0640a Mon Sep 17 00:00:00 2001 From: aclist Date: Mon, 15 Aug 2022 01:22:21 +0900 Subject: [PATCH] Hotfix for small server lists --- changelog.md | 4 ++++ dzgui.sh | 8 +++++++- news | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 news diff --git a/changelog.md b/changelog.md index 46c842d..aa71dbe 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ - Standardize dialogs - Query and connect by IP/port +## [2.5.0-rc.2] 2022-08-14 +### Fixed +- Hotfix for server list responses with no next page cursor breaking table + ## [2.5.0-rc.1] 2022-08-14 ### Changed - More performant path discovery, skip extraneous prompts diff --git a/dzgui.sh b/dzgui.sh index ebd737f..0ba7f7b 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -17,7 +17,7 @@ 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" +news_url="https://raw.githubusercontent.com/aclist/dztui/testing/news" freedesktop_path="$HOME/.local/share/applications" sd_install_path="$HOME/.local/share/dzgui" @@ -96,6 +96,7 @@ 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 @@ -721,6 +722,11 @@ 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)"') + 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") diff --git a/news b/news new file mode 100644 index 0000000..3204691 --- /dev/null +++ b/news @@ -0,0 +1 @@ +NEWS: Emergency hotfix for small server lists breaking table