[PR #6860] [CLOSED] feat(clients): show active profiles per client across nodes #6488

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6860
Author: @icelol
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: feat/client-active-profiles-upstream


📝 Commits (1)

  • b95a1cd feat(clients): show active profiles per client across nodes

📊 Changes

51 files changed (+1325 additions, -13 deletions)

View changed files

➕ docs/ACTIVE_CLIENT_PROFILES.md (+37 -0)
➕ docs/images/active-client-profiles.png (+0 -0)
📝 frontend/public/openapi.json (+106 -0)
📝 frontend/src/api/queryKeys.ts (+1 -0)
📝 frontend/src/generated/examples.ts (+6 -0)
📝 frontend/src/generated/schemas.ts (+30 -0)
📝 frontend/src/generated/types.ts (+8 -0)
📝 frontend/src/generated/zod.ts (+11 -0)
📝 frontend/src/hooks/useClients.ts (+23 -0)
➕ frontend/src/lib/clients/active-profiles.ts (+56 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+8 -0)
📝 frontend/src/pages/api-docs/websocket-events.ts (+14 -0)
➕ frontend/src/pages/clients/ClientActiveProfiles.stories.tsx (+85 -0)
📝 frontend/src/pages/clients/ClientsPage.tsx (+27 -1)
📝 frontend/src/pages/clients/RowCells.tsx (+42 -0)
📝 frontend/src/schemas/client.ts (+1 -0)
➕ frontend/src/test/client-active-profiles-cell.test.tsx (+41 -0)
➕ frontend/src/test/client-active-profiles.test.ts (+71 -0)
📝 internal/web/controller/api.go (+1 -0)
📝 internal/web/controller/client.go (+5 -0)

...and 31 more files

📄 Description

Summary

Show each client's live authenticated profile names in the clients table and mobile card, including simultaneous profiles across nodes. This draft is paired with an additive Xray stats proposal; it does not request immediate merge.

Companion Xray draft: https://github.com/XTLS/Xray-core/pull/7186

Why

A shared account can use VLESS on one node and Hysteria2 on another at the same time. Aggregate online users, inbound byte counters, and a shared source IP cannot reliably attribute those profiles to that account. This view uses the authenticated email, physical node GUID, inbound tag, and client attachments together instead.

Type of change

  • New feature

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints)
  • Statistics (live attribution only; byte counters are unchanged)
  • Multi-node (sub-nodes)

No database migrations, credentials/subscription changes, bot changes, server deployment scripts, or port changes are included.

Implementation and compatibility

  • Add authenticated POST /panel/api/clients/activeProfiles and reuse the existing traffic WebSocket. The frontend uses one aggregate query, not a request per row; the existing memoized Ant Design cells/chips are retained.
  • Keep full, memory-only snapshots with a 20-second receipt TTL, physical-node identity, tag remapping and selected-sync filtering. Disconnects replace previous state; duplicate paths select the newest source snapshot rather than unioning stale links.
  • Admin and node-sync scopes may read the new API; monitor scope may not. Its payload has no credentials, source IPs, or destinations.
  • Keep the official Xray Go dependency pin unchanged. Read both unknown protobuf fields with the current dependency and declared fields after a future dependency update. A stock/older core remains usable and displays Unavailable; accurate profile attribution requires the companion core change. Optional real-core tests skip explicitly without a provided executable.
  • Include API documentation, regenerated schemas/OpenAPI, translations, regression tests and synthetic Storybook fixtures. See docs/ACTIVE_CLIENT_PROFILES.md for the contract and limits.

How was this tested?

Local Linux/amd64 build with the normal official module pin, without a forked module replacement or Go workspace:

go build ./...
XRAY_E2E_BINARY=/absolute/path/to/patched/xray go test -p 2 -race -shuffle=on -count=1 -timeout 25m ./...
cd frontend
npm run gen
npm run lint
npm run format:check
npm run typecheck
npm exec -- vitest run --project unit --project components
npm run build

Frontend: 163 files / 1,753 unit and component tests passed. The real-core test opens local VLESS and Hysteria2 tunnels, verifies simultaneous profiles, users behind the same source IP, idle open links and removal on disconnect. TLS is verified against the test certificate, not bypassed. Regression tests also cover stale snapshots, deep copies, node GUID/tag remapping, attachment matching, protobuf compatibility/malformed metadata and API scopes.

Headless Google Chrome checked the synthetic concurrent, disconnected and unsupported-core Storybook states without browser exceptions. The complete upstream CI matrix (including PostgreSQL, all Storybook browser tests and cross-platform checks) is not claimed as locally completed.

Screenshots / recordings

Component preview with synthetic client rows, using the existing panel theme/components; no production clients or secrets:

Active profiles with simultaneous connections, disconnected and unsupported-core states

Breaking changes

None. Existing core versions continue working with an unknown state in the new column. There are no schema migrations or traffic counter resets. The proposed Xray fields remain open for API review while both PRs are drafts.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior.
  • go build ./... and the local Go test suite pass.
  • Frontend lint, formatting, typecheck and production build pass.
  • I updated the API documentation and included a user-facing feature description.
  • My commits follow the project's existing message style.
  • I have no unrelated deployment, bot or private-server changes mixed into this PR.

