mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-07 13:24:21 +00:00
feat(nodes): add Dev channel option to node panel updates
The node update confirm dialog now offers a 'Dev channel (latest commit)' choice. The dev flag threads master -> nodes/updatePanel -> UpdatePanels -> remote.UpdatePanel -> the node's updatePanel endpoint, which calls StartUpdateChannel(dev) to install the rolling dev-latest build. With no dev flag the node keeps following its own channel setting.
This commit is contained in:
@@ -637,7 +637,7 @@ type NodeUpdateResult struct {
|
||||
// UpdatePanels triggers the official self-updater on each given node. Only
|
||||
// enabled, online nodes are eligible — an offline node can't be reached, so it
|
||||
// is reported as skipped rather than silently dropped.
|
||||
func (s *NodeService) UpdatePanels(ids []int) ([]NodeUpdateResult, error) {
|
||||
func (s *NodeService) UpdatePanels(ids []int, dev bool) ([]NodeUpdateResult, error) {
|
||||
mgr := runtime.GetManager()
|
||||
if mgr == nil {
|
||||
return nil, fmt.Errorf("runtime manager unavailable")
|
||||
@@ -662,7 +662,7 @@ func (s *NodeService) UpdatePanels(ids []int) ([]NodeUpdateResult, error) {
|
||||
break
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
updErr := remote.UpdatePanel(ctx)
|
||||
updErr := remote.UpdatePanel(ctx, dev)
|
||||
cancel()
|
||||
if updErr != nil {
|
||||
res.Error = updErr.Error()
|
||||
|
||||
@@ -122,8 +122,19 @@ func getDevUpdateInfo() (*PanelUpdateInfo, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// StartUpdate starts the official updater outside of the current web request.
|
||||
// StartUpdate starts the official updater using this panel's own channel setting.
|
||||
func (s *PanelService) StartUpdate() error {
|
||||
return s.startUpdate(devChannelActive())
|
||||
}
|
||||
|
||||
// StartUpdateChannel runs the updater against an explicitly chosen channel,
|
||||
// overriding the local dev-channel setting. Used by the master node updater so
|
||||
// a node can be moved to the dev channel from the central panel.
|
||||
func (s *PanelService) StartUpdateChannel(dev bool) error {
|
||||
return s.startUpdate(dev)
|
||||
}
|
||||
|
||||
func (s *PanelService) startUpdate(useDev bool) error {
|
||||
if runtime.GOOS != "linux" {
|
||||
return fmt.Errorf("panel web update is supported only on Linux installations")
|
||||
}
|
||||
@@ -140,7 +151,7 @@ func (s *PanelService) StartUpdate() error {
|
||||
|
||||
mainFolder, serviceFolder := resolveUpdateFolders()
|
||||
updateTag := ""
|
||||
if devChannelActive() {
|
||||
if useDev {
|
||||
updateTag = devReleaseTag
|
||||
}
|
||||
updateScript := fmt.Sprintf("set -e; trap 'rm -f %s' EXIT; %s %s", shellQuote(scriptPath), shellQuote(bash), shellQuote(scriptPath))
|
||||
|
||||
Reference in New Issue
Block a user