mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-25 03:54:47 +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": [
|
||||
|
||||
@@ -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": [
|
||||
|
||||
@@ -83,12 +83,29 @@ export function useNodeMutations() {
|
||||
},
|
||||
});
|
||||
|
||||
const restartMut = useMutation({
|
||||
mutationFn: ({ id, target }: { id: number; target: 'xray' | 'panel' }) =>
|
||||
HttpUtil.post(
|
||||
`/panel/api/nodes/${target === 'xray' ? 'restartXray' : 'restartPanel'}/${id}`,
|
||||
undefined,
|
||||
{
|
||||
silent: true,
|
||||
timeout: 12000,
|
||||
},
|
||||
),
|
||||
retry: false,
|
||||
onSuccess: (msg) => {
|
||||
if (msg?.success) queryClient.invalidateQueries({ queryKey: keys.nodes.root() });
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
create: (payload: Partial<NodeRecord>) => createMut.mutateAsync(payload),
|
||||
update: (id: number, payload: Partial<NodeRecord>) => updateMut.mutateAsync({ id, payload }),
|
||||
remove: (id: number) => removeMut.mutateAsync(id),
|
||||
setEnable: (id: number, enable: boolean) => setEnableMut.mutateAsync({ id, enable }),
|
||||
probe: (id: number) => probeMut.mutateAsync(id),
|
||||
restart: (id: number, target: 'xray' | 'panel') => restartMut.mutateAsync({ id, target }),
|
||||
updatePanels: (ids: number[], dev: boolean): Promise<Msg<NodeUpdateResult[]>> =>
|
||||
updatePanelsMut.mutateAsync({ ids, dev }),
|
||||
testConnection: async (payload: Partial<NodeRecord>): Promise<Msg<ProbeResult>> => {
|
||||
|
||||
@@ -1853,6 +1853,20 @@ export const sections: readonly Section[] = [
|
||||
summary: 'Probe an existing node, updating its cached health state.',
|
||||
params: [{ name: 'id', in: 'path', type: 'number', desc: 'Node ID.' }],
|
||||
},
|
||||
{
|
||||
method: 'POST',
|
||||
path: '/panel/api/nodes/restartXray/:id',
|
||||
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.',
|
||||
params: [{ name: 'id', in: 'path', type: 'number', desc: 'Node ID.' }],
|
||||
},
|
||||
{
|
||||
method: 'POST',
|
||||
path: '/panel/api/nodes/restartPanel/:id',
|
||||
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.',
|
||||
params: [{ name: 'id', in: 'path', type: 'number', desc: 'Node ID.' }],
|
||||
},
|
||||
{
|
||||
method: 'POST',
|
||||
path: '/panel/api/nodes/updatePanel',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Badge, Button, Card, Dropdown, Modal, Space, Switch, Table, Tag, Tooltip } from 'antd';
|
||||
import type { BadgeProps } from 'antd';
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
InfoCircleOutlined,
|
||||
MoreOutlined,
|
||||
PlusOutlined,
|
||||
ReloadOutlined,
|
||||
RightOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
TeamOutlined,
|
||||
@@ -42,8 +43,12 @@ interface NodeListProps {
|
||||
onToggleEnable: (node: NodeRecord, next: boolean) => void;
|
||||
onUpdateNode: (node: NodeRecord) => void;
|
||||
onUpdateSelected: () => void;
|
||||
onRestart: (node: NodeRecord, target: 'xray' | 'panel') => void;
|
||||
restartingIds?: ReadonlySet<number>;
|
||||
}
|
||||
|
||||
const noRestarts: ReadonlySet<number> = new Set();
|
||||
|
||||
function isUpdateEligible(n: NodeRecord): boolean {
|
||||
return !!n.enable && n.status === 'online';
|
||||
}
|
||||
@@ -187,6 +192,8 @@ export default function NodeList({
|
||||
onToggleEnable,
|
||||
onUpdateNode,
|
||||
onUpdateSelected,
|
||||
onRestart,
|
||||
restartingIds = noRestarts,
|
||||
}: NodeListProps) {
|
||||
const { t } = useTranslation();
|
||||
const relativeTime = useRelativeTime();
|
||||
@@ -195,6 +202,18 @@ export default function NodeList({
|
||||
const [statsNode, setStatsNode] = useState<NodeRow | null>(null);
|
||||
const [expandedIds, setExpandedIds] = useState<Set<number>>(new Set());
|
||||
|
||||
const restartItems = useCallback(
|
||||
(node: NodeRecord) =>
|
||||
(['xray', 'panel'] as const).map((target) => ({
|
||||
key: `restart-${target}`,
|
||||
icon: <ReloadOutlined aria-hidden />,
|
||||
label: t(`pages.nodes.${target === 'xray' ? 'restartXray' : 'restartPanel'}`),
|
||||
disabled: !node.enable || !!node.transitive || restartingIds.has(node.id),
|
||||
onClick: () => onRestart(node, target),
|
||||
})),
|
||||
[t, onRestart, restartingIds],
|
||||
);
|
||||
|
||||
// Map a direct node's GUID to its display name so a transitive sub-node can show
|
||||
// which parent it is reached through (#4983); the master walks one level only.
|
||||
const nameByGuid = useMemo(() => {
|
||||
@@ -299,6 +318,14 @@ export default function NodeList({
|
||||
onClick={() => onEdit(record)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Dropdown trigger={['click']} menu={{ items: restartItems(record) }}>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
icon={<MoreOutlined aria-hidden />}
|
||||
aria-label={t('more')}
|
||||
/>
|
||||
</Dropdown>
|
||||
<Tooltip title={t('delete')}>
|
||||
<Button
|
||||
type="text"
|
||||
@@ -543,6 +570,7 @@ export default function NodeList({
|
||||
onEdit,
|
||||
onDelete,
|
||||
onUpdateNode,
|
||||
restartItems,
|
||||
nameByGuid,
|
||||
],
|
||||
);
|
||||
@@ -673,6 +701,7 @@ export default function NodeList({
|
||||
placement="bottomRight"
|
||||
menu={{
|
||||
items: [
|
||||
...restartItems(record),
|
||||
{
|
||||
key: 'probe',
|
||||
label: (
|
||||
|
||||
@@ -88,6 +88,7 @@ export default function NodesPage() {
|
||||
fetchInbounds,
|
||||
probe,
|
||||
updatePanels,
|
||||
restart,
|
||||
} = useNodeMutations();
|
||||
|
||||
const { data: latestVersion = '' } = useQuery({
|
||||
@@ -103,6 +104,8 @@ export default function NodesPage() {
|
||||
const [formMode, setFormMode] = useState<'add' | 'edit'>('add');
|
||||
const [formNode, setFormNode] = useState<NodeRecord | null>(null);
|
||||
const [selectedIds, setSelectedIds] = useState<number[]>([]);
|
||||
const [restartingIds, setRestartingIds] = useState<ReadonlySet<number>>(new Set());
|
||||
const restartLocks = useRef(new Set<number>());
|
||||
const [mtlsOpen, setMtlsOpen] = useState(false);
|
||||
const [trustCa, setTrustCa] = useState('');
|
||||
const [copyingCa, setCopyingCa] = useState(false);
|
||||
@@ -199,6 +202,52 @@ export default function NodesPage() {
|
||||
[probe, t, messageApi, refetch],
|
||||
);
|
||||
|
||||
const onRestart = useCallback(
|
||||
(node: NodeRecord, target: 'xray' | 'panel') => {
|
||||
if (!node.enable || node.transitive || node.id <= 0 || restartLocks.current.has(node.id))
|
||||
return;
|
||||
restartLocks.current.add(node.id);
|
||||
const action = target === 'xray' ? 'restartXray' : 'restartPanel';
|
||||
let started = false;
|
||||
modal.confirm({
|
||||
title: t('pages.nodes.restartConfirmTitle', { name: node.name || String(node.id) }),
|
||||
content: t(`pages.nodes.${action}Content`),
|
||||
okText: t(`pages.nodes.${action}`),
|
||||
cancelText: t('cancel'),
|
||||
onCancel: () => {
|
||||
restartLocks.current.delete(node.id);
|
||||
},
|
||||
onOk: async () => {
|
||||
if (started) return;
|
||||
started = true;
|
||||
setRestartingIds((ids) => new Set(ids).add(node.id));
|
||||
try {
|
||||
const msg = await restart(node.id, target);
|
||||
if (msg?.success) {
|
||||
messageApi.success(
|
||||
t(
|
||||
`pages.nodes.toasts.${target === 'xray' ? 'xrayRestarted' : 'panelRestartAccepted'}`,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
messageApi.error(msg?.msg || t('somethingWentWrong'));
|
||||
}
|
||||
} catch (error) {
|
||||
messageApi.error(error instanceof Error ? error.message : t('somethingWentWrong'));
|
||||
} finally {
|
||||
restartLocks.current.delete(node.id);
|
||||
setRestartingIds((ids) => {
|
||||
const next = new Set(ids);
|
||||
next.delete(node.id);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
[modal, t, restart, messageApi],
|
||||
);
|
||||
|
||||
const onToggleEnable = useCallback(
|
||||
async (node: NodeRecord, next: boolean) => {
|
||||
await setEnable(node.id, next);
|
||||
@@ -373,6 +422,8 @@ export default function NodesPage() {
|
||||
onToggleEnable={onToggleEnable}
|
||||
onUpdateNode={onUpdateNode}
|
||||
onUpdateSelected={onUpdateSelected}
|
||||
onRestart={onRestart}
|
||||
restartingIds={restartingIds}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -33,6 +33,7 @@ function renderList(isMobile: boolean) {
|
||||
onToggleEnable={noop}
|
||||
onUpdateNode={noop}
|
||||
onUpdateSelected={noop}
|
||||
onRestart={noop}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ describe('NodeList re-render', () => {
|
||||
onToggleEnable: noop,
|
||||
onUpdateNode: noop,
|
||||
onUpdateSelected: noop,
|
||||
onRestart: noop,
|
||||
};
|
||||
const view = render(<NodeList {...props} />, { wrapper });
|
||||
expect(updateChecks.count).toBeGreaterThan(0);
|
||||
|
||||
@@ -35,6 +35,7 @@ describe('NodeList desktop table row keys', () => {
|
||||
onToggleEnable={noop}
|
||||
onUpdateNode={noop}
|
||||
onUpdateSelected={noop}
|
||||
onRestart={noop}
|
||||
/>,
|
||||
);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ function renderSubNode(fields: Partial<NodeRecord>) {
|
||||
onToggleEnable={noop}
|
||||
onUpdateNode={noop}
|
||||
onUpdateSelected={noop}
|
||||
onRestart={noop}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ describe('node metric availability', () => {
|
||||
onToggleEnable={noop}
|
||||
onUpdateNode={noop}
|
||||
onUpdateSelected={noop}
|
||||
onRestart={noop}
|
||||
/>,
|
||||
);
|
||||
if (isMobile) fireEvent.click(screen.getByRole('button', { name: 'More Information' }));
|
||||
@@ -63,6 +64,7 @@ describe('node metric availability', () => {
|
||||
onToggleEnable={noop}
|
||||
onUpdateNode={noop}
|
||||
onUpdateSelected={noop}
|
||||
onRestart={noop}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText('0.0%')).not.toBeNull();
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
import { ConfigProvider } from 'antd';
|
||||
import { fireEvent, screen, waitFor, within } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import NodesPage from '@/pages/nodes/NodesPage';
|
||||
import { HttpUtil, Msg } from '@/utils';
|
||||
import type { NodeRecord } from '@/schemas/node';
|
||||
import { renderWithProviders } from './test-utils';
|
||||
|
||||
const state = vi.hoisted(() => ({
|
||||
isMobile: false,
|
||||
nodes: [] as NodeRecord[],
|
||||
refetch: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/hooks/useMediaQuery', () => ({ useMediaQuery: () => ({ isMobile: state.isMobile }) }));
|
||||
vi.mock('@/api/queries/useNodesQuery', () => ({
|
||||
useNodesQuery: () => ({
|
||||
nodes: state.nodes,
|
||||
loading: false,
|
||||
fetched: true,
|
||||
fetchError: '',
|
||||
refetch: state.refetch,
|
||||
totals: {
|
||||
total: state.nodes.length,
|
||||
online: 0,
|
||||
offline: 1,
|
||||
avgLatency: 0,
|
||||
inbounds: 0,
|
||||
clients: 0,
|
||||
onlineClients: 0,
|
||||
depleted: 0,
|
||||
},
|
||||
}),
|
||||
}));
|
||||
vi.mock('@/pages/nodes/NodeFormModal', () => ({ default: () => null }));
|
||||
vi.mock('@/pages/nodes/NodeHistoryPanel', () => ({ default: () => null }));
|
||||
vi.mock('@/layouts/AppSidebar', () => ({ default: () => null }));
|
||||
|
||||
beforeEach(() => {
|
||||
state.isMobile = false;
|
||||
state.nodes = [{ id: 7, name: 'edge-seven', guid: 'seven', enable: true, status: 'offline' }];
|
||||
vi.spyOn(HttpUtil, 'get').mockResolvedValue(new Msg(true, '', {}));
|
||||
});
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
async function openRestart(label: string) {
|
||||
fireEvent.click(screen.getByRole('button', { name: /^more$/i }));
|
||||
fireEvent.click(await screen.findByRole('menuitem', { name: label }));
|
||||
return screen.findByRole('dialog');
|
||||
}
|
||||
|
||||
describe('remote node restart', () => {
|
||||
it.each([false, true])(
|
||||
'confirms each action and sends only the selected request (mobile=%s)',
|
||||
async (mobile) => {
|
||||
state.isMobile = mobile;
|
||||
const post = vi
|
||||
.spyOn(HttpUtil, 'post')
|
||||
.mockResolvedValue({ success: true, msg: '', obj: null });
|
||||
renderWithProviders(
|
||||
<ConfigProvider theme={{ token: { motion: false } }}>
|
||||
<NodesPage />
|
||||
</ConfigProvider>,
|
||||
);
|
||||
let dialog = await openRestart('Restart Xray');
|
||||
expect(dialog.textContent).toContain('edge-seven');
|
||||
expect(post).not.toHaveBeenCalled();
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
|
||||
|
||||
await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
|
||||
expect(post).not.toHaveBeenCalled();
|
||||
for (const [label, action, success] of [
|
||||
['Restart Xray', 'restartXray', 'Xray restarted on the node.'],
|
||||
[
|
||||
'Restart Panel',
|
||||
'restartPanel',
|
||||
'Panel restart request accepted. The node may be temporarily unavailable.',
|
||||
],
|
||||
]) {
|
||||
dialog = await openRestart(label);
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: label }));
|
||||
await screen.findByText(success);
|
||||
expect(post.mock.calls.at(-1)?.[0]).toBe(`/panel/api/nodes/${action}/7`);
|
||||
|
||||
await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
|
||||
}
|
||||
expect(post).toHaveBeenCalledTimes(2);
|
||||
},
|
||||
);
|
||||
|
||||
it('keeps both actions disabled while the request is pending and reports a node rejection without retrying', async () => {
|
||||
let finish!: (msg: Msg<never>) => void;
|
||||
const post = vi.spyOn(HttpUtil, 'post').mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
finish = resolve;
|
||||
}),
|
||||
);
|
||||
renderWithProviders(
|
||||
<ConfigProvider theme={{ token: { motion: false } }}>
|
||||
<NodesPage />
|
||||
</ConfigProvider>,
|
||||
);
|
||||
const dialog = await openRestart('Restart Panel');
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: 'Restart Panel' }));
|
||||
await waitFor(() => expect(post).toHaveBeenCalledTimes(1));
|
||||
fireEvent.click(screen.getByRole('button', { name: /^more$/i }));
|
||||
for (const name of ['Restart Xray', 'Restart Panel']) {
|
||||
expect((await screen.findByRole('menuitem', { name })).getAttribute('aria-disabled')).toBe(
|
||||
'true',
|
||||
);
|
||||
}
|
||||
finish({ success: false, msg: 'remote permission denied', obj: null });
|
||||
await screen.findByText('remote permission denied');
|
||||
expect(post).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it.each([false, true])(
|
||||
'does not offer restart for transitive nodes and disables it for disabled nodes (mobile=%s)',
|
||||
async (mobile) => {
|
||||
state.isMobile = mobile;
|
||||
state.nodes = [
|
||||
{ id: 0, name: 'child', guid: 'child', transitive: true, enable: true, status: 'online' },
|
||||
];
|
||||
const view = renderWithProviders(
|
||||
<ConfigProvider theme={{ token: { motion: false } }}>
|
||||
<NodesPage />
|
||||
</ConfigProvider>,
|
||||
);
|
||||
expect(screen.queryByRole('button', { name: /^more$/i })).toBeNull();
|
||||
view.unmount();
|
||||
state.nodes = [{ id: 7, name: 'disabled', enable: false }];
|
||||
renderWithProviders(
|
||||
<ConfigProvider theme={{ token: { motion: false } }}>
|
||||
<NodesPage />
|
||||
</ConfigProvider>,
|
||||
);
|
||||
fireEvent.click(screen.getByRole('button', { name: /^more$/i }));
|
||||
for (const name of ['Restart Xray', 'Restart Panel']) {
|
||||
expect((await screen.findByRole('menuitem', { name })).getAttribute('aria-disabled')).toBe(
|
||||
'true',
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
package nodee2e
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNodePanelRestartPreservesNodeAndMaster(t *testing.T) {
|
||||
bin := panelBinary(t)
|
||||
master := newPanel(t, bin, "restart-master")
|
||||
node := newPanel(t, bin, "restart-node")
|
||||
linkToken := node.mintToken("restart-link", "node-admin")
|
||||
master.start()
|
||||
node.start()
|
||||
port := freePort(t)
|
||||
node.call(http.MethodPost, "/panel/api/inbounds/add", vlessInbound("survives-restart", port, nil))
|
||||
var target struct {
|
||||
Id int `json:"id"`
|
||||
}
|
||||
obj := master.call(http.MethodPost, "/panel/api/nodes/add", map[string]any{
|
||||
"name": "restart-target", "scheme": "http", "address": "127.0.0.1", "port": node.port,
|
||||
"basePath": "/", "apiToken": linkToken, "enable": true, "allowPrivateAddress": true,
|
||||
})
|
||||
if err := json.Unmarshal(obj, &target); err != nil || target.Id <= 0 {
|
||||
t.Fatalf("node enrollment = %s: %v", obj, err)
|
||||
}
|
||||
master.call(http.MethodPost, fmt.Sprintf("/panel/api/nodes/restartPanel/%d", target.Id), nil)
|
||||
eventually(t, settleTimeout, "the selected node completes its panel restart", func() (bool, string) {
|
||||
log, err := os.ReadFile(filepath.Join(node.dir, "stdout.log"))
|
||||
if err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
if !strings.Contains(string(log), "Sub server restarted successfully.") {
|
||||
return false, "node restart not completed"
|
||||
}
|
||||
env, err := node.try(http.MethodGet, "/panel/api/server/status", nil)
|
||||
return err == nil && env.Success, fmt.Sprintf("status=%v error=%v", env, err)
|
||||
})
|
||||
if ib, ok := node.inboundOnPort(port); !ok || ib.Remark != "survives-restart" {
|
||||
t.Fatalf("node inbound after restart = %+v, found=%v", ib, ok)
|
||||
}
|
||||
master.call(http.MethodGet, "/panel/api/server/status", nil)
|
||||
log, err := os.ReadFile(filepath.Join(master.dir, "stdout.log"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if strings.Contains(string(log), "Web server restarted successfully.") {
|
||||
t.Fatal("restarting the node also restarted the master")
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -41,6 +41,8 @@ func (a *NodeController) initRouter(g *gin.RouterGroup) {
|
||||
g.POST("/inbounds", a.inbounds)
|
||||
g.POST("/probe/:id", a.probe)
|
||||
g.POST("/updatePanel", a.updatePanel)
|
||||
g.POST("/restartXray/:id", a.restartXray)
|
||||
g.POST("/restartPanel/:id", a.restartPanel)
|
||||
g.GET("/history/:id/:metric/:bucket", a.history)
|
||||
g.POST("/mtls/ca", a.mtlsCa)
|
||||
g.POST("/mtls/trustCA", a.setMtlsTrustCA)
|
||||
@@ -349,6 +351,34 @@ func (a *NodeController) updatePanel(c *gin.Context) {
|
||||
jsonMsgObj(c, I18nWeb(c, "pages.nodes.toasts.updateStarted"), results, err)
|
||||
}
|
||||
|
||||
func (a *NodeController) restartXray(c *gin.Context) {
|
||||
id, err := strconv.Atoi(c.Param("id"))
|
||||
if err != nil || id <= 0 {
|
||||
jsonMsg(c, I18nWeb(c, "pages.nodes.restartXray"), fmt.Errorf("invalid node ID"))
|
||||
return
|
||||
}
|
||||
err = a.nodeService.RestartXray(c.Request.Context(), id)
|
||||
if err != nil {
|
||||
jsonMsg(c, I18nWeb(c, "pages.nodes.restartXray"), err)
|
||||
return
|
||||
}
|
||||
jsonMsg(c, I18nWeb(c, "pages.nodes.toasts.xrayRestarted"), nil)
|
||||
}
|
||||
|
||||
func (a *NodeController) restartPanel(c *gin.Context) {
|
||||
id, err := strconv.Atoi(c.Param("id"))
|
||||
if err != nil || id <= 0 {
|
||||
jsonMsg(c, I18nWeb(c, "pages.nodes.restartPanel"), fmt.Errorf("invalid node ID"))
|
||||
return
|
||||
}
|
||||
err = a.nodeService.RestartPanel(c.Request.Context(), id)
|
||||
if err != nil {
|
||||
jsonMsg(c, I18nWeb(c, "pages.nodes.restartPanel"), err)
|
||||
return
|
||||
}
|
||||
jsonMsg(c, I18nWeb(c, "pages.nodes.toasts.panelRestartAccepted"), nil)
|
||||
}
|
||||
|
||||
func (a *NodeController) history(c *gin.Context) {
|
||||
id, err := strconv.Atoi(c.Param("id"))
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/util/crypto"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/global"
|
||||
)
|
||||
|
||||
func TestPanelRestartScopeAndDelayedHook(t *testing.T) {
|
||||
engine, auth := newAPIAuthTestEngine(t)
|
||||
NewSettingController(engine.Group("/panel/api", auth.checkAPIAuth, auth.enforceTokenScope))
|
||||
restarts := make(chan time.Time, 1)
|
||||
global.SetRestartHook(func() { restarts <- time.Now() })
|
||||
t.Cleanup(func() { global.SetRestartHook(func() {}) })
|
||||
for _, scope := range []string{model.ApiScopeAdmin, model.ApiScopeNodeAdmin, model.ApiScopeNodeSync, model.ApiScopeMonitor} {
|
||||
if err := database.GetDB().Create(&model.ApiToken{Name: scope, Token: crypto.HashTokenSHA256(scope), Enabled: true, Scope: scope}).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, mtls := range []bool{false, true} {
|
||||
t.Run(scope+map[bool]string{false: "/bearer", true: "/mtls"}[mtls], func(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodPost, "/panel/api/setting/restartPanel", nil)
|
||||
req.Header.Set("Authorization", "Bearer "+scope)
|
||||
if mtls {
|
||||
req.TLS = &tls.ConnectionState{VerifiedChains: [][]*x509.Certificate{{{}}}}
|
||||
}
|
||||
w := httptest.NewRecorder()
|
||||
start := time.Now()
|
||||
engine.ServeHTTP(w, req)
|
||||
allowed := scope == model.ApiScopeNodeAdmin || (scope == model.ApiScopeAdmin && !mtls)
|
||||
if !allowed {
|
||||
want := `{"msg":"this API token is not permitted to access this endpoint","success":false}`
|
||||
if w.Code != http.StatusForbidden || w.Body.String() != want {
|
||||
t.Fatalf("denied = %d %s", w.Code, w.Body.String())
|
||||
}
|
||||
return
|
||||
}
|
||||
var result struct {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &result); err != nil || !result.Success || w.Code != http.StatusOK {
|
||||
t.Fatalf("accepted = %d %s: %v", w.Code, w.Body.String(), err)
|
||||
}
|
||||
select {
|
||||
case <-restarts:
|
||||
t.Fatal("panel restarted before response was delivered")
|
||||
default:
|
||||
}
|
||||
select {
|
||||
case at := <-restarts:
|
||||
if at.Sub(start) < 3*time.Second {
|
||||
t.Fatalf("restart delay = %s, want >=3s", at.Sub(start))
|
||||
}
|
||||
case <-time.After(6 * time.Second):
|
||||
t.Fatal("accepted request did not restart panel")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/util/crypto"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/runtime"
|
||||
)
|
||||
|
||||
func TestNodeRestartTargetsOnlySelectedNode(t *testing.T) {
|
||||
for _, action := range []struct{ name, remotePath string }{
|
||||
{"restartXray", "/custom/panel/api/server/restartXrayService"},
|
||||
{"restartPanel", "/custom/panel/api/setting/restartPanel"},
|
||||
} {
|
||||
t.Run(action.name, func(t *testing.T) {
|
||||
engine, auth := newAPIAuthTestEngine(t)
|
||||
group := engine.Group("/panel/api/nodes", auth.checkAPIAuth, auth.enforceTokenScope)
|
||||
NewNodeController(group)
|
||||
if err := database.GetDB().Create(&model.ApiToken{Name: "master", Token: crypto.HashTokenSHA256("master"), Enabled: true, Scope: model.ApiScopeAdmin}).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
previous := runtime.GetManager()
|
||||
runtime.SetManager(runtime.NewManager(runtime.LocalDeps{}))
|
||||
t.Cleanup(func() { runtime.SetManager(previous) })
|
||||
var calls atomic.Int32
|
||||
var response atomic.Value
|
||||
response.Store(`{"success":true,"msg":"accepted","obj":null}`)
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
calls.Add(1)
|
||||
if r.URL.Path != action.remotePath || r.Method != http.MethodPost || r.Header.Get("Authorization") != "Bearer node-secret" {
|
||||
t.Errorf("remote request = %s %s auth=%q", r.Method, r.URL.Path, r.Header.Get("Authorization"))
|
||||
}
|
||||
fmt.Fprint(w, response.Load().(string))
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
u, _ := url.Parse(server.URL)
|
||||
port, _ := strconv.Atoi(u.Port())
|
||||
node := model.Node{Name: "selected", Scheme: "http", Address: u.Hostname(), Port: port, BasePath: "/custom/", ApiToken: "node-secret", Enable: true, Status: "offline", AllowPrivateAddress: true}
|
||||
if err := database.GetDB().Create(&node).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
other := node
|
||||
other.Id = 0
|
||||
other.Name = "untouched"
|
||||
other.Port = 1
|
||||
if err := database.GetDB().Create(&other).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
request := func(id string, ctx context.Context) (bool, string) {
|
||||
t.Helper()
|
||||
r := httptest.NewRequest(http.MethodPost, "/panel/api/nodes/"+action.name+"/"+id, nil).WithContext(ctx)
|
||||
r.Header.Set("Authorization", "Bearer master")
|
||||
w := httptest.NewRecorder()
|
||||
engine.ServeHTTP(w, r)
|
||||
var result struct {
|
||||
Success bool `json:"success"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &result); err != nil {
|
||||
t.Fatalf("decode response: status=%d body=%q: %v", w.Code, w.Body.String(), err)
|
||||
}
|
||||
return result.Success, result.Msg
|
||||
}
|
||||
id := strconv.Itoa(node.Id)
|
||||
if ok, msg := request(id, context.Background()); !ok || calls.Load() != 1 {
|
||||
t.Fatalf("restart = %v %q, remote calls=%d, want success and one call", ok, msg, calls.Load())
|
||||
}
|
||||
response.Store(`{"success":false,"msg":"maintenance lock","obj":null}`)
|
||||
if ok, msg := request(id, context.Background()); ok || !strings.Contains(msg, "maintenance lock") {
|
||||
t.Fatalf("node rejection = %v %q", ok, msg)
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
if ok, msg := request(id, ctx); ok || !strings.Contains(msg, "context canceled") {
|
||||
t.Fatalf("canceled restart = %v %q", ok, msg)
|
||||
}
|
||||
deadlineCtx, deadlineCancel := context.WithDeadline(context.Background(), time.Now().Add(-time.Second))
|
||||
defer deadlineCancel()
|
||||
if ok, msg := request(id, deadlineCtx); ok || !strings.Contains(msg, "context deadline exceeded") {
|
||||
t.Fatalf("expired restart = %v %q", ok, msg)
|
||||
}
|
||||
before := calls.Load()
|
||||
if err := database.GetDB().Model(&node).Update("enable", false).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, bad := range []struct{ id, message string }{{id, "node is disabled"}, {"0", "invalid node ID"}, {"-1", "invalid node ID"}, {"abc", "invalid node ID"}, {"999999", "node not found"}} {
|
||||
if ok, msg := request(bad.id, context.Background()); ok || !strings.Contains(msg, bad.message) {
|
||||
t.Fatalf("restart %s = %v %q, want %q", bad.id, ok, msg, bad.message)
|
||||
}
|
||||
}
|
||||
if calls.Load() != before {
|
||||
t.Fatalf("invalid requests reached node: calls %d -> %d", before, calls.Load())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@@ -173,6 +174,9 @@ func TestMasterNodeContract(t *testing.T) {
|
||||
node := startContractNode(t)
|
||||
master := node.masterWithToken(t, scope)
|
||||
ctx := context.Background()
|
||||
restarts := make(chan struct{}, 1)
|
||||
global.SetRestartHook(func() { restarts <- struct{}{} })
|
||||
t.Cleanup(func() { global.SetRestartHook(func() {}) })
|
||||
|
||||
cells := []struct {
|
||||
name string
|
||||
@@ -311,6 +315,36 @@ func TestMasterNodeContract(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
}, nil},
|
||||
{"RestartPanel respects enrollment authority and schedules a restart", []string{"RestartPanel"}, func() error {
|
||||
err := master.RestartPanel(ctx)
|
||||
if scope == model.ApiScopeNodeSync {
|
||||
if err == nil {
|
||||
return fmt.Errorf("node-sync unexpectedly restarted the panel")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "HTTP 403") {
|
||||
return fmt.Errorf("node-sync restart should return HTTP 403: %w", err)
|
||||
}
|
||||
refused := node.takeRefused()
|
||||
if len(refused) != 1 || refused[0] != "POST /panel/api/setting/restartPanel -> 403" {
|
||||
return fmt.Errorf("refused requests = %v", refused)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
select {
|
||||
case <-restarts:
|
||||
return fmt.Errorf("panel restarted before the response")
|
||||
default:
|
||||
}
|
||||
select {
|
||||
case <-restarts:
|
||||
return nil
|
||||
case <-time.After(6 * time.Second):
|
||||
return fmt.Errorf("panel restart was not scheduled")
|
||||
}
|
||||
}, nil},
|
||||
{"DeleteUser detaches the client from the inbound", []string{"DeleteUser"}, func() error {
|
||||
return master.DeleteUser(ctx, masterInbound("updated", false), "c3")
|
||||
}, func(t *testing.T) {
|
||||
|
||||
@@ -760,6 +760,11 @@ func (r *Remote) RestartXray(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *Remote) RestartPanel(ctx context.Context) error {
|
||||
_, err := r.do(ctx, http.MethodPost, "panel/api/setting/restartPanel", nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePanel asks the node to run its own official self-updater (update.sh)
|
||||
// and restart onto the latest release. The node returns as soon as the job is
|
||||
// launched; the new version surfaces on the next heartbeat. When dev is true the
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (s *NodeService) restartTarget(id int) (*model.Node, *runtime.Manager, error) {
|
||||
if id <= 0 {
|
||||
return nil, nil, fmt.Errorf("invalid node ID")
|
||||
}
|
||||
node, err := s.GetById(id)
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, nil, fmt.Errorf("node not found")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if !node.Enable {
|
||||
return nil, nil, fmt.Errorf("node is disabled")
|
||||
}
|
||||
mgr := runtime.GetManager()
|
||||
if mgr == nil {
|
||||
return nil, nil, fmt.Errorf("runtime manager unavailable")
|
||||
}
|
||||
return node, mgr, nil
|
||||
}
|
||||
|
||||
func (s *NodeService) RestartXray(ctx context.Context, id int) error {
|
||||
node, mgr, err := s.restartTarget(id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rt, err := mgr.RuntimeFor(&node.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
|
||||
defer cancel()
|
||||
return rt.RestartXray(ctx)
|
||||
}
|
||||
|
||||
func (s *NodeService) RestartPanel(ctx context.Context, id int) error {
|
||||
node, mgr, err := s.restartTarget(id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
remote, err := mgr.RemoteFor(node)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
|
||||
defer cancel()
|
||||
return remote.RestartPanel(ctx)
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/dbtest"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/load"
|
||||
)
|
||||
|
||||
// A box with no IPv6 route spends 3s per lookup service, and a status sample
|
||||
@@ -289,6 +291,8 @@ func TestPublicIPRefreshIsSingleFlightAndKeepsCachedReadsAvailable(t *testing.T)
|
||||
}
|
||||
|
||||
func TestPublicIPStatusUsesRefreshedAddressWithoutBlocking(t *testing.T) {
|
||||
// Windows starts a process-wide sampler; it must outlive the virtual clock.
|
||||
_, _ = load.Avg()
|
||||
dbDir := t.TempDir()
|
||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||
dbtest.InitDB(t, filepath.Join(dbDir, "x-ui.db"))
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "تمت إزالة {count} عميل من {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "إعادة تشغيل Xray",
|
||||
"restartPanel": "إعادة تشغيل اللوحة",
|
||||
"restartConfirmTitle": "إعادة تشغيل {name}؟",
|
||||
"restartXrayContent": "سيتم قطع اتصالات Xray النشطة على هذه العقدة.",
|
||||
"restartPanelContent": "ستتم إعادة تشغيل لوحة العقدة وخدمات الاشتراك وقد تتوقف مؤقتًا. يتطلب رمز API بصلاحية node-admin أو admin على العقدة.",
|
||||
"addNode": "إضافة نود",
|
||||
"editNode": "تحرير العقدة",
|
||||
"totalNodes": "إجمالي النودز",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "متوقف"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "تمت إعادة تشغيل Xray على العقدة.",
|
||||
"panelRestartAccepted": "تم قبول طلب إعادة تشغيل اللوحة. قد تتوقف العقدة مؤقتًا.",
|
||||
"list": "فشل تحميل النودز",
|
||||
"obtain": "فشل تحميل النود",
|
||||
"add": "إضافة نود",
|
||||
|
||||
@@ -1237,6 +1237,11 @@
|
||||
"dragToReorder": "Drag to reorder {name}"
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Restart Xray",
|
||||
"restartPanel": "Restart Panel",
|
||||
"restartConfirmTitle": "Restart {name}?",
|
||||
"restartXrayContent": "Active Xray connections on this node will be interrupted.",
|
||||
"restartPanelContent": "The node panel and subscription services will restart and may be temporarily unavailable. Requires a node-admin or admin API token on the node.",
|
||||
"addNode": "Add Node",
|
||||
"editNode": "Edit Node",
|
||||
"totalNodes": "Total Nodes",
|
||||
@@ -1306,6 +1311,8 @@
|
||||
"xrayStopped": "Stopped"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray restarted on the node.",
|
||||
"panelRestartAccepted": "Panel restart request accepted. The node may be temporarily unavailable.",
|
||||
"list": "Failed to load nodes",
|
||||
"obtain": "Failed to load node",
|
||||
"add": "Add node",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "Quitados {count} cliente(s) de {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Reiniciar Xray",
|
||||
"restartPanel": "Reiniciar panel",
|
||||
"restartConfirmTitle": "¿Reiniciar {name}?",
|
||||
"restartXrayContent": "Se interrumpirán las conexiones Xray activas de este nodo.",
|
||||
"restartPanelContent": "El panel y los servicios de suscripción del nodo se reiniciarán y podrían dejar de estar disponibles temporalmente. Requiere un token API node-admin o admin en el nodo.",
|
||||
"addNode": "Agregar nodo",
|
||||
"editNode": "Editar nodo",
|
||||
"totalNodes": "Total de nodos",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Detenido"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray se ha reiniciado en el nodo.",
|
||||
"panelRestartAccepted": "Solicitud de reinicio del panel aceptada. El nodo podría no estar disponible temporalmente.",
|
||||
"list": "Error al cargar los nodos",
|
||||
"obtain": "Error al cargar el nodo",
|
||||
"add": "Agregar nodo",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "{count} کاربر از {name} حذف شد."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "راهاندازی مجدد Xray",
|
||||
"restartPanel": "راهاندازی مجدد پنل",
|
||||
"restartConfirmTitle": "راهاندازی مجدد {name}؟",
|
||||
"restartXrayContent": "اتصالهای فعال Xray روی این نود قطع میشوند.",
|
||||
"restartPanelContent": "پنل و سرویس اشتراک نود مجدداً راهاندازی میشوند و ممکن است موقتاً در دسترس نباشند. توکن API نود باید دسترسی node-admin یا admin داشته باشد.",
|
||||
"addNode": "افزودن نود",
|
||||
"editNode": "ویرایش نود",
|
||||
"totalNodes": "کل نودها",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "متوقف"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray روی نود مجدداً راهاندازی شد.",
|
||||
"panelRestartAccepted": "درخواست راهاندازی مجدد پنل پذیرفته شد. نود ممکن است موقتاً در دسترس نباشد.",
|
||||
"list": "بارگذاری نودها ناموفق",
|
||||
"obtain": "بارگذاری نود ناموفق",
|
||||
"add": "افزودن نود",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "{count} klien dihapus dari {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Mulai ulang Xray",
|
||||
"restartPanel": "Mulai ulang panel",
|
||||
"restartConfirmTitle": "Mulai ulang {name}?",
|
||||
"restartXrayContent": "Koneksi Xray aktif pada node ini akan terputus.",
|
||||
"restartPanelContent": "Panel node dan layanan langganan akan dimulai ulang dan mungkin tidak tersedia sementara. Memerlukan token API node-admin atau admin pada node.",
|
||||
"addNode": "Tambah Node",
|
||||
"editNode": "Edit node",
|
||||
"totalNodes": "Total Node",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Berhenti"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray pada node telah dimulai ulang.",
|
||||
"panelRestartAccepted": "Permintaan mulai ulang panel diterima. Node mungkin tidak tersedia sementara.",
|
||||
"list": "Gagal memuat node",
|
||||
"obtain": "Gagal memuat node",
|
||||
"add": "Tambah node",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "{count} クライアントを {name} から外しました。"
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Xrayを再起動",
|
||||
"restartPanel": "パネルを再起動",
|
||||
"restartConfirmTitle": "{name}を再起動しますか?",
|
||||
"restartXrayContent": "このノードのアクティブなXray接続は切断されます。",
|
||||
"restartPanelContent": "ノードのパネルとサブスクリプションサービスを再起動するため、一時的に利用できなくなる場合があります。ノードのnode-adminまたはadmin APIトークンが必要です。",
|
||||
"addNode": "ノードを追加",
|
||||
"editNode": "ノード編集",
|
||||
"totalNodes": "ノード総数",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "停止"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "ノードのXrayを再起動しました。",
|
||||
"panelRestartAccepted": "パネルの再起動リクエストを受け付けました。ノードが一時的に利用できなくなる場合があります。",
|
||||
"list": "ノードの読み込みに失敗しました",
|
||||
"obtain": "ノードの読み込みに失敗しました",
|
||||
"add": "ノードを追加",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "Removidos {count} cliente(s) de {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Reiniciar Xray",
|
||||
"restartPanel": "Reiniciar painel",
|
||||
"restartConfirmTitle": "Reiniciar {name}?",
|
||||
"restartXrayContent": "As conexões Xray ativas neste nó serão interrompidas.",
|
||||
"restartPanelContent": "O painel e os serviços de assinatura do nó serão reiniciados e poderão ficar indisponíveis temporariamente. Requer um token de API node-admin ou admin no nó.",
|
||||
"addNode": "Adicionar nó",
|
||||
"editNode": "Editar nó",
|
||||
"totalNodes": "Total de nós",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Parado"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray reiniciado no nó.",
|
||||
"panelRestartAccepted": "Solicitação de reinício do painel aceita. O nó poderá ficar indisponível temporariamente.",
|
||||
"list": "Falha ao carregar os nós",
|
||||
"obtain": "Falha ao carregar o nó",
|
||||
"add": "Adicionar nó",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "Удалено {count} клиент(ов) из {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Перезапустить Xray",
|
||||
"restartPanel": "Перезапустить панель",
|
||||
"restartConfirmTitle": "Перезапустить {name}?",
|
||||
"restartXrayContent": "Активные соединения Xray на этом узле будут прерваны.",
|
||||
"restartPanelContent": "Панель узла и службы подписки будут перезапущены и могут быть временно недоступны. Требуется API-токен node-admin или admin на узле.",
|
||||
"addNode": "Добавить узел",
|
||||
"editNode": "Изменить узел",
|
||||
"totalNodes": "Всего узлов",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Остановлен"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray на узле перезапущен.",
|
||||
"panelRestartAccepted": "Запрос на перезапуск панели принят. Узел может быть временно недоступен.",
|
||||
"list": "Не удалось загрузить узлы",
|
||||
"obtain": "Не удалось загрузить узел",
|
||||
"add": "Добавить узел",
|
||||
|
||||
@@ -1237,6 +1237,11 @@
|
||||
"dragToReorder": "Presunutím zmeníte poradie {name}"
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Reštartovať Xray",
|
||||
"restartPanel": "Reštartovať panel",
|
||||
"restartConfirmTitle": "Reštartovať {name}?",
|
||||
"restartXrayContent": "Aktívne spojenia Xray na tomto uzle sa prerušia.",
|
||||
"restartPanelContent": "Panel uzla a služby odberov sa reštartujú a môžu byť dočasne nedostupné. Vyžaduje sa API token node-admin alebo admin na uzle.",
|
||||
"addNode": "Pridať server",
|
||||
"editNode": "Upraviť server",
|
||||
"totalNodes": "Počet serverov",
|
||||
@@ -1306,6 +1311,8 @@
|
||||
"xrayStopped": "Zastavený"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray na uzle bol reštartovaný.",
|
||||
"panelRestartAccepted": "Žiadosť o reštart panela bola prijatá. Uzol môže byť dočasne nedostupný.",
|
||||
"list": "Nepodarilo sa načítať servery",
|
||||
"obtain": "Nepodarilo sa načítať server",
|
||||
"add": "Pridať server",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "{name} grubundan {count} kullanıcı çıkarıldı."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Xray yeniden başlat",
|
||||
"restartPanel": "Paneli yeniden başlat",
|
||||
"restartConfirmTitle": "{name} yeniden başlatılsın mı?",
|
||||
"restartXrayContent": "Bu düğümdeki etkin Xray bağlantıları kesilecektir.",
|
||||
"restartPanelContent": "Düğüm paneli ve abonelik hizmetleri yeniden başlatılacak ve geçici olarak kullanılamayabilir. Düğümde node-admin veya admin API belirteci gerekir.",
|
||||
"addNode": "Düğüm Ekle",
|
||||
"editNode": "Düğümü Düzenle",
|
||||
"totalNodes": "Toplam Düğüm",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Durduruldu"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Düğümde Xray yeniden başlatıldı.",
|
||||
"panelRestartAccepted": "Panel yeniden başlatma isteği kabul edildi. Düğüm geçici olarak kullanılamayabilir.",
|
||||
"list": "Düğümler yüklenemedi",
|
||||
"obtain": "Düğüm yüklenemedi",
|
||||
"add": "Düğüm ekle",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "Видалено {count} клієнт(ів) з {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Перезапустити Xray",
|
||||
"restartPanel": "Перезапустити панель",
|
||||
"restartConfirmTitle": "Перезапустити {name}?",
|
||||
"restartXrayContent": "Активні з’єднання Xray на цьому вузлі буде перервано.",
|
||||
"restartPanelContent": "Панель вузла та служби підписки буде перезапущено, і вони можуть бути тимчасово недоступні. Потрібен API-токен node-admin або admin на вузлі.",
|
||||
"addNode": "Додати вузол",
|
||||
"editNode": "Змінити вузол",
|
||||
"totalNodes": "Усього вузлів",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Зупинено"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Xray на вузлі перезапущено.",
|
||||
"panelRestartAccepted": "Запит на перезапуск панелі прийнято. Вузол може бути тимчасово недоступний.",
|
||||
"list": "Не вдалося завантажити вузли",
|
||||
"obtain": "Не вдалося завантажити вузол",
|
||||
"add": "Додати вузол",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "Đã xóa {count} client khỏi {name}."
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "Khởi động lại Xray",
|
||||
"restartPanel": "Khởi động lại bảng điều khiển",
|
||||
"restartConfirmTitle": "Khởi động lại {name}?",
|
||||
"restartXrayContent": "Các kết nối Xray đang hoạt động trên nút này sẽ bị ngắt.",
|
||||
"restartPanelContent": "Bảng điều khiển và dịch vụ đăng ký của nút sẽ khởi động lại và có thể tạm thời không khả dụng. Yêu cầu mã API node-admin hoặc admin trên nút.",
|
||||
"addNode": "Thêm nút",
|
||||
"editNode": "Sửa node",
|
||||
"totalNodes": "Tổng số nút",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "Đã dừng"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "Đã khởi động lại Xray trên nút.",
|
||||
"panelRestartAccepted": "Đã chấp nhận yêu cầu khởi động lại bảng điều khiển. Nút có thể tạm thời không khả dụng.",
|
||||
"list": "Không tải được danh sách nút",
|
||||
"obtain": "Không tải được nút",
|
||||
"add": "Thêm nút",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "已从 {name} 移除 {count} 个客户端。"
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "重启 Xray",
|
||||
"restartPanel": "重启面板",
|
||||
"restartConfirmTitle": "重启 {name}?",
|
||||
"restartXrayContent": "此节点上活跃的 Xray 连接将会中断。",
|
||||
"restartPanelContent": "节点面板和订阅服务将重启,并可能暂时不可用。需要节点上的 node-admin 或 admin API 令牌。",
|
||||
"addNode": "添加节点",
|
||||
"editNode": "编辑节点",
|
||||
"totalNodes": "节点总数",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "已停止"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "已重启节点上的 Xray。",
|
||||
"panelRestartAccepted": "已接受面板重启请求。节点可能暂时不可用。",
|
||||
"list": "加载节点失败",
|
||||
"obtain": "加载节点失败",
|
||||
"add": "添加节点",
|
||||
|
||||
@@ -1116,6 +1116,11 @@
|
||||
"removeFromGroupResult": "已從 {name} 移除 {count} 個客戶端。"
|
||||
},
|
||||
"nodes": {
|
||||
"restartXray": "重新啟動 Xray",
|
||||
"restartPanel": "重新啟動面板",
|
||||
"restartConfirmTitle": "重新啟動 {name}?",
|
||||
"restartXrayContent": "此節點上使用中的 Xray 連線將會中斷。",
|
||||
"restartPanelContent": "節點面板與訂閱服務將重新啟動,可能暫時無法使用。需要節點上的 node-admin 或 admin API 權杖。",
|
||||
"addNode": "新增節點",
|
||||
"editNode": "編輯節點",
|
||||
"totalNodes": "節點總數",
|
||||
@@ -1185,6 +1190,8 @@
|
||||
"xrayStopped": "已停止"
|
||||
},
|
||||
"toasts": {
|
||||
"xrayRestarted": "已重新啟動節點上的 Xray。",
|
||||
"panelRestartAccepted": "已接受面板重新啟動請求。節點可能暫時無法使用。",
|
||||
"list": "載入節點失敗",
|
||||
"obtain": "載入節點失敗",
|
||||
"add": "新增節點",
|
||||
|
||||
Reference in New Issue
Block a user