mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2026-08-28 12:40:42 +00:00
fix: rage4 - add error 400 and TXT cleanup
The following error happens if the header is set
to 'Content-Type: application/json':
{"statusCode":400,"message":"One or more errors occurred!",
"errors":{"serializerErrors":["The input does not contain
any JSON tokens. Expected the input to start with a valid
JSON token, when isFinalBlock is true. LineNumber:
0 | BytePositionInLine: 0."]}}
Fix TXT removal
This commit is contained in:
parent
65868ab8a7
commit
2beb2f5659
1 changed files with 15 additions and 3 deletions
|
|
@ -42,6 +42,14 @@ dns_rage4_add() {
|
|||
_debug _domain_id "$_domain_id"
|
||||
|
||||
_rage4_rest "createrecord/?id=$_domain_id&name=$fulldomain&content=$unquotedtxtvalue&type=TXT&active=true&ttl=1"
|
||||
|
||||
# Response after adding a TXT record should be something like this:
|
||||
# {"status":true,"id":28160443,"error":null}
|
||||
if ! _contains "$response" '"error":null' >/dev/null; then
|
||||
_err "Error while adding TXT record: '$response'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +71,12 @@ dns_rage4_rm() {
|
|||
_debug "Getting txt records"
|
||||
_rage4_rest "getrecords/?id=${_domain_id}"
|
||||
|
||||
_record_id=$(echo "$response" | sed -rn 's/.*"id":([[:digit:]]+)[^\}]*'"$txtvalue"'.*/\1/p')
|
||||
_record_id=$(echo "$response" | tr '{' '\n' | grep '"TXT"' | grep "\"$txtvalue" | sed -rn 's/.*"id":([[:digit:]]+),.*/\1/p')
|
||||
if [ -z "$_record_id" ]; then
|
||||
_err "error retrieving the record_id of the new TXT record in order to delete it, got: '$_record_id'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
_rage4_rest "deleterecord/?id=${_record_id}"
|
||||
return 0
|
||||
}
|
||||
|
|
@ -105,8 +118,7 @@ _rage4_rest() {
|
|||
token_trimmed=$(echo "$RAGE4_TOKEN" | tr -d '"')
|
||||
auth=$(printf '%s:%s' "$username_trimmed" "$token_trimmed" | _base64)
|
||||
|
||||
export _H1="Content-Type: application/json"
|
||||
export _H2="Authorization: Basic $auth"
|
||||
export _H1="Authorization: Basic $auth"
|
||||
|
||||
response="$(_get "$RAGE4_Api$ep")"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue