Browse Source

refactor(ali): set API endpoint for each action

pull/5294/head
PMExtra 3 months ago
parent
commit
610bb2b85c
  1. 6
      deploy/ali_cdn.sh
  2. 8
      dnsapi/dns_ali.sh

6
deploy/ali_cdn.sh

@ -1,4 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# shellcheck disable=SC2034,SC2154
# Script to create certificate to Alibaba Cloud CDN # Script to create certificate to Alibaba Cloud CDN
# #
@ -23,8 +24,7 @@ if ! . "$dnsapi_ali"; then
return 1 return 1
fi fi
# shellcheck disable=SC2034
Ali_API="https://cdn.aliyuncs.com/"
Ali_CDN_API="https://cdn.aliyuncs.com/"
ali_cdn_deploy() { ali_cdn_deploy() {
_cdomain="$1" _cdomain="$1"
@ -66,9 +66,9 @@ ali_cdn_deploy() {
return 0 return 0
} }
# shellcheck disable=SC2154
# domain pub pri # domain pub pri
_set_cdn_domain_ssl_certificate_query() { _set_cdn_domain_ssl_certificate_query() {
endpoint=$Ali_CDN_API
query='' query=''
query=$query'AccessKeyId='$Ali_Key query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=SetCdnDomainSSLCertificate' query=$query'&Action=SetCdnDomainSSLCertificate'

8
dnsapi/dns_ali.sh

@ -14,7 +14,7 @@ Options:
# https://github.com/acmesh-official/acme.sh/pull/5205#issuecomment-2357867276 # https://github.com/acmesh-official/acme.sh/pull/5205#issuecomment-2357867276
# Be careful when modifying this file, especially when making breaking changes for common functions # Be careful when modifying this file, especially when making breaking changes for common functions
Ali_API="https://alidns.aliyuncs.com/"
Ali_DNS_API="https://alidns.aliyuncs.com/"
#Usage: dns_ali_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" #Usage: dns_ali_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_ali_add() { dns_ali_add() {
@ -71,7 +71,7 @@ _ali_rest() {
signature=$(printf "%s" "$mtd&%2F&$(printf "%s" "$query" | _url_encode upper-hex)" | _hmac "sha1" "$(printf "%s" "$Ali_Secret&" | _hex_dump | tr -d " ")" | _base64) signature=$(printf "%s" "$mtd&%2F&$(printf "%s" "$query" | _url_encode upper-hex)" | _hmac "sha1" "$(printf "%s" "$Ali_Secret&" | _hex_dump | tr -d " ")" | _base64)
signature=$(printf "%s" "$signature" | _url_encode upper-hex) signature=$(printf "%s" "$signature" | _url_encode upper-hex)
url="$Ali_API?Signature=$signature"
url="$endpoint?Signature=$signature"
if [ "$mtd" = "GET" ]; then if [ "$mtd" = "GET" ]; then
url="$url&$query" url="$url&$query"
@ -140,6 +140,7 @@ _get_root() {
_check_exist_query() { _check_exist_query() {
_qdomain="$1" _qdomain="$1"
_qsubdomain="$2" _qsubdomain="$2"
endpoint=$Ali_DNS_API
query='' query=''
query=$query'AccessKeyId='$Ali_Key query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=DescribeDomainRecords' query=$query'&Action=DescribeDomainRecords'
@ -155,6 +156,7 @@ _check_exist_query() {
} }
_add_record_query() { _add_record_query() {
endpoint=$Ali_DNS_API
query='' query=''
query=$query'AccessKeyId='$Ali_Key query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=AddDomainRecord' query=$query'&Action=AddDomainRecord'
@ -171,6 +173,7 @@ _add_record_query() {
} }
_delete_record_query() { _delete_record_query() {
endpoint=$Ali_DNS_API
query='' query=''
query=$query'AccessKeyId='$Ali_Key query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=DeleteDomainRecord' query=$query'&Action=DeleteDomainRecord'
@ -184,6 +187,7 @@ _delete_record_query() {
} }
_describe_records_query() { _describe_records_query() {
endpoint=$Ali_DNS_API
query='' query=''
query=$query'AccessKeyId='$Ali_Key query=$query'AccessKeyId='$Ali_Key
query=$query'&Action=DescribeDomainRecords' query=$query'&Action=DescribeDomainRecords'

Loading…
Cancel
Save