Browse Source

Merge pull request #17535 from hgl/ddns-cloudflare

ddns-scripts-cloudflare: allow explicit zone_id
lilik-openwrt-22.03
Florian Eckert 2 years ago
committed by GitHub
parent
commit
9c12900aee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions
  1. +1
    -1
      net/ddns-scripts/Makefile
  2. +14
    -10
      net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh

+ 1
- 1
net/ddns-scripts/Makefile View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-scripts
PKG_VERSION:=2.8.2
PKG_RELEASE:=20
PKG_RELEASE:=21
PKG_LICENSE:=GPL-2.0


+ 14
- 10
net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh View File

@ -15,7 +15,7 @@
# option password - cloudflare api key, you can get it from cloudflare.com/my-account/
# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
#
# The proxy status would not be changed by this script. Please change it in Cloudflare dashboard manually.
# The proxy status would not be changed by this script. Please change it in Cloudflare dashboard manually.
#
# variable __IP already defined with the ip-address to use for update
#
@ -134,15 +134,19 @@ else
fi
__PRGBASE="$__PRGBASE --header 'Content-Type: application/json' "
# read zone id for registered domain.TLD
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones?name=$__DOMAIN'"
cloudflare_transfer || return 1
# extract zone id
__ZONEID=$(grep -o '"id":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
[ -z "$__ZONEID" ] && {
write_log 4 "Could not detect 'zone id' for domain.tld: '$__DOMAIN'"
return 127
}
if [ -n "$zone_id"]; then
__ZONEID="$zone_id"
else
# read zone id for registered domain.TLD
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones?name=$__DOMAIN'"
cloudflare_transfer || return 1
# extract zone id
__ZONEID=$(grep -o '"id":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
[ -z "$__ZONEID" ] && {
write_log 4 "Could not detect 'zone id' for domain.tld: '$__DOMAIN'"
return 127
}
fi
# read record id for A or AAAA record of host.domain.TLD
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones/$__ZONEID/dns_records?name=$__HOST&type=$__TYPE'"


Loading…
Cancel
Save