diff --git a/CHANGELOG.md b/CHANGELOG.md index ff5cceb..2d3ad13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [4.0.3] 2023-11-22 +## Fixed +- Query helper: backwards compatibility for pre-2021 versions of Python 3 + ## [4.0.2] 2023-11-22 ## Fixed - Query helper not loading: fixed a remote link pointing to the wrong destination and added a checksum verification to ensure file is present diff --git a/dzgui.sh b/dzgui.sh index a4e4715..49eb29a 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -2002,7 +2002,9 @@ fetch_dzq(){ curl -Ls "$url" > $helpers_path/a2s/$repo.py } fetch_query(){ - [[ $(md5sum $helpers_path/query.py | awk '{print $1}') == "7cbae12ae68b526e7ff376b638123cc7" ]] && return + local sum="d52ff070b5bb36ace2fce2d914479f47" + local file="$helpers_path/query.py" + [[ -f $file ]] && [[ $(md5sum $file | awk '{print $1}') == $sum ]] && return local author="aclist" local repo="dzgui" local url="https://raw.githubusercontent.com/$author/dztui/$repo/helpers/query.py" diff --git a/helpers/query.py b/helpers/query.py index 8a02a17..71ecc5e 100644 --- a/helpers/query.py +++ b/helpers/query.py @@ -40,11 +40,16 @@ def get_rules(ip, qport): except: sys.exit(1) +def switch(case): + if case == "info": + get_info(ip, qport) + elif case == "rules": + get_rules(ip, qport) + else: + sys.exit(1) + ip = sys.argv[1] qport = sys.argv[2] mode = sys.argv[3] -match mode: - case "info": - get_info(ip, qport) - case "rules": - get_rules(ip, qport) + +switch(mode)