From f459849452a9fc182024c5ab4c9a3cd0d8e6bda4 Mon Sep 17 00:00:00 2001 From: LukasWRN <127308232+LukasWRN@users.noreply.github.com> Date: Mon, 26 May 2025 12:56:54 +0200 Subject: [PATCH] Update dns_wts.sh --- dnsapi/dns_wts.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dnsapi/dns_wts.sh b/dnsapi/dns_wts.sh index fd10332d..5ee5fe75 100644 --- a/dnsapi/dns_wts.sh +++ b/dnsapi/dns_wts.sh @@ -5,7 +5,7 @@ Site: Waerner-TechServices.de Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_wts Options: WTS_API_Token API Token -Issues: github.com/acmesh-official/acme.sh/issues/4419 +Issues: github.com/acmesh-official/acme.sh/issues/6372 Author: Lukas Wärner (CEO) ' @@ -41,17 +41,20 @@ dns_wts_add() { # convert to lower case _domain="$(echo "$_domain" | _lower_case)" _sub_domain="$(echo "$_sub_domain" | _lower_case)" + # Now add the TXT record _info "Trying to add TXT record" - # if _WTS_rest "POST" "add_record=$_domain&praefix=$_sub_domain&type=TXT&content=$txtvalue"; then if _WTS_rest "POST" "/$_domain/records/add/txt/$_sub_domain/$txtvalue?WTS-API-Token=$WTS_API_Token"; then _info "TXT record has been successfully added." + TMP_RecordID="$(echo "$_response" | _egrep_o '"record_id"[[:space:]]*:[[:space:]]*"[^"]+"' | cut -d ':' -f2 | tr -d ' "')" + _debug "Saved TMP_RecordID=$TMP_RecordID" return 0 else _err "Errors happened during adding the TXT record, response=$_response" return 1 fi + } #Usage: fulldomain txtvalue @@ -85,8 +88,12 @@ dns_wts_rm() { _info "TXT record has been successfully deleted." return 0 else - _err "Errors happened during deleting the TXT record, response=$_response" - return 1 + if $WTS_API_Token == 0: + _err "Errors happened during deleting the TXT record, because the temporary record-id from creation is not set." + return 1 + else: + _err "Errors happened during deleting the TXT record, response=$_response" + return 1 fi }