Browse Source

fix whitespaces

pull/2682/head
Qvinti 6 years ago
parent
commit
53a1d8ea08
  1. 20
      dnsapi/dns_hostingUkraine.sh

20
dnsapi/dns_hostingUkraine.sh

@ -1,6 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Will be called by acme.sh to add the txt record to https://www.ukraine.com.ua/ api. # Will be called by acme.sh to add the txt record to https://www.ukraine.com.ua/ api.
# Usage: ./acme.sh --issue -d yourdomain.com [-d '*.yourdomain.com'] --dns dns_hostingUkraine
# API endpoint. # API endpoint.
HostingUkraine_Api="https://adm.tools/api.php" HostingUkraine_Api="https://adm.tools/api.php"
# Author: Qvinti <qvinti.com@gmail.com> # Author: Qvinti <qvinti.com@gmail.com>
@ -16,9 +17,9 @@ dns_hostingUkraine_add() {
fulldomain=$1 fulldomain=$1
subdomain=$(echo $fulldomain | sed -e "s/\.$_domain//") subdomain=$(echo $fulldomain | sed -e "s/\.$_domain//")
txtvalue=$2 txtvalue=$2
_hostingUkraine_init _hostingUkraine_init
_info "Adding txt record. ($fulldomain)" _info "Adding txt record. ($fulldomain)"
_hostingUkraine_rest POST "dns_record" "create" "\"domain\":\"$_domain\",\"subdomain\":\"$subdomain\",\"type\":\"TXT\",\"data\":\"$txtvalue\"" _hostingUkraine_rest POST "dns_record" "create" "\"domain\":\"$_domain\",\"subdomain\":\"$subdomain\",\"type\":\"TXT\",\"data\":\"$txtvalue\""
if _contains "$response" "\"status\":\"error\""; then if _contains "$response" "\"status\":\"error\""; then
@ -33,22 +34,22 @@ dns_hostingUkraine_add() {
dns_hostingUkraine_rm() { dns_hostingUkraine_rm() {
fulldomain=$1 fulldomain=$1
txtvalue=$2 txtvalue=$2
_hostingUkraine_init _hostingUkraine_init
_debug "Getting txt records" _debug "Getting txt records"
_hostingUkraine_rest POST "dns_record" "info" "\"domain\":\"$_domain\"" _hostingUkraine_rest POST "dns_record" "info" "\"domain\":\"$_domain\""
if _contains "$response" "\"status\":\"error\""; then if _contains "$response" "\"status\":\"error\""; then
_err "Get domain records, Failure! ($_domain)" _err "Get domain records, Failure! ($_domain)"
return 1 return 1
fi fi
id=$(echo "$response" | _egrep_o "[^{]+${txtvalue}[^}]+" | _egrep_o "id\":[^\,]+" | cut -c5-) id=$(echo "$response" | _egrep_o "[^{]+${txtvalue}[^}]+" | _egrep_o "id\":[^\,]+" | cut -c5-)
if [ -z "$id" ]; then if [ -z "$id" ]; then
_err "Empty TXT records! ($fulldomain: $txtvalue)" _err "Empty TXT records! ($fulldomain: $txtvalue)"
return 1 return 1
fi fi
_hostingUkraine_rest POST "dns_record" "delete" "\"domain\":\"$_domain\",\"stack\":[$id]" _hostingUkraine_rest POST "dns_record" "delete" "\"domain\":\"$_domain\",\"stack\":[$id]"
if _contains "$response" "\"status\":\"error\""; then if _contains "$response" "\"status\":\"error\""; then
_err "Remove txt record, Failure! ($fulldomain: $id)" _err "Remove txt record, Failure! ($fulldomain: $id)"
@ -92,9 +93,10 @@ _get_root() {
_hostingUkraine_init() { _hostingUkraine_init() {
HostingUkraine_Login="${HostingUkraine_Login:-$(_readaccountconf_mutable HostingUkraine_Login)}" HostingUkraine_Login="${HostingUkraine_Login:-$(_readaccountconf_mutable HostingUkraine_Login)}"
HostingUkraine_Token="${HostingUkraine_Token:-$(_readaccountconf_mutable HostingUkraine_Token)}" HostingUkraine_Token="${HostingUkraine_Token:-$(_readaccountconf_mutable HostingUkraine_Token)}"
if [ -z "$HostingUkraine_Login" ] || [ -z "$HostingUkraine_Token" ]; then if [ -z "$HostingUkraine_Login" ] || [ -z "$HostingUkraine_Token" ]; then
HostingUkraine_Login="" HostingUkraine_Login=""
HostingUkraine_Token=""
_err "You didn't specify a Hosting Ukraine account or token yet." _err "You didn't specify a Hosting Ukraine account or token yet."
_err "Please create the account and token and try again. Info: https://api.adm.tools/osnovnie-polozheniya/dostup-k-api/" _err "Please create the account and token and try again. Info: https://api.adm.tools/osnovnie-polozheniya/dostup-k-api/"
return 1 return 1
@ -102,12 +104,12 @@ _hostingUkraine_init() {
_saveaccountconf_mutable HostingUkraine_Login "$HostingUkraine_Login" _saveaccountconf_mutable HostingUkraine_Login "$HostingUkraine_Login"
_saveaccountconf_mutable HostingUkraine_Token "$HostingUkraine_Token" _saveaccountconf_mutable HostingUkraine_Token "$HostingUkraine_Token"
_debug "First detect the root zone" _debug "First detect the root zone"
if ! _get_root "$_domain"; then if ! _get_root "$_domain"; then
return 1 return 1
fi fi
_debug _sub_domain "$_sub_domain" _debug _sub_domain "$_sub_domain"
_debug _domain "$_domain" _debug _domain "$_domain"
} }
Loading…
Cancel
Save