fix(update): keep Xray-core running until update downloads finish (#7002)

UpdateXray stopped the core before downloading, which also stopped the Panel Traffic Outbound bridge the download needed on servers that reach GitHub only through it, leaving every client offline. The new core is now downloaded, staged and checked with run -test against the current config while the old one serves; only the rename and restart swap it (Windows still stops first). update.sh gets the bridge as XUI_UPDATE_PROXY, installs x-ui.sh from the release archive, and fetches Alpine's x-ui.rc before stopping x-ui.
This commit is contained in:
Cheng Ho Ming, Eric
2026-11-02 22:17:01 +08:00
committed by GitHub
parent 4d583cebf3
commit 6d9e836d61
8 changed files with 422 additions and 97 deletions
+5
View File
@@ -250,6 +250,9 @@ func (s *PanelService) startUpdate(useDev bool) (int64, error) {
updateScript := fmt.Sprintf("set -e; trap 'rm -f %s' EXIT; %s %s", shellQuote(scriptPath), shellQuote(bash), shellQuote(scriptPath))
runIDEnv := "XUI_UPDATE_RUN_ID=" + strconv.FormatInt(runID, 10)
statusFileEnv := "XUI_UPDATE_STATUS_FILE=" + statusFile
// update.sh sends its curl downloads through the panel egress bridge. With socks5h the
// proxy resolves GitHub's hostnames, since this server's own DNS may be filtered.
egressEnv := "XUI_UPDATE_PROXY=" + strings.Replace((&service.SettingService{}).PanelEgressProxyURL(), "socks5://", "socks5h://", 1)
proxyEnv := updateProxyEnvVars()
if systemdRun, err := exec.LookPath("systemd-run"); err == nil {
@@ -261,6 +264,7 @@ func (s *PanelService) startUpdate(useDev bool) (int64, error) {
"--setenv", "XUI_UPDATE_TAG=" + updateTag,
"--setenv", runIDEnv,
"--setenv", statusFileEnv,
"--setenv", egressEnv,
}
for _, kv := range proxyEnv {
args = append(args, "--setenv", kv)
@@ -290,6 +294,7 @@ func (s *PanelService) startUpdate(useDev bool) (int64, error) {
"XUI_UPDATE_TAG="+updateTag,
runIDEnv,
statusFileEnv,
egressEnv,
)
setDetachedProcess(cmd)
if err := cmd.Start(); err != nil {