🔄 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/6860 **Author:** [@icelol](https://github.com/icelol) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/client-active-profiles-upstream` --- ### 📝 Commits (1) - [`b95a1cd`](https://github.com/MHSanaei/3x-ui/commit/b95a1cdd86ee21aa379b5c76fca48be1c3afdc6a) feat(clients): show active profiles per client across nodes ### 📊 Changes **51 files changed** (+1325 additions, -13 deletions) <details> <summary>View changed files</summary> ➕ `docs/ACTIVE_CLIENT_PROFILES.md` (+37 -0) ➕ `docs/images/active-client-profiles.png` (+0 -0) 📝 `frontend/public/openapi.json` (+106 -0) 📝 `frontend/src/api/queryKeys.ts` (+1 -0) 📝 `frontend/src/generated/examples.ts` (+6 -0) 📝 `frontend/src/generated/schemas.ts` (+30 -0) 📝 `frontend/src/generated/types.ts` (+8 -0) 📝 `frontend/src/generated/zod.ts` (+11 -0) 📝 `frontend/src/hooks/useClients.ts` (+23 -0) ➕ `frontend/src/lib/clients/active-profiles.ts` (+56 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+8 -0) 📝 `frontend/src/pages/api-docs/websocket-events.ts` (+14 -0) ➕ `frontend/src/pages/clients/ClientActiveProfiles.stories.tsx` (+85 -0) 📝 `frontend/src/pages/clients/ClientsPage.tsx` (+27 -1) 📝 `frontend/src/pages/clients/RowCells.tsx` (+42 -0) 📝 `frontend/src/schemas/client.ts` (+1 -0) ➕ `frontend/src/test/client-active-profiles-cell.test.tsx` (+41 -0) ➕ `frontend/src/test/client-active-profiles.test.ts` (+71 -0) 📝 `internal/web/controller/api.go` (+1 -0) 📝 `internal/web/controller/client.go` (+5 -0) _...and 31 more files_ </details> ### 📄 Description ## Summary Show each client's live authenticated profile names in the clients table and mobile card, including simultaneous profiles across nodes. This draft is paired with an additive Xray stats proposal; it does not request immediate merge. Companion Xray draft: https://github.com/XTLS/Xray-core/pull/7186 ## Why A shared account can use VLESS on one node and Hysteria2 on another at the same time. Aggregate online users, inbound byte counters, and a shared source IP cannot reliably attribute those profiles to that account. This view uses the authenticated email, physical node GUID, inbound tag, and client attachments together instead. ## Type of change - [x] New feature ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints) - [x] Statistics (live attribution only; byte counters are unchanged) - [x] Multi-node (sub-nodes) No database migrations, credentials/subscription changes, bot changes, server deployment scripts, or port changes are included. ## Implementation and compatibility - Add authenticated `POST /panel/api/clients/activeProfiles` and reuse the existing traffic WebSocket. The frontend uses one aggregate query, not a request per row; the existing memoized Ant Design cells/chips are retained. - Keep full, memory-only snapshots with a 20-second receipt TTL, physical-node identity, tag remapping and selected-sync filtering. Disconnects replace previous state; duplicate paths select the newest source snapshot rather than unioning stale links. - Admin and node-sync scopes may read the new API; monitor scope may not. Its payload has no credentials, source IPs, or destinations. - Keep the official Xray Go dependency pin unchanged. Read both unknown protobuf fields with the current dependency and declared fields after a future dependency update. A stock/older core remains usable and displays `Unavailable`; accurate profile attribution requires the companion core change. Optional real-core tests skip explicitly without a provided executable. - Include API documentation, regenerated schemas/OpenAPI, translations, regression tests and synthetic Storybook fixtures. See `docs/ACTIVE_CLIENT_PROFILES.md` for the contract and limits. ## How was this tested? Local Linux/amd64 build with the normal official module pin, without a forked module replacement or Go workspace: ```bash go build ./... XRAY_E2E_BINARY=/absolute/path/to/patched/xray go test -p 2 -race -shuffle=on -count=1 -timeout 25m ./... cd frontend npm run gen npm run lint npm run format:check npm run typecheck npm exec -- vitest run --project unit --project components npm run build ``` Frontend: 163 files / 1,753 unit and component tests passed. The real-core test opens local VLESS and Hysteria2 tunnels, verifies simultaneous profiles, users behind the same source IP, idle open links and removal on disconnect. TLS is verified against the test certificate, not bypassed. Regression tests also cover stale snapshots, deep copies, node GUID/tag remapping, attachment matching, protobuf compatibility/malformed metadata and API scopes. Headless Google Chrome checked the synthetic concurrent, disconnected and unsupported-core Storybook states without browser exceptions. The complete upstream CI matrix (including PostgreSQL, all Storybook browser tests and cross-platform checks) is not claimed as locally completed. ## Screenshots / recordings Component preview with synthetic client rows, using the existing panel theme/components; no production clients or secrets: ![Active profiles with simultaneous connections, disconnected and unsupported-core states](https://github.com/icelol/3x-ui/blob/b95a1cdd86ee21aa379b5c76fca48be1c3afdc6a/docs/images/active-client-profiles.png?raw=true) ## Breaking changes None. Existing core versions continue working with an unknown state in the new column. There are no schema migrations or traffic counter resets. The proposed Xray fields remain open for API review while both PRs are drafts. ## 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 local Go test suite pass. - [x] Frontend lint, formatting, typecheck and production build pass. - [x] I updated the API documentation and included a user-facing feature description. - [x] My commits follow the project's existing message style. - [x] I have no unrelated deployment, bot or private-server changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:09:08 +07:00
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#6488
No description provided.