ddns-scripts: fix parsing of parameters for cloudflare.com

Compatible with domain without the `@` symbol, consistent with the previous.

Fixes 8c55d089 ("ddns-scripts: fix parsing of parameters for cloudflare.com")

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
This commit is contained in:
Liangbin Lian
2025-06-04 17:22:03 +08:00
committed by Florian Eckert
parent f71550540e
commit 150d88585b
2 changed files with 11 additions and 7 deletions

View File

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

View File

@@ -30,12 +30,16 @@
local __HOST __DOMAIN __TYPE __URLBASE __PRGBASE __RUNPROG __DATA __IPV6 __ZONEID __RECID
local __URLBASE="https://api.cloudflare.com/client/v4"
# split __HOST __DOMAIN from $domain
# given data:
# @example.com for "domain record"
# host.sub@example.com for a "host record"
__HOST=$(printf %s "$domain" | cut -d@ -f1)
__DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
if echo "$domain" | grep -Fq '@'; then
# split __HOST __DOMAIN from $domain
# given data:
# @example.com for "domain record"
# host.sub@example.com for a "host record"
__HOST=$(printf %s "$domain" | cut -d@ -f1)
__DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
else
__DOMAIN=$domain
fi
# Cloudflare v4 needs:
# __DOMAIN = the base domain i.e. example.com