mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #4158] [CLOSED] feat: Shared Subscription Traffic Quota across multiple clients #5616
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#5616
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/4158
Author: @Sadegh-Kalami
Created: 5/4/2026
Status: ❌ Closed
Base:
main← Head:main📝 Commits (3)
32c7ceefeat: implement shared subscription traffic quota across multiple inboundsa52c3fdfix: reliable SubTotal synchronization across identical inboundscb66c1afeat: override traffic statistics with shared subscription quota if available📊 Changes
24 files changed (+375 additions, -46 deletions)
View changed files
📝
database/db.go(+44 -0)📝
database/model/model.go(+1 -0)📝
sub/subService.go(+14 -0)📝
web/assets/js/model/inbound.js(+22 -10)📝
web/controller/inbound.go(+11 -0)📝
web/html/component/aClientTable.html(+9 -1)📝
web/html/form/client.html(+12 -0)📝
web/html/modals/client_bulk_modal.html(+15 -0)📝
web/html/modals/inbound_info_modal.html(+29 -0)📝
web/service/inbound.go(+190 -34)📝
web/translation/translate.ar_EG.toml(+2 -0)📝
web/translation/translate.en_US.toml(+2 -0)📝
web/translation/translate.es_ES.toml(+2 -0)📝
web/translation/translate.fa_IR.toml(+2 -0)📝
web/translation/translate.id_ID.toml(+2 -0)📝
web/translation/translate.ja_JP.toml(+2 -0)📝
web/translation/translate.pt_BR.toml(+2 -0)📝
web/translation/translate.ru_RU.toml(+2 -0)📝
web/translation/translate.tr_TR.toml(+2 -0)📝
web/translation/translate.uk_UA.toml(+2 -0)...and 4 more files
📄 Description
feat: Shared Subscription Traffic Quota across multiple inbounds
What is the pull request?
This PR adds a Shared Subscription Quota feature. It allows administrators to set a single, aggregated traffic limit for multiple client configurations that share the same Subscription ID (
SubID).What users see
SubID, updating the quota for one client automatically synchronizes that limit to all other clients in the same subscription group.Shared Total - Combined Usage of all associated clients).Why this is needed (Feature Goal)
Previously, traffic limits were strictly per-client/per-inbound. If a user was given multiple connection protocols (e.g., VLESS, VMess, Trojan) via the same subscription, there was no way to enforce a combined traffic limit for that user.
This feature enables a "pay-once, use-anywhere" model:
SubID.Which part of the application is affected by the change?
Type of Changes
Technical Implementation Details
Backend
web/service/inbound.go):SyncSubTotalto propagateSubTotalchanges across all database records sharing aSubID.GetSubTrafficto perform high-performance database-level aggregation of stats for subscription groups.web/controller/inbound.go):/panel/inbound/getSubTrafficAPI endpoint.Frontend
inbound_info_modal.html): Integrated dynamic fetch and calculation logic to display shared remaining quota.subTotalfield..tomlfiles withsubTotalFlowandsubTotalFlowDesckeys.Screenshots
Verification
SubID) in the database and UI.SubIDcorrectly calculates the collective remaining quota.SubIDor shared quota continue to work exactly as before without any data loss or logic changes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.