Browse Source

Update _get_root logic

pull/5117/head
alviy 5 months ago
committed by GitHub
parent
commit
4bf4259dda
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      dnsapi/dns_alviy.sh

8
dnsapi/dns_alviy.sh

@ -103,11 +103,10 @@ dns_alviy_rm() {
_get_root() {
domain=$1
i=2
p=1
while true; do
h=$(printf "%s" "$domain" | rev | cut -d . -f 1-2 | rev)
if [ -z "$h" ]; then
#not valid
_debug "can't get host from $domain"
return 1
fi
@ -118,13 +117,10 @@ _get_root() {
if _contains "$response" '"code":"NOT_FOUND"'; then
_debug "$h not found"
else
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p)
_sub_domain=$(printf "%s" "$domain" | rev | cut -d . -f 3- | rev)
_domain="$h"
return 0
fi
p="$i"
i=$(_math "$i" + 1)
done
return 1
}

Loading…
Cancel
Save