mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2026-10-21 13:31:18 +00:00
Handle DNSimple API response for nonexistent subdomain (#7324)
* handle OAuth response * revert comment removal * handle lowercased domain value * expand error detection logic for all non-expected responses * shell-independent lowercasing * revert; domain value already lowercased * add missing double-quotes * use zone records endpoint fallback when zone cannot be identified * add logic missing from previous --------- Co-authored-by: neil <github@neilpang.com> Co-authored-by: Mashiro <adadam@qq.com> Co-authored-by: MBWhitestone <25477219+MBWhitestone@users.noreply.github.com> Co-authored-by: Pablo <Pablo1@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 file changed
+10
-5
+10
-5
@@ -15,7 +15,7 @@ DNSimple_API="https://api.dnsimple.com/v2"
|
||||
|
||||
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
||||
dns_dnsimple_add() {
|
||||
fulldomain=$1
|
||||
fulldomain=$(echo "$1" | _lower_case)
|
||||
txtvalue=$2
|
||||
|
||||
DNSimple_OAUTH_TOKEN="${DNSimple_OAUTH_TOKEN:-$(_readaccountconf_mutable DNSimple_OAUTH_TOKEN)}"
|
||||
@@ -56,7 +56,7 @@ dns_dnsimple_add() {
|
||||
|
||||
# fulldomain
|
||||
dns_dnsimple_rm() {
|
||||
fulldomain=$1
|
||||
fulldomain=$(echo "$1" | _lower_case)
|
||||
|
||||
DNSimple_OAUTH_TOKEN="${DNSimple_OAUTH_TOKEN:-$(_readaccountconf_mutable DNSimple_OAUTH_TOKEN)}"
|
||||
if [ -z "$DNSimple_OAUTH_TOKEN" ]; then
|
||||
@@ -110,9 +110,13 @@ _get_root() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if _contains "$response" 'not found'; then
|
||||
_debug "$h not found"
|
||||
else
|
||||
if ! _contains "$response" "\"name\":\"$h\""; then
|
||||
if ! _dnsimple_rest GET "$_account_id/zones/$h/records?per_page=1"; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if _contains "$response" "\"name\":\"$h\"" || _contains "$response" '"pagination":'; then
|
||||
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$previous")
|
||||
_domain="$h"
|
||||
|
||||
@@ -121,6 +125,7 @@ _get_root() {
|
||||
|
||||
return 0
|
||||
fi
|
||||
_debug "$h not found"
|
||||
|
||||
previous="$i"
|
||||
i=$(_math "$i" + 1)
|
||||
|
||||