feat(nodes): add remote Xray and panel restart actions (#6970)

An operator running a master with sub-nodes could probe or update a node from the Nodes page but had to log in to the node, or SSH into it, to restart Xray or the panel (#6937).

Add Restart Xray and Restart panel to the node actions, behind a confirmation. Xray restarts through the node runtime; the panel restart is a new Remote call that the node accepts with node-admin credentials, the authority that already covers updatePanel. Both are refused for a disabled node.
This commit is contained in:
Hamed
2026-11-24 16:55:08 +03:30
committed by GitHub
parent a07ed97aa1
commit e409ed7244
40 changed files with 941 additions and 4 deletions
+3 -2
View File
@@ -49,7 +49,7 @@ func (a *APIController) checkAPIAuth(c *gin.Context) {
}
}
// Verified mTLS keeps its historical node-sync identity. Only an explicit
// node-admin bearer elevates it to software-update authority.
// node-admin bearer elevates it to panel-administration authority.
if c.Request.TLS != nil && len(c.Request.TLS.VerifiedChains) > 0 {
scope := model.ApiScopeNodeSync
if matchedScope == model.ApiScopeNodeAdmin {
@@ -127,7 +127,8 @@ var nodeSyncScopeAllow = map[string]map[string]struct{}{
}
var nodeAdminScopeAllow = map[string]map[string]struct{}{
"/server/updatePanel": {http.MethodPost: {}},
"/server/updatePanel": {http.MethodPost: {}},
"/setting/restartPanel": {http.MethodPost: {}},
}
func scopeAllows(allow map[string]map[string]struct{}, path, method string) bool {