diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-11-12 14:25:16 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-11-12 15:09:23 +0300 |
| commit | c0ef53e5423ffdfbd051fe06b39ed03ad2c74f1c (patch) | |
| tree | 422821d0badc8650e7bc92ee3d9fadccc53528cd /x-ui.sh | |
| parent | b7d1c84cd0f226a0f3c70e841d5b90ef92425378 (diff) | |
Access URL - SSL exist
Diffstat (limited to 'x-ui.sh')
| -rw-r--r-- | x-ui.sh | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -309,9 +309,20 @@ check_config() { local existing_webBasePath=$(echo "$info" | grep -Eo 'webBasePath: .+' | awk '{print $2}') local existing_port=$(echo "$info" | grep -Eo 'port: .+' | awk '{print $2}') + local existing_cert=$(/usr/local/x-ui/x-ui setting -getCert true | grep -Eo 'cert: .+' | awk '{print $2}') local server_ip=$(curl -s https://api.ipify.org) - echo -e "${green}Access URL: http://${server_ip}:${existing_port}${existing_webBasePath}${plain}" + if [[ -n "$existing_cert" ]]; then + local domain=$(basename "$(dirname "$existing_cert")") + + if [[ "$domain" =~ ^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]]; then + echo -e "${green}Access URL: https://${domain}:${existing_port}${existing_webBasePath}${plain}" + else + echo -e "${green}Access URL: https://${server_ip}:${existing_port}${existing_webBasePath}${plain}" + fi + else + echo -e "${green}Access URL: http://${server_ip}:${existing_port}${existing_webBasePath}${plain}" + fi } set_port() { |
