mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-10 09:22:47 +00:00
Remove cloud domain record by cloud master zone
This commit is contained in:
parent
d0a16b0ec0
commit
fc0bc6aefc
@ -7,6 +7,8 @@
|
|||||||
#CLOUDNS_SUB_AUTH_ID=XXXXX
|
#CLOUDNS_SUB_AUTH_ID=XXXXX
|
||||||
#CLOUDNS_AUTH_PASSWORD="YYYYYYYYY"
|
#CLOUDNS_AUTH_PASSWORD="YYYYYYYYY"
|
||||||
CLOUDNS_API="https://api.cloudns.net"
|
CLOUDNS_API="https://api.cloudns.net"
|
||||||
|
DOMAIN_TYPE=
|
||||||
|
DOMAIN_MASTER=
|
||||||
|
|
||||||
######## Public functions #####################
|
######## Public functions #####################
|
||||||
|
|
||||||
@ -61,6 +63,15 @@ dns_cloudns_rm() {
|
|||||||
host="$(echo "$1" | sed "s/\.$zone\$//")"
|
host="$(echo "$1" | sed "s/\.$zone\$//")"
|
||||||
record=$2
|
record=$2
|
||||||
|
|
||||||
|
_dns_cloudns_get_zone_info "$zone"
|
||||||
|
|
||||||
|
_debug "Type" "$DOMAIN_TYPE"
|
||||||
|
_debug "Cloud Master" "$DOMAIN_MASTER"
|
||||||
|
if _contains "$DOMAIN_TYPE" "cloud"; then
|
||||||
|
zone=$DOMAIN_MASTER
|
||||||
|
fi
|
||||||
|
_debug "ZONE" "$zone"
|
||||||
|
|
||||||
_dns_cloudns_http_api_call "dns/records.json" "domain-name=$zone&host=$host&type=TXT"
|
_dns_cloudns_http_api_call "dns/records.json" "domain-name=$zone&host=$host&type=TXT"
|
||||||
if ! _contains "$response" "\"id\":"; then
|
if ! _contains "$response" "\"id\":"; then
|
||||||
return 1
|
return 1
|
||||||
@ -134,6 +145,19 @@ _dns_cloudns_init_check() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_dns_cloudns_get_zone_info() {
|
||||||
|
zone=$1
|
||||||
|
_dns_cloudns_http_api_call "dns/get-zone-info.json" "domain-name=$zone"
|
||||||
|
if ! _contains "$response" "\"status\":\"Failed\""; then
|
||||||
|
DOMAIN_TYPE=$(echo "$response" | tr ',' "\n" | grep -E '^"type"' | sed -re 's/^\"type\"\:\"([a-z]+)\"$/\1/g')
|
||||||
|
if _contains "$DOMAIN_TYPE" "cloud"; then
|
||||||
|
DOMAIN_MASTER=$(echo "$response" | tr ',' "\n" | grep -E '^"cloud-master"' | sed -re 's/^\"cloud-master\"\:\"([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}+)\"}$/\1/g'
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
_dns_cloudns_get_zone_name() {
|
_dns_cloudns_get_zone_name() {
|
||||||
i=2
|
i=2
|
||||||
while true; do
|
while true; do
|
||||||
@ -148,6 +172,11 @@ _dns_cloudns_get_zone_name() {
|
|||||||
_dns_cloudns_http_api_call "dns/get-zone-info.json" "domain-name=$zoneForCheck"
|
_dns_cloudns_http_api_call "dns/get-zone-info.json" "domain-name=$zoneForCheck"
|
||||||
|
|
||||||
if ! _contains "$response" "\"status\":\"Failed\""; then
|
if ! _contains "$response" "\"status\":\"Failed\""; then
|
||||||
|
DOMAIN_TYPE=$(echo "$response" | tr ',' "\n" | grep -E '^"type"' | sed -re 's/^\"type\"\:\"([a-z]+)\"$/\1/g')
|
||||||
|
if _contains "$DOMAIN_TYPE" "cloud"; then
|
||||||
|
DOMAIN_MASTER=$(echo "$response" | tr ',' "\n" | grep -E '^"cloud-master"' | sed -re 's/^\"cloud-master\"\:\"([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}+)\"}$/\1/g'
|
||||||
|
)
|
||||||
|
fi
|
||||||
echo "$zoneForCheck"
|
echo "$zoneForCheck"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user