mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #7046] feat(sub): support inbound-level traffic quota variables in remark template #6617
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#6617
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/7046
Author: @DoctorGuidance
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:feat/sub-inbound-traffic-variables📝 Commits (2)
09f32b8feat(sub): support inbound-level traffic quota variables in remark template (#6720)c325d75fix(sub): keep inbound tokens on each link and preserve under info node📊 Changes
17 files changed (+336 additions, -33 deletions)
View changed files
📝
frontend/src/lib/remark/remarkVariables.ts(+8 -0)📝
internal/sub/remark_vars.go(+92 -18)📝
internal/sub/remark_vars_test.go(+110 -1)📝
internal/web/translation/ar-EG.json(+9 -1)📝
internal/web/translation/en-US.json(+9 -1)📝
internal/web/translation/es-ES.json(+9 -1)📝
internal/web/translation/fa-IR.json(+9 -1)📝
internal/web/translation/id-ID.json(+9 -1)📝
internal/web/translation/ja-JP.json(+9 -1)📝
internal/web/translation/pt-BR.json(+9 -1)📝
internal/web/translation/ru-RU.json(+9 -1)📝
internal/web/translation/sk-SK.json(+9 -1)📝
internal/web/translation/tr-TR.json(+9 -1)📝
internal/web/translation/uk-UA.json(+9 -1)📝
internal/web/translation/vi-VN.json(+9 -1)📝
internal/web/translation/zh-CN.json(+9 -1)📝
internal/web/translation/zh-TW.json(+9 -1)📄 Description
Summary
This PR introduces support for Inbound-level aggregated traffic quota variables in the subscription remark template and frontend Remark Variable Picker, addressing #6720.
Problem
In multi-user shared setups (e.g. family, office, or small team VPS deployments sharing an inbound with a monthly bandwidth allowance), administrators often set the traffic limit on the Inbound itself rather than configuring rigid per-client quotas (clients remain unlimited with
totalGB = 0).Previously, subscription remark template variables (
{{TRAFFIC_TOTAL}},{{TRAFFIC_LEFT}},{{TRAFFIC_USED}}) only reflected individual client-level statistics. Because client quotas were unset, subscription clients consistently showed "Unlimited" traffic even when the underlying Inbound had a strict quota pool, preventing users from seeing shared inbound usage and remaining allowance.Solution
{{INBOUND_TRAFFIC_USED}}: Human-readable used traffic on the Inbound (Up + Down).{{INBOUND_TRAFFIC_LEFT}}: Remaining traffic on the Inbound before reachingInbound.Total(renders∞and cleanly drops in pipe-separated segments if the Inbound has no quota).{{INBOUND_TRAFFIC_TOTAL}}: Inbound total quota limit (renders∞if unlimited).{{INBOUND_TRAFFIC_USED_BYTES}},{{INBOUND_TRAFFIC_LEFT_BYTES}},{{INBOUND_TRAFFIC_TOTAL_BYTES}}: Raw integer byte representations.{{INBOUND_UP}},{{INBOUND_DOWN}}: Inbound upload and download traffic.uiTokenMap(e.g.{INBOUND_TRAFFIC_LEFT}->{{INBOUND_TRAFFIC_LEFT}}).REMARK_VARIABLESunder thetrafficcategory infrontend/src/lib/remark/remarkVariables.ts.pages.hosts.remarkVarsacross all 14 embedded locale JSON files.Related Issues
Testing
internal/sub/remark_vars_test.go(TestExpandRemarkVarsand edge cases inTestExpandRemarkVars_EdgeCases).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.