Skip to content

Commit

Permalink
Fix parameter errors in west.cn
Browse files Browse the repository at this point in the history
West.cn requires the domain parameter to only specify the domain subject
  • Loading branch information
Gucan authored Dec 5, 2024
1 parent 5d6f1bd commit 23ef3f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dnsapi/dns_west_cn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dns_west_cn_rm() {
WEST_Username="${WEST_Username:-$(_readaccountconf_mutable WEST_Username)}"
WEST_Key="${WEST_Key:-$(_readaccountconf_mutable WEST_Key)}"

if ! _rest POST "domain/dns/" "act=dnsrec.list&username=$WEST_Username&apikey=$WEST_Key&domain=$fulldomain&hostname=$fulldomain&record_type=TXT"; then
if ! _rest POST "domain/dns/" "act=dnsrec.list&username=$WEST_Username&apikey=$WEST_Key&domain=${fulldomain#*.}&hostname=${fulldomain%%.*}&record_type=TXT"; then
_err "dnsrec.list error."
return 1
fi
Expand All @@ -56,7 +56,7 @@ dns_west_cn_rm() {
return 1
fi

if ! _rest POST "domain/dns/" "act=dnsrec.remove&username=$WEST_Username&apikey=$WEST_Key&domain=$fulldomain&hostname=$fulldomain&record_id=$record_id"; then
if ! _rest POST "domain/dns/" "act=dnsrec.remove&username=$WEST_Username&apikey=$WEST_Key&domain=${fulldomain#*.}&hostname=${fulldomain%%.*}&record_id=$record_id"; then
_err "dnsrec.remove error."
return 1
fi
Expand All @@ -72,7 +72,7 @@ add_record() {

_info "Adding record"

if ! _rest POST "domain/dns/" "act=dnsrec.add&username=$WEST_Username&apikey=$WEST_Key&domain=$fulldomain&hostname=$fulldomain&record_type=TXT&record_value=$txtvalue"; then
if ! _rest POST "domain/dns/" "act=dnsrec.add&username=$WEST_Username&apikey=$WEST_Key&domain=${fulldomain#*.}&hostname=${fulldomain%%.*}&record_type=TXT&record_value=$txtvalue"; then
return 1
fi

Expand Down

0 comments on commit 23ef3f7

Please sign in to comment.