mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5664] [Feature]: Add a subscription-only “shell client” for subscription aggregation #3945
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3945
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @drownrat on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5664
Is your feature request related to a problem?
Yes. Currently, 3x-ui clients are mainly designed around real inbound attachments.
External links and external subscription URLs can be added to a client, but the exported subscription always places local inbound-generated nodes before external links or external subscription nodes.
This makes it impossible to freely mix local panel nodes and external nodes in a custom order, for example:
External node A
Local node 1
External node B
Local node 2
If I add local panel nodes again as external links while the same client is still attached to local inbounds, the nodes become duplicated. If I detach the client from all inbounds, it loses the normal subscription export workflow in the panel UI.
Describe the solution you'd like
I would like 3x-ui to add a subscription-only client mode, or “shell client”.
This client would not be pushed into any Xray inbound and would not create a real Xray user by itself. It would only act as a subscription container.
Expected behavior:
Example item order:
Alternatives you've considered
I considered adding local panel nodes as external links manually, but this causes duplicate nodes if the same client is still attached to local inbounds.
I also considered creating a client without inbound attachments and using it as a subscription container, but this does not work well in the current panel workflow because the normal subscription export behavior depends on regular clients.
An external subscription aggregation service could solve this, but it adds another service to deploy and maintain. It would be cleaner if 3x-ui could support this directly.
Concrete use case
I manage multiple 3x-ui panels on different servers.
I want one main panel to export a unified subscription for users. The subscription should include both local panel nodes and nodes from other 3x-ui panels.
The desired order is not simply “all local nodes first, then all external nodes”. I need to mix them manually, for example by region, latency, provider, or priority:
This would make 3x-ui more useful as a central subscription management panel.
Mockups, screenshots, or examples
A possible UI could be a new client mode:
Client type:
For a subscription shell client, the panel could show a sortable list of subscription items:
The final exported subscription should follow the order of this list.
Which parts of the panel would this affect?
Subscription (share links / Clash / JSON), Frontend (UI / panel pages), Backend (API endpoints, login, settings)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 29, 2026):
This is a well-specified feature request. Here is what the current code supports and where the gap lies.
What already works today
A client in 3x-ui does not require any inbound attachment. The
clientstable is independent ofclient_inbounds; a client with aSubIDand zero rows inclient_inboundsis a fully valid state, confirmed byinternal/sub/external_only_sub_test.go. Such a client is exported viagetClientExternalLinksBySubId()(internal/sub/external_config.go) and can carry:ClientExternalLink.Kind = "link")ClientExternalLink.Kind = "subscription", fetched and expanded at export time)Each external link has a
SortIndexcolumn (internal/database/model/model.go,ClientExternalLinkstruct) that controls ordering within the set of external links.The architectural gap
The subscription output function
getSubs()(internal/sub/service.go) has a hard-coded two-phase structure:getInboundsBySubId(), sorted byInbound.SubSortIndex ASCthenInbound.Id ASC.client_id ASC, sort_index ASC, id ASC.There is no unified sort index that spans both phases. The requested interleaving (external A → local 1 → external B → local 2) is structurally impossible under the current model because:
What this feature would require
To implement the proposed "shell client" fully, the following changes would be needed across the stack:
New model / extended
ClientExternalLink: A third kind of entry (e.g."local_ref") that stores a reference to a specific(ClientRecord.Email, InboundId)pair, so that a shell client can embed the link generated for another real client on a real inbound.Unified sort index: A single integer column that covers all three item types (external link, external subscription, local reference) within a shell client's subscription list.
Rewritten ordering logic in
getSubs(): Instead of two sequential passes, a single ordered pass over a unified set of items (a join acrossclient_external_linksand a new local-ref table), resolving each item to its link(s) on the fly.Database migration in
internal/database/db.go.Frontend UI: A sortable list component on the client detail page, plus a way to select which existing client+inbound combinations to include.
Partial workaround available now
If the ordering constraint is relaxed — all local nodes from a given inbound can appear as a group, with external items appearing before or after that group — you can approximate this today:
Inbound.SubSortIndexto control where each inbound's group appears relative to others.ClientExternalLink.SortIndexto control ordering within the external-link block.This allows coarse grouping (e.g. all Japan links first, then all Hong Kong links) if each region's local nodes live on their own inbound, but it cannot interleave individual nodes from different inbounds with external nodes in an arbitrary sequence.
This reply was generated automatically; a maintainer may follow up.
@drownrat commented on GitHub (Jun 29, 2026):
Sorry for the noise. I found that this is already supported; I had not enabled the subscription service correctly.
Closing this issue. Thanks.