mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5988] [CLOSED] fix(clients): allow multiple clients to share a subId #6045
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#6045
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?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5988
Author: @oxsean
Created: 7/16/2026
Status: ❌ Closed
Base:
main← Head:fix/allow-shared-subid📝 Commits (1)
e4293b4fix(clients): allow multiple clients to share a subId📊 Changes
4 files changed (+9 additions, -70 deletions)
View changed files
📝
internal/web/service/client_bulk.go(+0 -26)📝
internal/web/service/client_crud.go(+0 -24)📝
internal/web/service/client_portable.go(+0 -12)📝
internal/web/service/client_update_rename_test.go(+9 -8)📄 Description
Problem
Editing a client fails with
Duplicate subIdwhen its subscription ID matches another client's. In a multi-node setup, clients reconciled from different nodes are separate records with distinct emails and cannot be merged into one client, so a shared subId is the only way to aggregate them under a single subscription link.Why the uniqueness check is wrong
Commit
88a36773introduced per-client subId uniqueness on the grounds that the first-class client model aggregates via one client attached to many inbounds. That holds for top-down provisioning, but not for clients synced bottom-up from nodes. Meanwhile the subscription pipeline explicitly supports many records per subId:getInboundsBySubIdjoins across all clients with the subId, andindexStatsBySubIdplucks every matching email (plural). The checks blocked a flow the sub server already serves.Changes
ClientService.Create,Update,BulkCreateand portable import (internal/web/service/client_crud.go,client_bulk.go,client_portable.go).TestClientUpdateDuplicateSubIDDoesNotRenameEmailwithTestClientUpdateAllowsSharedSubID, asserting an update to a shared subId succeeds and leaves the other client intact.Testing
go test -shuffle=on -count=1 ./internal/web/service/ ./internal/sub/— all pass (547 + sub package).gofmt/go vetclean on changed files.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.