mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5998] [Bug]: "Remark Template" is only applied to the first inbound in subscription #4154
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#4154
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 @vwelsonf on GitHub (Jul 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5998
Describe the bug
Describe the bug
The "Remark Template" setting in the panel settings/subscription section only applies to the very first inbound link generated in the subscription. All subsequent inbound links in the same subscription ignore this template and fall back to the default format or ignore the setting entirely.
According to the description, this template should replace the remark model for each subscription link.
Actual result
Expected behavior
The "Remark Template" format should be applied to all inbound links within the subscription, not just the first one.
Panel Version
v3.5.0
How to reproduce the problem
{{INBOUND}}).Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.5.0
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 22.04
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jul 16, 2026):
Confirmed the underlying mechanism in the source, with one open question about your exact template that I need answered to be certain it's the whole story.
Title: Remark Template's usage/expiry/identity tokens are dropped after a client's first link in a multi-inbound subscription, contradicting the setting's own description
Severity: Medium
Category: Correctness / Documentation
Why this matters: In
internal/sub/remark_vars.go, every body link goes throughgenTemplatedRemark(line 581) ->effectiveTemplate(email)(line 557):The first link generated for a given client
emailin the request gets the full template. Every later link for that same email is passed throughfirstLinkOnlyBodyTokens(defined lines 468-491), which strips{{EMAIL}}/{{USERNAME}}plus every usage/expiry/status token (TRAFFIC_LEFT,TRAFFIC_TOTAL,DAYS_LEFT,STATUS,TIME_LEFT, etc.).{{INBOUND}},{{HOST}},{{PROTOCOL}},{{TRANSPORT}}and{{SECURITY}}are not in that set and render on every link (seeTestConnectionTokensOnEveryBodyLinkand the final assertion ofTestEmailOnFirstLinkOnlyininternal/sub/remark_vars_test.go).This is intentional — added by commit
876d55f("show{{EMAIL}}on first sub-body link only", shipped in v3.4.2 onward, so it's present in your v3.5.0) on top of an earlier traffic-only restriction. It is not an edge case for multi-inbound subscriptions:Client.Emailis globally unique at the DB level (ClientRecord.Email,internal/database/model/model.go:828), and the panel's only way to put one client on several inbounds is attaching that same client (clientsrow,client_inboundsjoin table,internal/web/service/client_link.go:210-236) to each inbound — so every client with more than one inbound in its subscription hits this path.The problem: this silently contradicts what the panel promises. The setting's own description (
internal/web/translation/en-US.json:1260) reads "When set, this replaces the remark model for every subscription link," and the docs (docs/content/docs/en/config/share-links.mdx) only document the separate display/QR-view stripping, not this per-email body stripping. Two other reports already ran into this same mechanism: #5618 (closed without a code change) and #5659 (open, asking specifically to revert or make the{{EMAIL}}half optional).Recommendation: Either (a) correct the setting description and docs to state that identity/usage tokens render on a client's first subscription-body link only while structural tokens (
{{INBOUND}},{{HOST}},{{PROTOCOL}},{{TRANSPORT}},{{SECURITY}}) render on every link, or (b) make it configurable — a toggle that bypassesfirstLinkOnlyBodyTokens(internal/sub/remark_vars.go:488) for operators who want the full template repeated on every link, as already requested in #5659. No code change will be made unless a maintainer requests it.Confidence: High on the mechanism and that it's the most likely explanation, given the panel's data model makes shared emails across a multi-inbound subscription the normal case, not an exception.
One thing the source alone can't settle: your reproduction uses
{{INBOUND}}as the example template, and{{INBOUND}}by itself is never stripped by this mechanism — with a template of literally just{{INBOUND}}, every link should already show that link's own inbound name. If your actual configured template also includes{{EMAIL}},{{TRAFFIC_LEFT}},{{DAYS_LEFT}},{{STATUS}}, or similar (as the built-in default does), the behavior above is what you're seeing — later links keep the inbound name but drop those other parts. To close the loop, could you provide:@MHSanaei for a decision on whether to fix the docs, add a toggle, or both.
This reply was generated automatically; a maintainer may follow up.