mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6163] [MERGED] feat(sub): add template variables to subscription metadata (title, support and profile URLs, announcement) #6125
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#6125
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/6163
Author: @isultanov99
Created: 7/30/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @MHSanaei
Base:
main← Head:subscription-metadata-placeholders📝 Commits (1)
cd00a55feat(sub): add template variables to subscription metadata📊 Changes
22 files changed (+457 additions, -108 deletions)
View changed files
📝
frontend/src/components/form/RemarkTemplateField.tsx(+53 -24)📝
frontend/src/components/form/RemarkVarPicker.tsx(+5 -3)📝
frontend/src/lib/remark/remarkVariables.ts(+16 -3)📝
frontend/src/pages/settings/SubscriptionGeneralTab.tsx(+24 -7)📝
frontend/src/test/remark-template-field.test.tsx(+29 -0)📝
internal/sub/controller.go(+27 -19)➕
internal/sub/placeholders.go(+118 -0)➕
internal/sub/placeholders_test.go(+132 -0)📝
internal/sub/service.go(+1 -0)📝
internal/web/translation/ar-EG.json(+4 -4)📝
internal/web/translation/en-US.json(+4 -4)📝
internal/web/translation/es-ES.json(+4 -4)📝
internal/web/translation/fa-IR.json(+4 -4)📝
internal/web/translation/id-ID.json(+4 -4)📝
internal/web/translation/ja-JP.json(+4 -4)📝
internal/web/translation/pt-BR.json(+4 -4)📝
internal/web/translation/ru-RU.json(+4 -4)📝
internal/web/translation/tr-TR.json(+4 -4)📝
internal/web/translation/uk-UA.json(+4 -4)📝
internal/web/translation/vi-VN.json(+4 -4)...and 2 more files
📄 Description
Summary
This adds opt-in template variables to subscription metadata fields:
The goal is to let operators personalize the text and links that VPN clients show around a subscription, without changing the generated proxy links themselves. The metadata picker is intentionally limited to stable client identity tokens:
{{EMAIL}},{{ID}},{{SHORT_ID}},{{SUB_ID}}, and{{TELEGRAM_ID}}.Why
These fields are useful places for support and account-context links.
A private network can show a friendly title per user and open a pre-filled support chat that already includes the client subscription ID.
The same pattern also works for larger deployments that route support requests through Telegram, WhatsApp, or a helpdesk form.
Examples
your_own_vpn — {{EMAIL}}https://t.me/your_own_vpn_support?text=Hello!%20I%27ve%20got%20a%20problem.%20My%20Subscription%20ID%20is%20{{SUB_ID}}https://wa.me/your_own_vpn_support?text=Hello!%20I%27ve%20got%20a%20problem.%20My%20Subscription%20ID%20is%20{{SUB_ID}}https://yourownvpn.com/account/{{ID}}Implementation Notes
{{IMPORTANT}}is preserved while per-inbound, traffic, time, or connection fields are not expanded into profile headers or support URLs.Testing
go test ./internal/subgo build ./...cd frontend && ./node_modules/.bin/tsc --noEmitcd frontend && npm exec eslint -- src/components/form/RemarkTemplateField.tsx src/components/form/RemarkVarPicker.tsx src/lib/remark/remarkVariables.ts src/pages/settings/SubscriptionGeneralTab.tsx src/test/remark-template-field.test.tsxcd frontend && CI=1 STORYBOOK_DISABLE_TELEMETRY=1 npm run test -- --run src/test/remark-template-field.test.tsx --pool=forks --testTimeout=30000cd frontend && npm run build🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.