1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2025-04-03 19:13:00 +02:00

fix: test connection control flow

This commit is contained in:
aclist 2024-12-12 11:16:46 +09:00
parent a079d554bc
commit 7c5bd76e8f

View file

@ -874,14 +874,18 @@ test_connection(){
["github.com"]="https://github.com/$author"
["codeberg.org"]="https://codeberg.org/$author"
)
res=$(get_response_code "${hr["github.com"]}")
[[ $res -ne 200 ]] && remote_host=cb
res=$(get_response_code "${hr["codeberg.org"]}")
[[ $res -ne 200 ]] && raise_error_and_quit "$str (${hr["codeberg.org"]})"
# steam API is mandatory
res=$(get_response_code "${hr["steampowered.com"]}")
[[ $res -ne 200 ]] && raise_error_and_quit "$str ${hr["steampowered.com"]}"
res=$(get_response_code "${hr["github.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"