|
|
@@ -2062,11 +2062,15 @@ SSH_port_forwarding() {
|
|
|
)
|
|
|
local server_ip=""
|
|
|
for ip_address in "${URL_lists[@]}"; do
|
|
|
- server_ip=$(curl -s --max-time 3 "${ip_address}" 2>/dev/null | tr -d '[:space:]')
|
|
|
- if [[ -n "${server_ip}" ]]; then
|
|
|
+ local response=$(curl -s -w "\n%{http_code}" --max-time 3 "${ip_address}" 2>/dev/null)
|
|
|
+ local http_code=$(echo "$response" | tail -n1)
|
|
|
+ local ip_result=$(echo "$response" | head -n-1 | tr -d '[:space:]')
|
|
|
+ if [[ "${http_code}" == "200" && -n "${ip_result}" ]]; then
|
|
|
+ server_ip="${ip_result}"
|
|
|
break
|
|
|
fi
|
|
|
done
|
|
|
+
|
|
|
local existing_webBasePath=$(${xui_folder}/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
|
|
local existing_port=$(${xui_folder}/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
|
|
local existing_listenIP=$(${xui_folder}/x-ui setting -getListen true | grep -Eo 'listenIP: .+' | awk '{print $2}')
|