mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-22 21:21:42 +00:00
Remove local keyword.
This commit is contained in:
parent
8494ac8f3d
commit
ef7b51beb7
@ -6,15 +6,15 @@
|
|||||||
# Values to export:
|
# Values to export:
|
||||||
# export PDD_Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
# export PDD_Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
# Sometimes cloudflare / google doesn't pick new dns recods fast enough.
|
# Sometimes cloudflare / google doesn't pick new dns records fast enough.
|
||||||
# You can add --dnssleep XX to params as workaround.
|
# You can add --dnssleep XX to params as workaround.
|
||||||
|
|
||||||
######## Public functions #####################
|
######## Public functions #####################
|
||||||
|
|
||||||
#Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
#Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
||||||
dns_yandex_add() {
|
dns_yandex_add() {
|
||||||
local fulldomain="${1}"
|
fulldomain="${1}"
|
||||||
local txtvalue="${2}"
|
txtvalue="${2}"
|
||||||
_debug "Calling: dns_yandex_add() '${fulldomain}' '$txtvalue'"
|
_debug "Calling: dns_yandex_add() '${fulldomain}' '$txtvalue'"
|
||||||
|
|
||||||
_PDD_credentials || return 1
|
_PDD_credentials || return 1
|
||||||
@ -30,9 +30,9 @@ dns_yandex_add() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local data="domain=${domain}&type=TXT&subdomain=${subdomain}&ttl=300&content=${txtvalue}"
|
data="domain=${domain}&type=TXT&subdomain=${subdomain}&ttl=300&content=${txtvalue}"
|
||||||
local uri="https://pddimp.yandex.ru/api2/admin/dns/add"
|
uri="https://pddimp.yandex.ru/api2/admin/dns/add"
|
||||||
local result="$(_post "${data}" "${uri}" | _normalizeJson)"
|
result="$(_post "${data}" "${uri}" | _normalizeJson)"
|
||||||
_debug "Result: $result"
|
_debug "Result: $result"
|
||||||
|
|
||||||
if ! _contains "$result" '"success":"ok"'; then
|
if ! _contains "$result" '"success":"ok"'; then
|
||||||
@ -43,7 +43,7 @@ dns_yandex_add() {
|
|||||||
|
|
||||||
#Usage: dns_myapi_rm _acme-challenge.www.domain.com
|
#Usage: dns_myapi_rm _acme-challenge.www.domain.com
|
||||||
dns_yandex_rm() {
|
dns_yandex_rm() {
|
||||||
local fulldomain="${1}"
|
fulldomain="${1}"
|
||||||
_debug "Calling: dns_yandex_rm() '${fulldomain}'"
|
_debug "Calling: dns_yandex_rm() '${fulldomain}'"
|
||||||
|
|
||||||
_PDD_credentials || return 1
|
_PDD_credentials || return 1
|
||||||
@ -55,9 +55,9 @@ dns_yandex_rm() {
|
|||||||
_debug "Record_ids: $record_ids"
|
_debug "Record_ids: $record_ids"
|
||||||
|
|
||||||
for record_id in $record_ids; do
|
for record_id in $record_ids; do
|
||||||
local data="domain=${domain}&record_id=${record_id}"
|
data="domain=${domain}&record_id=${record_id}"
|
||||||
local uri="https://pddimp.yandex.ru/api2/admin/dns/del"
|
uri="https://pddimp.yandex.ru/api2/admin/dns/del"
|
||||||
local result="$(_post "${data}" "${uri}" | _normalizeJson)"
|
result="$(_post "${data}" "${uri}" | _normalizeJson)"
|
||||||
_debug "Result: $result"
|
_debug "Result: $result"
|
||||||
|
|
||||||
if ! _contains "$result" '"success":"ok"'; then
|
if ! _contains "$result" '"success":"ok"'; then
|
||||||
@ -69,21 +69,21 @@ dns_yandex_rm() {
|
|||||||
#################### Private functions below ##################################
|
#################### Private functions below ##################################
|
||||||
|
|
||||||
_PDD_get_domain() {
|
_PDD_get_domain() {
|
||||||
local fulldomain=${1}
|
fulldomain=${1}
|
||||||
|
|
||||||
local subdomain_start=1
|
subdomain_start=1
|
||||||
while true; do
|
while true; do
|
||||||
local domain_start=$(_math $subdomain_start + 1)
|
domain_start=$(_math $subdomain_start + 1)
|
||||||
domain=$(echo "$fulldomain" | cut -d . -f $domain_start-)
|
domain=$(echo "$fulldomain" | cut -d . -f "$domain_start"-)
|
||||||
subdomain=$(echo "$fulldomain" | cut -d . -f -$subdomain_start)
|
subdomain=$(echo "$fulldomain" | cut -d . -f -"$subdomain_start")
|
||||||
|
|
||||||
_debug "Checking domain $domain"
|
_debug "Checking domain $domain"
|
||||||
if [ -z "$domain" ]; then
|
if [ -z "$domain" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local uri="https://pddimp.yandex.ru/api2/admin/dns/list?domain=$domain"
|
uri="https://pddimp.yandex.ru/api2/admin/dns/list?domain=$domain"
|
||||||
local result="$(_get "${uri}" | _normalizeJson)"
|
result="$(_get "${uri}" | _normalizeJson)"
|
||||||
_debug "Result: $result"
|
_debug "Result: $result"
|
||||||
|
|
||||||
if _contains "$result" '"success":"ok"'; then
|
if _contains "$result" '"success":"ok"'; then
|
||||||
@ -106,13 +106,13 @@ _PDD_credentials() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_PDD_get_record_ids() {
|
_PDD_get_record_ids() {
|
||||||
local domain="${1}"
|
domain="${1}"
|
||||||
local subdomain="${2}"
|
subdomain="${2}"
|
||||||
|
|
||||||
_debug "Check existing records for $subdomain"
|
_debug "Check existing records for $subdomain"
|
||||||
|
|
||||||
local uri="https://pddimp.yandex.ru/api2/admin/dns/list?domain=${domain}"
|
uri="https://pddimp.yandex.ru/api2/admin/dns/list?domain=${domain}"
|
||||||
local result="$(_get "${uri}" | _normalizeJson)"
|
result="$(_get "${uri}" | _normalizeJson)"
|
||||||
_debug "Result: $result"
|
_debug "Result: $result"
|
||||||
|
|
||||||
if ! _contains "$result" '"success":"ok"'; then
|
if ! _contains "$result" '"success":"ok"'; then
|
||||||
|
Loading…
Reference in New Issue
Block a user