mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5694] [Feature]: Unified Subscription Link for Groups (Reusing existing aggregation engine) #3959
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#3959
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 @De-naber on GitHub (Jun 30, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5694
Is your feature request related to a problem?
First of all, thank you for the incredible work! The software is absolutely top-notch, and the recent improvements to the "Groups" functionality in the latest releases are perfect.
However, there is a missing piece for a very common real-world scenario. Currently, if I want to provide access to a "Family" (which has multiple users and multiple devices), I have to generate and send a separate subscription link for each client/device. This is quite tedious for the end-user.
It would be much more logical and user-friendly to share just one single subscription link for the entire Group. The user's app (v2rayNG, Karing, etc.) would then fetch this group link and automatically get all the inbounds/configs assigned to the clients within that group.
Describe the solution you'd like
Implement a Group Subscription Link.
I took a look at the SQLite database structure and the current backend logic, and it seems almost zero new logic needs to be written. The engine already knows how to do this!
Currently, the backend engine is already capable of aggregating clients that share the same sub_id into a single subscription link (even if the UI normally prevents duplicate sub IDs, the underlying mechanism still works perfectly). We can just reuse this exact mechanism for Groups.
Proposed Technical Implementation (Backend):
Proposed Implementation (Frontend/UI):
We can reuse the existing UI components.
Currently, when you click on a client, the "Client Information" modal pops up, displaying all their inbounds and subscription links. We can reuse this exact modal/logic for Groups. When clicking on a Group, it should open a similar window displaying the new group_sub_id and the aggregated subscription link.
Additional Context:
By reusing the existing aggregation engine and the existing "Client Information" UI modal, this feature can be implemented with minimal code changes while providing a massive quality-of-life improvement for panel admins.
Alternatives you've considered
The only current workaround is to create a single "Client" and share its subscription link across all family devices. But this completely ruins the ability to track traffic statistics per user/device and breaks the whole purpose of the panel's detailed stats.
Concrete use case
No response
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
No response
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 30, 2026):
The technical analysis in this request is broadly accurate, but the implementation scope is somewhat larger than "almost zero new logic." Here is what the code actually shows and what a PR would need to touch.
What already exists
ClientGroupstruct (internal/database/model/model.go:649-658) hasId,Name,ResetUp,ResetDown,CreatedAt,UpdatedAt. There is no subscription-related field on this table today.Groupstring field (columngroup_name) that links them to a group. There is no per-groupsub_idequivalent.internal/sub/service.goaggregates across multiple clients and inbounds viagetInboundsBySubId(), which queriesWHERE clients.sub_id = ?. The aggregation machinery — includingAggregateTrafficByEmails()for unified traffic totals — works and is reusable./sub/{subId},/json/{subId},/clash/{subId}) ininternal/sub/controller.goare all keyed on a per-clientsub_id. There is no group-keyed path.What a PR would actually need to add
DB schema + migration (
internal/database/model/model.goandinternal/database/db.go): add agroup_sub_idcolumn (unique, nullable) toclient_groups, with a correspondingAutoMigratemigration. Without a dedicated token the group name itself cannot safely serve as the URL segment because names are mutable.New DB query (
internal/sub/service.go): agetInboundsByGroupSubId()function parallel togetInboundsBySubId()that joins viaclients.group_name = (SELECT name FROM client_groups WHERE group_sub_id = ?)instead ofclients.sub_id = ?. The existingAggregateTrafficByEmails()call ingetSubs()can then be reused as-is.New subscription routes (
internal/sub/controller.go): route handlers for the group-keyed URL variants, dispatching to the new query. The format (e.g./sub/g/{groupSubId}or a prefix flag) needs to be decided so it cannot collide with existing per-client sub IDs.Group API endpoints (
internal/web/controller/group.goandfrontend/src/pages/api-docs/endpoints.ts): endpoints to generate, display, and revoke a group's sub ID. Per the project rules, every newg.POST/g.GETrequires a matching entry inendpoints.ts, followed bymake gen.Frontend UI (
frontend/src/): a group-info modal or panel showing the group subscription URL and QR code, analogous to the existing client info modal. Reusing the client info component is a reasonable starting point.i18n (
internal/web/translation/): any new string keys must be added to all 13 locale JSON files.What the workaround described in the issue breaks
The issuer correctly identifies the core problem: sharing one client across devices collapses per-device traffic tracking. The group subscription approach preserves separate
ClientRecordrows and therefore separateclient_trafficsrows, which is the right design.Precedent in nearby issues
Issues #4776 (closed) and #5664 (closed) approached related aggregation problems from different angles (shared sub IDs for routing, and a "shell client" container). Neither was implemented; neither is a duplicate of this request.
A PR implementing the above would be a welcome contribution. The complexity is moderate — the aggregation and traffic logic are genuinely reusable — but the schema migration, new routes,
endpoints.tsregistration, and frontend modal are all required for a complete and mergeable change.This reply was generated automatically; a maintainer may follow up.