Update dns_hostup.sh

This commit is contained in:
hostup
2025-12-01 15:55:17 +01:00
committed by GitHub
parent b8e394e76a
commit d97b4477b2

View File

@@ -171,7 +171,7 @@ _hostup_detect_zone() {
return 1 return 1
fi fi
_domain_candidate="$(printf "%s" "$fulldomain" | tr 'A-Z' 'a-z')" _domain_candidate="$(printf "%s" "$fulldomain" | tr '[:upper:]' '[:lower:]')"
_debug "hostup_initial_candidate" "$_domain_candidate" _debug "hostup_initial_candidate" "$_domain_candidate"
while [ -n "$_domain_candidate" ]; do while [ -n "$_domain_candidate" ]; do
@@ -181,10 +181,10 @@ _hostup_detect_zone() {
HOSTUP_ZONE_ID="$_lookup_zone_id" HOSTUP_ZONE_ID="$_lookup_zone_id"
return 0 return 0
fi fi
case "$_domain_candidate" in case "$_domain_candidate" in
*.*) ;; *.*) ;;
*) break ;; *) break ;;
esac esac
_domain_candidate="${_domain_candidate#*.}" _domain_candidate="${_domain_candidate#*.}"
@@ -210,7 +210,7 @@ _hostup_record_name() {
suffix=".$zonedomain" suffix=".$zonedomain"
case "$fulldomain" in case "$fulldomain" in
*"$suffix") *"$suffix")
printf "%s" "${fulldomain%$suffix}" printf "%s" "${fulldomain%"$suffix"}"
;; ;;
*) *)
# Domain not within zone, fall back to full host # Domain not within zone, fall back to full host
@@ -371,7 +371,7 @@ _hostup_record_key() {
zone_id="$1" zone_id="$1"
domain="$2" domain="$2"
safe_zone="$(printf "%s" "$zone_id" | sed 's/[^A-Za-z0-9]/_/g')" safe_zone="$(printf "%s" "$zone_id" | sed 's/[^A-Za-z0-9]/_/g')"
safe_domain="$(printf "%s" "$domain" | tr 'A-Z' 'a-z' | sed 's/[^a-z0-9]/_/g')" safe_domain="$(printf "%s" "$domain" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/_/g')"
printf "%s_%s" "$safe_zone" "$safe_domain" printf "%s_%s" "$safe_zone" "$safe_domain"
} }
@@ -449,7 +449,7 @@ _hostup_rest() {
_debug2 "_hostup_response" "$_hostup_response" _debug2 "_hostup_response" "$_hostup_response"
case "$http_status" in case "$http_status" in
200|201|204) return 0 ;; 200 | 201 | 204) return 0 ;;
401) 401)
_err "HostUp API returned 401 Unauthorized. Check HOSTUP_API_KEY scopes and IP restrictions." _err "HostUp API returned 401 Unauthorized. Check HOSTUP_API_KEY scopes and IP restrictions."
return 1 return 1