Update dns_googledomains.sh

This commit is contained in:
Marcio Cruz 2023-03-08 17:29:10 -03:00
parent 64b6f3df7a
commit b30227d544

View File

@ -24,7 +24,7 @@ dns_googledomains_add() {
i=0 i=0
while [ $i -le "$(echo "$fulldomain" | grep -o '\.' | wc -l)" ]; do while [ $i -le "$(echo "$fulldomain" | grep -o '\.' | wc -l)" ]; do
# join the domain parts from the current index to the end # join the domain parts from the current index to the end
current_domain=$(echo "$fulldomain" | cut -d "." -f $((i+1))-) current_domain=$(echo "$fulldomain" | cut -d "." -f $((i + 1))-)
# make a curl request to the URL and break the loop if the HTTP response code is 200 # make a curl request to the URL and break the loop if the HTTP response code is 200
response="$(_get "$GOOGLEDOMAINS_API/$current_domain")" response="$(_get "$GOOGLEDOMAINS_API/$current_domain")"
@ -35,7 +35,7 @@ dns_googledomains_add() {
_info "Found valid domain: $current_domain" _info "Found valid domain: $current_domain"
break break
fi fi
i=$((i+1)) i=$((i + 1))
done done
export _H1="Content-Type: application/json" export _H1="Content-Type: application/json"
_post "{\"accessToken\":\"$GOOGLEDOMAINS_TOKEN\",\"keepExpiredRecords\":true,\"recordsToAdd\":[{\"digest\":\"$txtvalue\",\"fqdn\":\"$fulldomain\"}]}" "$GOOGLEDOMAINS_API/$current_domain:rotateChallenges" "" "" _post "{\"accessToken\":\"$GOOGLEDOMAINS_TOKEN\",\"keepExpiredRecords\":true,\"recordsToAdd\":[{\"digest\":\"$txtvalue\",\"fqdn\":\"$fulldomain\"}]}" "$GOOGLEDOMAINS_API/$current_domain:rotateChallenges" "" ""
@ -51,7 +51,7 @@ dns_googledomains_rm() {
i=0 i=0
while [ $i -le "$(echo "$fulldomain" | grep -o '\.' | wc -l)" ]; do while [ $i -le "$(echo "$fulldomain" | grep -o '\.' | wc -l)" ]; do
# join the domain parts from the current index to the end # join the domain parts from the current index to the end
current_domain=$(echo "$fulldomain" | cut -d "." -f $((i+1))-) current_domain=$(echo "$fulldomain" | cut -d "." -f $((i + 1))-)
# make a curl request to the URL and break the loop if the HTTP response code is 200 # make a curl request to the URL and break the loop if the HTTP response code is 200
response="$(_get "$GOOGLEDOMAINS_API/$current_domain")" response="$(_get "$GOOGLEDOMAINS_API/$current_domain")"
@ -61,6 +61,6 @@ dns_googledomains_rm() {
echo "Found valid domain: $current_domain" echo "Found valid domain: $current_domain"
break break
fi fi
i=$((i+1)) i=$((i + 1))
done done
} }