mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5146] [Feature]: Allow custom subscription link pattern in Bulk Add clients #3617
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#3617
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 @Namso9 on GitHub (Jun 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5146
Is your feature request related to a problem?
Yes. When using Bulk Add to create multiple clients, the Email field can be generated with a prefix and number range, for example Cus 1 to Cus 10.
However, the subscription link / Sub ID is generated randomly. There is currently no option to generate subscription links with a custom prefix or number range.
Example:
I want to bulk create 10 clients with subscription links like:
https://example.com/api/sub/1
https://example.com/api/sub/2
https://example.com/api/sub/3
...
https://example.com/api/sub/10
But currently, after using Bulk Add, I have to edit each client manually one by one to change the subscription link / Sub ID.
This takes extra time and can cause mistakes when creating many clients.
Describe the solution you'd like
Please add an optional custom subscription link / Sub ID pattern feature in the Bulk Add client form.
Suggested UI placement: inside the Bulk Add client modal/form, near the Email range option.
Suggested options:
Subscription ID mode:
[ ] Auto random subscription ID
[ ] Custom subscription pattern
Prefix: ______
Start number: ____
End number: ____
Suffix: ______
Zero padding: ____
Expected behavior:
If “Auto random subscription ID” is selected, the current behavior should stay the same.
If “Custom subscription pattern” is selected, the panel should generate Sub IDs based on the pattern.
Example 1:
Prefix:
Start number: 1
End number: 10
Suffix:
Zero padding: 0
Expected Sub IDs:
1
2
3
...
10
Expected subscription links:
https://example.com/api/sub/1
https://example.com/api/sub/2
https://example.com/api/sub/3
...
https://example.com/api/sub/10
Example 2:
Prefix: Cus-
Start number: 1
End number: 10
Zero padding: 3
Expected Sub IDs:
Cus-001
Cus-002
Cus-003
...
Cus-010
Possible edge cases:
If a generated Sub ID already exists, the panel should show an error before creating clients.
Sub ID should only allow safe characters for URLs.
If the number of generated Sub IDs does not match the number of clients, the panel should show a validation error.
The current random Sub ID behavior should remain the default option.
Alternatives you've considered
Currently, I prepare the subscription links manually outside the panel, for example using AI or a text generator:
https://example.com/api/sub/1
https://example.com/api/sub/2
...
https://example.com/api/sub/10
But after bulk adding clients, the panel still generates random Sub IDs. So I must open each client and manually edit the subscription ID one by one.
This works, but it is slow, repetitive, and easy to make mistakes.
Concrete use case
I manage many clients and often need to create clients in batches.
For example, I may create 10 clients at once:
Cus 1
Cus 2
Cus 3
...
Cus 10
The Email range works correctly in Bulk Add, but I also need the subscription links to be organized in the same way:
/api/sub/1
/api/sub/2
/api/sub/3
...
/api/sub/10
This feature would help admins and resellers create clean, predictable, and organized subscription links without editing each client manually.
Mockups, screenshots, or examples
Example Bulk Add subscription pattern:
Email prefix: Cus
Email start number: 1
Email end number: 10
Subscription ID mode: Custom pattern
Subscription prefix:
Subscription start number: 1
Subscription end number: 10
Zero padding: 0
Expected result:
Email: Cus 1 Sub ID: 1
Email: Cus 2 Sub ID: 2
Email: Cus 3 Sub ID: 3
...
Email: Cus 10 Sub ID: 10
Another example:
Email: Cus 1 Sub ID: Cus-001
Email: Cus 2 Sub ID: Cus-002
Email: Cus 3 Sub ID: Cus-003
...
Email: Cus 10 Sub ID: Cus-010
Which parts of the panel would this affect?
Subscription (share links / Clash / JSON), Other, Frontend (UI / panel pages)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 9, 2026):
Thanks for the detailed and well-structured request, @Namso9.
Current behavior (confirmed in source)
The Bulk Add modal (
frontend/src/pages/clients/ClientBulkAddModal.tsx) builds the payload like this:map(), so it runs once per client). This is the only way to get unique subIds today.web/service/client.go:3309) detects the duplicate within the batch and skips every client after the first with the error"subId already in use".In short, there is no pattern-based generation at all — only "one random per client" or "one fixed for all (broken for batches)".
What would need to change
This is a frontend-only addition for the most part:
frontend/src/schemas/client.ts— extendClientBulkAddFormSchemawith optional new fields (e.g.subIdMethod,subIdPrefix,subIdStart,subIdEnd,subIdPadding).frontend/src/pages/clients/ClientBulkAddModal.tsx— add abuildSubIds()function modeled after the existingbuildEmails(), and wire it up so each email index maps to the corresponding generated subId in the payload.seenSubIDmap,client.go:3269) and against existing records (client.go:3342-3378), and it already validates characters (hasForbiddenClientChar,client.go:527: rejects/,\, space, and control chars). The proposed examples (Cus-001,1,10, etc.) all pass that check.Edge cases to keep in mind
firstNum/lastNumrange that drives email generation, or add a check before submit."subId already in use"per client; the existingbulkCreatedMixedwarning toast will surface this already.If anyone picks this up as a PR, the email method selector (
emailMethod0–4 withfirstNum/lastNum) is the natural model to follow for the subId side.@Namso9 commented on GitHub (Jun 16, 2026):
anyone? pls