diff options
| author | Wyatt <ww275@sussex.ac.uk> | 2025-12-28 18:38:26 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-28 18:38:26 +0300 |
| commit | 260eedf8c417458b22bb17224035985a213bf3cc (patch) | |
| tree | 998e228af27058c556774048fa26c868e30b28c1 /x-ui.sh | |
| parent | 69ccdba734226ad6c1b8853d545bf8c8b462bdd6 (diff) | |
fix: add missing is_domain helper function to x-ui.sh (#3612)
The is_domain function was being called in ssl_cert_issue() but was never
defined in x-ui.sh, causing 'Invalid domain format' errors for valid domains.
Added is_ipv4, is_ipv6, is_ip, and is_domain helper functions to match
the definitions in install.sh and update.sh.
Co-authored-by: wyatt <wyatt@Wyatts-MacBook-Air.local>
Diffstat (limited to 'x-ui.sh')
| -rw-r--r-- | x-ui.sh | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -19,6 +19,20 @@ function LOGI() { echo -e "${green}[INF] $* ${plain}" } +# Simple helpers for domain/IP validation +is_ipv4() { + [[ "$1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] && return 0 || return 1 +} +is_ipv6() { + [[ "$1" =~ : ]] && return 0 || return 1 +} +is_ip() { + is_ipv4 "$1" || is_ipv6 "$1" +} +is_domain() { + [[ "$1" =~ ^([A-Za-z0-9](-*[A-Za-z0-9])*\.)+[A-Za-z]{2,}$ ]] && return 0 || return 1 +} + # check root [[ $EUID -ne 0 ]] && LOGE "ERROR: You must be root to run this script! \n" && exit 1 |
