CZECHIA-COM
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
8 additions and
10 deletions
-
dnsapi/dns_czechia.sh
|
|
|
@ -85,26 +85,24 @@ _czechia_load_conf() { |
|
|
|
_czechia_pick_zone() { |
|
|
|
_fd_input="$1" |
|
|
|
_debug "Vstupni domena: $_fd_input" |
|
|
|
_debug "Dostupne zony: $CZ_Zones" |
|
|
|
_debug "Dostupne zony: $CZ_Zones" |
|
|
|
_fd=$(echo "$_fd_input" | _lower_case | sed 's/\.$//') |
|
|
|
_best_zone="" |
|
|
|
|
|
|
|
# Replace comma with space using sed (Docker safe) |
|
|
|
_zones_space=$(printf "%s" "$CZ_Zones" | sed 's/,/ /g') |
|
|
|
|
|
|
|
for _z in $_zones_space; do |
|
|
|
# Remove spaces and trailing dot, then lowercase - NO 'tr' used here |
|
|
|
_clean_z=$(echo "$_z" | _lower_case | sed 's/ //g; s/\.$//') |
|
|
|
[ -z "$_clean_z" ] && continue |
|
|
|
|
|
|
|
case "$_fd" in |
|
|
|
"$_clean_z" | *".$_clean_z") |
|
|
|
# Compare length using native shell ${#var} - Docker/BusyBox safe |
|
|
|
if [ ${#_clean_z} -gt ${#_best_zone} ]; then |
|
|
|
_best_zone="$_clean_z" |
|
|
|
fi |
|
|
|
;; |
|
|
|
"$_clean_z" | *".$_clean_z") |
|
|
|
if [ ${#_clean_z} -gt ${#_best_zone} ]; then |
|
|
|
_best_zone="$_clean_z" |
|
|
|
fi |
|
|
|
;; |
|
|
|
esac |
|
|
|
done |
|
|
|
done # <--- TADY TI TO CHYBĚLO (před printf) |
|
|
|
|
|
|
|
[ -n "$_best_zone" ] && printf "%s" "$_best_zone" |
|
|
|
} |