mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-12 14:21:01 +00:00
fix(update): restart panel after regenerating webBasePath to fix login desync
When update.sh regenerates a short webBasePath, it writes the new path to the database after the panel is already running with the old path loaded in memory. Without a restart the server keeps serving the old path while the UI shows the new one, making the new path unreachable.
This commit is contained in:
@@ -751,6 +751,8 @@ prompt_and_setup_ssl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_after_update() {
|
config_after_update() {
|
||||||
|
local panel_needs_restart=0
|
||||||
|
|
||||||
echo -e "${yellow}x-ui settings:${plain}"
|
echo -e "${yellow}x-ui settings:${plain}"
|
||||||
${xui_folder}/x-ui setting -show true
|
${xui_folder}/x-ui setting -show true
|
||||||
${xui_folder}/x-ui migrate
|
${xui_folder}/x-ui migrate
|
||||||
@@ -798,6 +800,7 @@ config_after_update() {
|
|||||||
local config_webBasePath=$(gen_random_string 18)
|
local config_webBasePath=$(gen_random_string 18)
|
||||||
${xui_folder}/x-ui setting -webBasePath "${config_webBasePath}"
|
${xui_folder}/x-ui setting -webBasePath "${config_webBasePath}"
|
||||||
existing_webBasePath="${config_webBasePath}"
|
existing_webBasePath="${config_webBasePath}"
|
||||||
|
panel_needs_restart=1
|
||||||
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -832,6 +835,11 @@ config_after_update() {
|
|||||||
echo -e "${green}Access URL: https://${cert_domain}:${existing_port}/${existing_webBasePath}${plain}"
|
echo -e "${green}Access URL: https://${cert_domain}:${existing_port}/${existing_webBasePath}${plain}"
|
||||||
echo -e "${green}═══════════════════════════════════════════${plain}"
|
echo -e "${green}═══════════════════════════════════════════${plain}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$panel_needs_restart" -eq 1 ]]; then
|
||||||
|
echo -e "${yellow}Restarting panel to apply the new web base path...${plain}"
|
||||||
|
systemctl restart x-ui 2> /dev/null || rc-service x-ui restart 2> /dev/null
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
update_x-ui() {
|
update_x-ui() {
|
||||||
|
|||||||
Reference in New Issue
Block a user