[PR #6970] feat(nodes): add remote Xray and panel restart actions #6553

Open
opened 2026-11-02 04:09:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6970
Author: @HamedSanaei
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: codex/issue-6937-node-restart


📝 Commits (3)

  • 00ca379 test(service): start system sampler outside virtual clock
  • f2aefdc feat(nodes): add remote Xray and panel restart actions
  • d37fb05 Merge upstream main into codex/issue-6937-node-restart

📊 Changes

40 files changed (+941 additions, -4 deletions)

View changed files

📝 docs/content/docs/en/operations/multi-node.mdx (+18 -0)
📝 docs/content/docs/en/reference/api/nodes.mdx (+27 -1)
➕ docs/public/images/node-restart-confirm.png (+0 -0)
➕ docs/public/images/node-restart-desktop.png (+0 -0)
➕ docs/public/images/node-restart-mobile.png (+0 -0)
📝 docs/public/openapi.json (+82 -0)
📝 frontend/public/openapi.json (+82 -0)
📝 frontend/src/api/queries/useNodeMutations.ts (+17 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+14 -0)
📝 frontend/src/pages/nodes/NodeList.tsx (+30 -1)
📝 frontend/src/pages/nodes/NodesPage.tsx (+51 -0)
📝 frontend/src/test/node-list-a11y.test.tsx (+1 -0)
📝 frontend/src/test/node-list-rerender.test.tsx (+1 -0)
📝 frontend/src/test/node-list-rowkey.test.tsx (+1 -0)
📝 frontend/src/test/node-list-untrusted-i18n.test.tsx (+1 -0)
📝 frontend/src/test/node-metrics-availability.test.tsx (+2 -0)
➕ frontend/src/test/node-restart.test.tsx (+147 -0)
➕ internal/nodee2e/node_restart_test.go (+55 -0)
📝 internal/web/controller/api.go (+3 -2)
📝 internal/web/controller/node.go (+30 -0)

...and 20 more files

📄 Description

Summary

Add separate Restart Xray and Restart Panel actions to each directly configured node's desktop and mobile menu. Confirm the node name, prevent duplicate pending requests, and report failures without automatic retries.

Why

The master Nodes page can probe and update nodes, but cannot restart their services. Closes #6937.

Xray restart uses the existing runtime. Panel restart uses the existing three-second panel/subscription lifecycle; success acknowledges scheduling. Invalid, missing, and disabled node IDs are rejected before dispatch, while a stale offline heartbeat does not block contacting an enabled node. Transitive nodes remain read-only.

Master-side Nodes API permissions are unchanged. On the node, panel restart requires admin or node-admin; mTLS requires an explicit node-admin bearer token. node-sync retains Xray restart authority and cannot restart the panel. Older nodes may need upgrading for node-admin panel restart. Includes all 14 translations and regenerated API and operation docs.

A separate prerequisite commit fixes an existing Windows test-fixture deadlock, reproduced on pristine upstream c621ba90: initialize gopsutil's process-wide load sampler before the public-IP status test enters synctest. That commit changes no production behavior.

Type of change

  • New feature
  • Documentation
  • Bug fix (test-fixture prerequisite)

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Multi-node (sub-nodes)

How was this tested?

  • All make verify targets passed: 2,023 frontend tests in 216 files, Go tests, lint/type/format checks, panel/Go/Storybook builds, and generated API checks. The final docs comparison was completed after adding Git's cmp to the Windows PATH.
  • go test -p 2 -race -shuffle=on -count=1 -timeout 25m ./internal/web/service ./internal/web/controller ./internal/web/runtime ./internal/web
  • Full real-process master/node E2E suite, including a panel/subscription restart that preserves the selected node's inbound and leaves the master running; the restart scenario also passed against the final production build.
  • Controller HTTP tests cover both endpoints, selected-node dispatch, node rejection, cancellation/deadline propagation, invalid IDs, and disabled nodes. Auth tests cover bearer/mTLS scope enforcement and the delayed restart hook. UI tests cover desktop/mobile confirmation, cancellation, pending guards, errors, and ineligible nodes.
  • Red/green checks reproduced missing routes, rejected node-admin authorization, absent UI actions, and the real-process restart's 404 before its route was added. The Windows fixture test failed on untouched upstream and passed under race after the fixture repair.

Screenshots / recordings

Chromium screenshots of the production build with sample node data. Backend behavior is covered separately by the HTTP and real-process tests above.

Desktop restart menu

Panel restart confirmation

Mobile restart menu

Breaking changes

None. No database migration or existing API changes. Remote panel restart needs the node permissions described above.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior.
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated API and operation docs for the user-facing behavior.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR: the existing Windows test-fixture repair is isolated in its own prerequisite commit and explained above.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6970 **Author:** [@HamedSanaei](https://github.com/HamedSanaei) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/issue-6937-node-restart` --- ### 📝 Commits (3) - [`00ca379`](https://github.com/MHSanaei/3x-ui/commit/00ca379cc8a614fdb53b006f805006177281bc3e) test(service): start system sampler outside virtual clock - [`f2aefdc`](https://github.com/MHSanaei/3x-ui/commit/f2aefdcf7c26afbfbe79170033b582fdb37b909b) feat(nodes): add remote Xray and panel restart actions - [`d37fb05`](https://github.com/MHSanaei/3x-ui/commit/d37fb05dcc2b5782e9bb2d9fac35b711a5f7300b) Merge upstream main into codex/issue-6937-node-restart ### 📊 Changes **40 files changed** (+941 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/en/operations/multi-node.mdx` (+18 -0) 📝 `docs/content/docs/en/reference/api/nodes.mdx` (+27 -1) ➕ `docs/public/images/node-restart-confirm.png` (+0 -0) ➕ `docs/public/images/node-restart-desktop.png` (+0 -0) ➕ `docs/public/images/node-restart-mobile.png` (+0 -0) 📝 `docs/public/openapi.json` (+82 -0) 📝 `frontend/public/openapi.json` (+82 -0) 📝 `frontend/src/api/queries/useNodeMutations.ts` (+17 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+14 -0) 📝 `frontend/src/pages/nodes/NodeList.tsx` (+30 -1) 📝 `frontend/src/pages/nodes/NodesPage.tsx` (+51 -0) 📝 `frontend/src/test/node-list-a11y.test.tsx` (+1 -0) 📝 `frontend/src/test/node-list-rerender.test.tsx` (+1 -0) 📝 `frontend/src/test/node-list-rowkey.test.tsx` (+1 -0) 📝 `frontend/src/test/node-list-untrusted-i18n.test.tsx` (+1 -0) 📝 `frontend/src/test/node-metrics-availability.test.tsx` (+2 -0) ➕ `frontend/src/test/node-restart.test.tsx` (+147 -0) ➕ `internal/nodee2e/node_restart_test.go` (+55 -0) 📝 `internal/web/controller/api.go` (+3 -2) 📝 `internal/web/controller/node.go` (+30 -0) _...and 20 more files_ </details> ### 📄 Description ## Summary Add separate **Restart Xray** and **Restart Panel** actions to each directly configured node's desktop and mobile menu. Confirm the node name, prevent duplicate pending requests, and report failures without automatic retries. ## Why The master Nodes page can probe and update nodes, but cannot restart their services. Closes #6937. Xray restart uses the existing runtime. Panel restart uses the existing three-second panel/subscription lifecycle; success acknowledges scheduling. Invalid, missing, and disabled node IDs are rejected before dispatch, while a stale offline heartbeat does not block contacting an enabled node. Transitive nodes remain read-only. Master-side Nodes API permissions are unchanged. On the node, panel restart requires `admin` or `node-admin`; mTLS requires an explicit `node-admin` bearer token. `node-sync` retains Xray restart authority and cannot restart the panel. Older nodes may need upgrading for `node-admin` panel restart. Includes all 14 translations and regenerated API and operation docs. A separate prerequisite commit fixes an existing Windows test-fixture deadlock, reproduced on pristine upstream `c621ba90`: initialize gopsutil's process-wide load sampler before the public-IP status test enters `synctest`. That commit changes no production behavior. ## Type of change - [x] New feature - [x] Documentation - [x] Bug fix (test-fixture prerequisite) ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [x] Multi-node (sub-nodes) ## How was this tested? - All `make verify` targets passed: 2,023 frontend tests in 216 files, Go tests, lint/type/format checks, panel/Go/Storybook builds, and generated API checks. The final docs comparison was completed after adding Git's `cmp` to the Windows PATH. - `go test -p 2 -race -shuffle=on -count=1 -timeout 25m ./internal/web/service ./internal/web/controller ./internal/web/runtime ./internal/web` - Full real-process master/node E2E suite, including a panel/subscription restart that preserves the selected node's inbound and leaves the master running; the restart scenario also passed against the final production build. - Controller HTTP tests cover both endpoints, selected-node dispatch, node rejection, cancellation/deadline propagation, invalid IDs, and disabled nodes. Auth tests cover bearer/mTLS scope enforcement and the delayed restart hook. UI tests cover desktop/mobile confirmation, cancellation, pending guards, errors, and ineligible nodes. - Red/green checks reproduced missing routes, rejected node-admin authorization, absent UI actions, and the real-process restart's 404 before its route was added. The Windows fixture test failed on untouched upstream and passed under race after the fixture repair. ## Screenshots / recordings Chromium screenshots of the production build with sample node data. Backend behavior is covered separately by the HTTP and real-process tests above. ![Desktop restart menu](https://raw.githubusercontent.com/HamedSanaei/3x-ui/f2aefdcf7c26afbfbe79170033b582fdb37b909b/docs/public/images/node-restart-desktop.png) ![Panel restart confirmation](https://raw.githubusercontent.com/HamedSanaei/3x-ui/f2aefdcf7c26afbfbe79170033b582fdb37b909b/docs/public/images/node-restart-confirm.png) ![Mobile restart menu](https://raw.githubusercontent.com/HamedSanaei/3x-ui/f2aefdcf7c26afbfbe79170033b582fdb37b909b/docs/public/images/node-restart-mobile.png) ## Breaking changes None. No database migration or existing API changes. Remote panel restart needs the node permissions described above. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior. - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [x] I updated API and operation docs for the user-facing behavior. - [x] My commits follow the project's existing message style. - [ ] I have no unrelated changes mixed into this PR: the existing Windows test-fixture repair is isolated in its own prerequisite commit and explained above. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6553
No description provided.