mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-25 20:15:01 +03:00
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:
@@ -39,6 +39,24 @@ and emitting `node.up` / `node.down` events (see the
|
||||
those as read-only **transitive** sub-nodes (Node 1 → Node 2 → Node 3).
|
||||
</Callout>
|
||||
|
||||
### Restart a node
|
||||
|
||||
Open a directly configured node's action menu and choose **Restart Xray** or
|
||||
**Restart Panel**, then confirm the node name. Restart Xray interrupts that
|
||||
node's active Xray connections. Restart Panel restarts its panel and subscription
|
||||
services after a three-second delay; the success message acknowledges the request,
|
||||
and the node may be temporarily unavailable.
|
||||
|
||||
Restart actions are disabled for disabled nodes and read-only transitive nodes.
|
||||
An enabled node can be contacted even when its last heartbeat says offline.
|
||||
Connection and permission failures are reported without automatically retrying.
|
||||
|
||||
Xray restart supports the node's existing `node-sync`, `node-admin`, and `admin`
|
||||
API tokens. Panel restart requires `node-admin` or `admin`; mTLS connections must
|
||||
also present an explicit `node-admin` bearer token. Update older nodes before
|
||||
using `node-admin` for panel restart. The master-side node actions retain the
|
||||
normal Nodes API permissions.
|
||||
|
||||
### Mutual TLS (mTLS) between master and node
|
||||
|
||||
For the strongest trust, use `tlsVerifyMode = mtls` (requires `https`):
|
||||
|
||||
@@ -69,6 +69,20 @@ _openapi:
|
||||
- depth: 2
|
||||
title: Probe an existing node, updating its cached health state.
|
||||
url: '#probe-an-existing-node-updating-its-cached-health-state'
|
||||
- depth: 2
|
||||
title: Restart Xray on one enabled, directly configured node. Active Xray
|
||||
connections are interrupted. Uses the node runtime and accepts admin,
|
||||
node-admin or node-sync credentials on the node. A stale heartbeat does
|
||||
not prevent the request.
|
||||
url: '#restart-xray-on-one-enabled-directly-configured-node-active-xray-connections-are-interrupted-uses-the-node-runtime-and-accepts-admin-node-admin-or-node-sync-credentials-on-the-node-a-stale-heartbeat-does-not-prevent-the-request'
|
||||
- depth: 2
|
||||
title: Request a restart of the panel and subscription services on one enabled,
|
||||
directly configured node. Requires admin or node-admin credentials on
|
||||
the node; mTLS requires an explicit node-admin bearer token. Success
|
||||
acknowledges scheduling, before the three-second restart delay. A stale
|
||||
heartbeat does not prevent the request. Older nodes may reject
|
||||
node-admin access until upgraded.
|
||||
url: '#request-a-restart-of-the-panel-and-subscription-services-on-one-enabled-directly-configured-node-requires-admin-or-node-admin-credentials-on-the-node-mtls-requires-an-explicit-node-admin-bearer-token-success-acknowledges-scheduling-before-the-three-second-restart-delay-a-stale-heartbeat-does-not-prevent-the-request-older-nodes-may-reject-node-admin-access-until-upgraded'
|
||||
- depth: 2
|
||||
title: 'Trigger the official panel self-updater on each given node (downloads
|
||||
the latest release and restarts). Only enabled, online nodes are
|
||||
@@ -130,6 +144,18 @@ _openapi:
|
||||
id: use-unsaved-node-connection-details-to-list-the-remote-inbounds-available-for-selective-import
|
||||
- content: Probe an existing node, updating its cached health state.
|
||||
id: probe-an-existing-node-updating-its-cached-health-state
|
||||
- content: Restart Xray on one enabled, directly configured node. Active Xray
|
||||
connections are interrupted. Uses the node runtime and accepts admin,
|
||||
node-admin or node-sync credentials on the node. A stale heartbeat
|
||||
does not prevent the request.
|
||||
id: restart-xray-on-one-enabled-directly-configured-node-active-xray-connections-are-interrupted-uses-the-node-runtime-and-accepts-admin-node-admin-or-node-sync-credentials-on-the-node-a-stale-heartbeat-does-not-prevent-the-request
|
||||
- content: Request a restart of the panel and subscription services on one
|
||||
enabled, directly configured node. Requires admin or node-admin
|
||||
credentials on the node; mTLS requires an explicit node-admin bearer
|
||||
token. Success acknowledges scheduling, before the three-second
|
||||
restart delay. A stale heartbeat does not prevent the request. Older
|
||||
nodes may reject node-admin access until upgraded.
|
||||
id: request-a-restart-of-the-panel-and-subscription-services-on-one-enabled-directly-configured-node-requires-admin-or-node-admin-credentials-on-the-node-mtls-requires-an-explicit-node-admin-bearer-token-success-acknowledges-scheduling-before-the-three-second-restart-delay-a-stale-heartbeat-does-not-prevent-the-request-older-nodes-may-reject-node-admin-access-until-upgraded
|
||||
- content: 'Trigger the official panel self-updater on each given node (downloads
|
||||
the latest release and restarts). Only enabled, online nodes are
|
||||
updated; offline/disabled ones are reported as skipped. Set "dev":
|
||||
@@ -149,7 +175,7 @@ export default function Layout(props) {
|
||||
return (
|
||||
<>
|
||||
{props.children}
|
||||
<OpenAPIPage document="./public/openapi.json" webhooks={[]} operations={[{"path":"/panel/api/nodes/list","method":"get"},{"path":"/panel/api/nodes/mtls/ca","method":"post"},{"path":"/panel/api/nodes/mtls/trustCA","method":"post"},{"path":"/panel/api/nodes/mtls/reloadClient","method":"post"},{"path":"/panel/api/nodes/get/{id}","method":"get"},{"path":"/panel/api/nodes/webCert/{id}","method":"get"},{"path":"/panel/api/nodes/add","method":"post"},{"path":"/panel/api/nodes/update/{id}","method":"post"},{"path":"/panel/api/nodes/del/{id}","method":"post"},{"path":"/panel/api/nodes/setEnable/{id}","method":"post"},{"path":"/panel/api/nodes/test","method":"post"},{"path":"/panel/api/nodes/certFingerprint","method":"post"},{"path":"/panel/api/nodes/inbounds","method":"post"},{"path":"/panel/api/nodes/probe/{id}","method":"post"},{"path":"/panel/api/nodes/updatePanel","method":"post"},{"path":"/panel/api/nodes/history/{id}/{metric}/{bucket}","method":"get"}]} showTitle />
|
||||
<OpenAPIPage document="./public/openapi.json" webhooks={[]} operations={[{"path":"/panel/api/nodes/list","method":"get"},{"path":"/panel/api/nodes/mtls/ca","method":"post"},{"path":"/panel/api/nodes/mtls/trustCA","method":"post"},{"path":"/panel/api/nodes/mtls/reloadClient","method":"post"},{"path":"/panel/api/nodes/get/{id}","method":"get"},{"path":"/panel/api/nodes/webCert/{id}","method":"get"},{"path":"/panel/api/nodes/add","method":"post"},{"path":"/panel/api/nodes/update/{id}","method":"post"},{"path":"/panel/api/nodes/del/{id}","method":"post"},{"path":"/panel/api/nodes/setEnable/{id}","method":"post"},{"path":"/panel/api/nodes/test","method":"post"},{"path":"/panel/api/nodes/certFingerprint","method":"post"},{"path":"/panel/api/nodes/inbounds","method":"post"},{"path":"/panel/api/nodes/probe/{id}","method":"post"},{"path":"/panel/api/nodes/restartXray/{id}","method":"post"},{"path":"/panel/api/nodes/restartPanel/{id}","method":"post"},{"path":"/panel/api/nodes/updatePanel","method":"post"},{"path":"/panel/api/nodes/history/{id}/{metric}/{bucket}","method":"get"}]} showTitle />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -12252,6 +12252,88 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/panel/api/nodes/restartXray/{id}": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Nodes"
|
||||
],
|
||||
"summary": "Restart Xray on one enabled, directly configured node. Active Xray connections are interrupted. Uses the node runtime and accepts admin, node-admin or node-sync credentials on the node. A stale heartbeat does not prevent the request.",
|
||||
"operationId": "post_panel_api_nodes_restartXray_id",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "Node ID.",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"obj": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/panel/api/nodes/restartPanel/{id}": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Nodes"
|
||||
],
|
||||
"summary": "Request a restart of the panel and subscription services on one enabled, directly configured node. Requires admin or node-admin credentials on the node; mTLS requires an explicit node-admin bearer token. Success acknowledges scheduling, before the three-second restart delay. A stale heartbeat does not prevent the request. Older nodes may reject node-admin access until upgraded.",
|
||||
"operationId": "post_panel_api_nodes_restartPanel_id",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "Node ID.",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"obj": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/panel/api/nodes/updatePanel": {
|
||||
"post": {
|
||||
"tags": [
|
||||
|
||||
Reference in New Issue
Block a user