Skip to content

Commit

Permalink
Access URL - SSL exist
Browse files Browse the repository at this point in the history
  • Loading branch information
MHSanaei committed Nov 12, 2024
1 parent b7d1c84 commit c0ef53e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion x-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c0ef53e

Please sign in to comment.