Browse Source

Update dns_wts.sh

Fully integrated new WTS-API for updating dns-records.
pull/6373/head
LukasWRN 6 months ago
committed by GitHub
parent
commit
1483ecb69f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      dnsapi/dns_wts.sh

7
dnsapi/dns_wts.sh

@ -13,6 +13,8 @@ WTS_API="https://wts-api.de/hosting/domain"
######## Public functions ###################### ######## Public functions ######################
TMP_RecordID=0 # Temporary Id of the creazed record will be safed here.
#Usage: dns_wts_add _acme-challenge.domain.waerner-techservices.de "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" #Usage: dns_wts_add _acme-challenge.domain.waerner-techservices.de "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_wts_add() { dns_wts_add() {
fulldomain=$1 fulldomain=$1
@ -41,7 +43,8 @@ dns_wts_add() {
_sub_domain="$(echo "$_sub_domain" | _lower_case)" _sub_domain="$(echo "$_sub_domain" | _lower_case)"
# Now add the TXT record # Now add the TXT record
_info "Trying to add 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" "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." _info "TXT record has been successfully added."
return 0 return 0
else else
@ -78,7 +81,7 @@ dns_wts_rm() {
_sub_domain="$(echo "$_sub_domain" | _lower_case)" _sub_domain="$(echo "$_sub_domain" | _lower_case)"
# Now delete the TXT record # Now delete the TXT record
_info "Trying to delete TXT record" _info "Trying to delete TXT record"
if _WTS_rest "DELETE" "del_record=$_domain&praefix=$_sub_domain&type=TXT&content=$txtvalue"; then
if _WTS_rest "DELETE" "/$_domain/records/remove/$TMP_RecordID?WTS-API-Token=$WTS_API_Token"; then
_info "TXT record has been successfully deleted." _info "TXT record has been successfully deleted."
return 0 return 0
else else

Loading…
Cancel
Save