fix: skip xray setup if already running to preserve existing panels

This commit is contained in:
SamNet-dev
2026-02-06 17:12:48 -06:00
parent 4eb099030d
commit d1dd506b9c

View File

@@ -1460,6 +1460,12 @@ setup_xray_for_gfk() {
local target_port
target_port=$(echo "${GFK_PORT_MAPPINGS:-14000:443}" | cut -d: -f2 | cut -d, -f1)
# If xray is already running (e.g. user has a panel), don't touch it
if pgrep -x xray &>/dev/null; then
log_info "Xray is already running — skipping install/config to preserve existing setup"
return 0
fi
install_xray || return 1
configure_xray_socks "$target_port" || return 1
start_xray || return 1
@@ -5715,6 +5721,10 @@ start_xray() {
setup_xray_for_gfk() {
local target_port
target_port=$(echo "${GFK_PORT_MAPPINGS:-14000:443}" | cut -d: -f2 | cut -d, -f1)
if pgrep -x xray &>/dev/null; then
log_info "Xray is already running — skipping install/config to preserve existing setup"
return 0
fi
install_xray || return 1
configure_xray_socks "$target_port" || return 1
start_xray || return 1