mirror of
https://github.com/aclist/dztui.git
synced 2024-12-30 14:12:04 +01:00
fix: triage hotfix from testing
This commit is contained in:
parent
1533febf9a
commit
bc9178d2de
2 changed files with 62 additions and 18 deletions
72
dzgui.sh
72
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=5.5.1
|
version=5.5.2
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
|
@ -54,7 +54,8 @@ km_helper="$helpers_path/latlon"
|
||||||
sums_path="$helpers_path/sums.md5"
|
sums_path="$helpers_path/sums.md5"
|
||||||
func_helper="$helpers_path/funcs"
|
func_helper="$helpers_path/funcs"
|
||||||
|
|
||||||
#URLS
|
#REMOTE
|
||||||
|
remote_host=gh
|
||||||
author="aclist"
|
author="aclist"
|
||||||
repo="dztui"
|
repo="dztui"
|
||||||
url_prefix="https://raw.githubusercontent.com/$author/$repo"
|
url_prefix="https://raw.githubusercontent.com/$author/$repo"
|
||||||
|
@ -64,6 +65,7 @@ releases_url="https://github.com/$author/$repo/releases/download/browser"
|
||||||
km_helper_url="$releases_url/latlon"
|
km_helper_url="$releases_url/latlon"
|
||||||
geo_file_url="$releases_url/ips.csv.gz"
|
geo_file_url="$releases_url/ips.csv.gz"
|
||||||
|
|
||||||
|
|
||||||
set_im_module(){
|
set_im_module(){
|
||||||
#TODO: drop pending SteamOS changes
|
#TODO: drop pending SteamOS changes
|
||||||
pgrep -a gamescope | grep -q "generate-drm-mode"
|
pgrep -a gamescope | grep -q "generate-drm-mode"
|
||||||
|
@ -312,13 +314,14 @@ check_unmerged(){
|
||||||
check_version(){
|
check_version(){
|
||||||
local version_url=$(format_version_url)
|
local version_url=$(format_version_url)
|
||||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||||
|
#2024-12-12: do not clobber local version if unreachable
|
||||||
|
[[ -z $upstream ]] && return
|
||||||
logger INFO "Local branch: '$branch', local version: $version"
|
logger INFO "Local branch: '$branch', local version: $version"
|
||||||
if [[ $branch == "stable" ]]; then
|
if [[ $branch == "stable" ]]; then
|
||||||
version_url="$stable_url/dzgui.sh"
|
version_url="$stable_url/dzgui.sh"
|
||||||
elif [[ $branch == "testing" ]]; then
|
elif [[ $branch == "testing" ]]; then
|
||||||
version_url="$testing_url/dzgui.sh"
|
version_url="$testing_url/dzgui.sh"
|
||||||
fi
|
fi
|
||||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
|
||||||
[[ ! -f "$freedesktop_path/$app_name.desktop" ]] && freedesktop_dirs
|
[[ ! -f "$freedesktop_path/$app_name.desktop" ]] && freedesktop_dirs
|
||||||
if [[ $version == $upstream ]]; then
|
if [[ $version == $upstream ]]; then
|
||||||
logger INFO "Local version is same as upstream"
|
logger INFO "Local version is same as upstream"
|
||||||
|
@ -371,9 +374,14 @@ prompt_dl(){
|
||||||
}
|
}
|
||||||
dl_changelog(){
|
dl_changelog(){
|
||||||
local mdbranch
|
local mdbranch
|
||||||
|
local md
|
||||||
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
||||||
[[ $branch == "testing" ]] && mdbranch="testing"
|
[[ $branch == "testing" ]] && mdbranch="testing"
|
||||||
local md="https://raw.githubusercontent.com/$author/dztui/${mdbranch}/CHANGELOG.md"
|
if [[ $remote_host == "gh" ]]; then
|
||||||
|
md="https://raw.githubusercontent.com/$author/$repo/${mdbranch}/CHANGELOG.md"
|
||||||
|
else
|
||||||
|
md="https://codeberg.org/$author/$repo/raw/branch/${mdbranch}/CHANGELOG.md"
|
||||||
|
fi
|
||||||
curl -Ls "$md" > "$state_path/CHANGELOG.md"
|
curl -Ls "$md" > "$state_path/CHANGELOG.md"
|
||||||
}
|
}
|
||||||
test_display_mode(){
|
test_display_mode(){
|
||||||
|
@ -535,7 +543,7 @@ fetch_dzq(){
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local sha=3088bbfb147b77bc7b6a9425581b439889ff3f7f
|
local sha=3088bbfb147b77bc7b6a9425581b439889ff3f7f
|
||||||
local author="aclist"
|
local author="yepoleb"
|
||||||
local repo="dayzquery"
|
local repo="dayzquery"
|
||||||
local url="https://raw.githubusercontent.com/$author/$repo/$sha/dayzquery.py"
|
local url="https://raw.githubusercontent.com/$author/$repo/$sha/dayzquery.py"
|
||||||
curl -Ls "$url" > "$file"
|
curl -Ls "$url" > "$file"
|
||||||
|
@ -569,14 +577,14 @@ fetch_helpers_by_sum(){
|
||||||
[[ -f "$config_file" ]] && source "$config_file"
|
[[ -f "$config_file" ]] && source "$config_file"
|
||||||
declare -A sums
|
declare -A sums
|
||||||
sums=(
|
sums=(
|
||||||
["ui.py"]="dd7aa34df1d374739127cca3033a3f67"
|
["ui.py"]="be3da1e542d14105f4358dd38901e25a"
|
||||||
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["funcs"]="ad4d7b4bf2e8ef0ac7637183876dbec6"
|
["funcs"]="9c844298c5f112c0a2482dce3110ab70"
|
||||||
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
||||||
)
|
)
|
||||||
local author="aclist"
|
local author="aclist"
|
||||||
local repo="dztui"
|
local repo="dzgui"
|
||||||
local realbranch
|
local realbranch
|
||||||
local file
|
local file
|
||||||
local sum
|
local sum
|
||||||
|
@ -596,7 +604,13 @@ fetch_helpers_by_sum(){
|
||||||
file="$i"
|
file="$i"
|
||||||
sum="${sums[$i]}"
|
sum="${sums[$i]}"
|
||||||
full_path="$helpers_path/$file"
|
full_path="$helpers_path/$file"
|
||||||
url="https://raw.githubusercontent.com/$author/$repo/$realbranch/helpers/$file"
|
|
||||||
|
if [[ $remote_host == "gh" ]]; then
|
||||||
|
url="https://raw.githubusercontent.com/$author/$repo/$realbranch/helpers/$file"
|
||||||
|
else
|
||||||
|
url="https://codeberg.org/$author/$repo/raw/branch/$realbranch/helpers/$file"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -f "$full_path" ]] && [[ $(get_hash "$full_path") == $sum ]]; then
|
if [[ -f "$full_path" ]] && [[ $(get_hash "$full_path") == $sum ]]; then
|
||||||
logger INFO "$file is current"
|
logger INFO "$file is current"
|
||||||
else
|
else
|
||||||
|
@ -845,14 +859,42 @@ is_steam_running(){
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
get_response_code(){
|
||||||
|
local url="$1"
|
||||||
|
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
||||||
|
}
|
||||||
test_connection(){
|
test_connection(){
|
||||||
ping -c1 -4 github.com 1>/dev/null 2>&1
|
source "$config_file"
|
||||||
if [[ ! $? -eq 0 ]]; then
|
declare -A hr
|
||||||
raise_error_and_quit "No connection could be established to the remote server (github.com)."
|
local res1
|
||||||
|
local res2
|
||||||
|
local str="No connection could be established to the remote server"
|
||||||
|
hr=(
|
||||||
|
["steampowered.com"]="https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=$steam_api"
|
||||||
|
["github.com"]="https://github.com/$author"
|
||||||
|
["codeberg.org"]="https://codeberg.org/$author"
|
||||||
|
)
|
||||||
|
# steam API is mandatory, except on initial setup
|
||||||
|
if [[ -n $steam_api ]]; then
|
||||||
|
res=$(get_response_code "${hr["steampowered.com"]}")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "$str ("steampowered.com")"
|
||||||
fi
|
fi
|
||||||
ping -c1 -4 api.steampowered.com 1>/dev/null 2>&1
|
|
||||||
if [[ ! $? -eq 0 ]]; then
|
res=$(get_response_code "${hr["github.com"]}")
|
||||||
raise_error_and_quit "No connection could be established to the remote server (steampowered.com)."
|
if [[ $res -ne 200 ]]; then
|
||||||
|
logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback"
|
||||||
|
remote_host=cb
|
||||||
|
res=$(get_response_code "${hr["codeberg.org"]}")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "$str (${hr["codeberg.org"]})"
|
||||||
|
fi
|
||||||
|
if [[ $remote_host == "cb" ]]; then
|
||||||
|
url_prefix="https://codeberg.org/$author/$repo/raw/branch"
|
||||||
|
releases_url="https://codeberg.org/$author/$repo/releases/download/browser"
|
||||||
|
# 2024-12-12: interpolate variables again
|
||||||
|
stable_url="$url_prefix/dzgui"
|
||||||
|
testing_url="$url_prefix/testing"
|
||||||
|
km_helper_url="$releases_url/latlon"
|
||||||
|
geo_file_url="$releases_url/ips.csv.gz"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
legacy_cols(){
|
legacy_cols(){
|
||||||
|
|
|
@ -67,12 +67,14 @@ game_dir="$steam_path/steamapps/common/DayZ"
|
||||||
#URLS
|
#URLS
|
||||||
author="aclist"
|
author="aclist"
|
||||||
repo="dztui"
|
repo="dztui"
|
||||||
|
#TODO: this is hardcoded
|
||||||
|
#2024-12-12
|
||||||
gh_prefix="https://github.com"
|
gh_prefix="https://github.com"
|
||||||
issues_url="$gh_prefix/$author/$repo/issues"
|
issues_url="$gh_prefix/$author/$repo/issues"
|
||||||
url_prefix="https://raw.githubusercontent.com/$author/$repo"
|
url_prefix="https://codeberg.org/$author/$repo/branch"
|
||||||
stable_url="$url_prefix/dzgui"
|
stable_url="$url_prefix/dzgui"
|
||||||
testing_url="$url_prefix/testing"
|
testing_url="$url_prefix/testing"
|
||||||
releases_url="$gh_prefix/$author/$repo/releases/download/browser"
|
releases_url="https://codeberg.org/$author/$repo/releases/download/browser"
|
||||||
km_helper_url="$releases_url/latlon"
|
km_helper_url="$releases_url/latlon"
|
||||||
db_file="$releases_url/ips.csv.gz"
|
db_file="$releases_url/ips.csv.gz"
|
||||||
sums_url="$stable_url/helpers/sums.md5"
|
sums_url="$stable_url/helpers/sums.md5"
|
||||||
|
@ -773,7 +775,7 @@ dl_changelog(){
|
||||||
local file="CHANGELOG.md"
|
local file="CHANGELOG.md"
|
||||||
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
||||||
[[ $branch == "testing" ]] && mdbranch="testing"
|
[[ $branch == "testing" ]] && mdbranch="testing"
|
||||||
local md="https://raw.githubusercontent.com/$author/$repo/${mdbranch}/$file"
|
local md="https://codeberg.org/$author/$repo/raw/branch/${mdbranch}/$file"
|
||||||
curl -Ls "$md" > "$state_path/$file"
|
curl -Ls "$md" > "$state_path/$file"
|
||||||
}
|
}
|
||||||
toggle(){
|
toggle(){
|
||||||
|
|
Loading…
Reference in a new issue