mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6029] Subscription: {{EMAIL}} in remark only shown on a client's first link, not every inbound/node #4174
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#4174
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 @acidmsg on GitHub (Jul 18, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6029
Description
In a multi-node setup, subscription links for node-hosted inbounds are generated without the client email in the remark, while master-hosted inbounds include it correctly.
Steps to reproduce
{{EMAIL}}subEmailInRemark: trueon both panelsActual result
Master inbound link includes email in remark.
Node inbound link does NOT include email — only inbound name.
Expected result
Both master and node inbound links include email in remark.
Environment
@github-actions[bot] commented on GitHub (Jul 18, 2026):
This is expected behavior, not a defect specific to node-hosted inbounds — closing as not planned, with the reasoning below. I've also retitled the issue since the original title attributes this to node-hosting specifically, which isn't the actual cause.
Root cause
{{EMAIL}}(and{{USERNAME}}) is deliberately emitted only on a client's first link within a subscription response; it is stripped from every link generated after that for the same client, regardless of which inbound — master or node — produces it:firstLinkOnlyBodyTokensininternal/sub/remark_vars.go:484-491listsEMAIL/USERNAMEalongside the usage tokens as tokens dropped "from every subscription-body link after a client's first one."effectiveTemplate(internal/sub/remark_vars.go:557-567) tracks this per email vias.usageShown: the first call for a given email returns the full template; every later call for that same email returns the filtered one./sub/,/json/,/clash/) — see the doc comment onSubService.subscriptionBody,internal/sub/service.go:34-39: "the remark template's per-client info is emitted there (on the first link); every other context ... renders the name-only template."TestIdentityTokenBodyVsDisplay(internal/sub/remark_vars_test.go:377-397), which asserts that a second call for the same client (even on the same single inbound) drops{{EMAIL}}. This confirms the dedup is about link order within the subscription, not master vs. node.Why it looked node-specific
Node-hosted inbounds are not served through a separate code path. They are ordinary rows in the master panel's own
inboundstable —NodeIDis just a nullable FK (internal/database/model/model.go:68) — andgetInboundsBySubId(internal/sub/service.go:459-476) pulls every inbound attached to the client's subscription, master- and node-hosted alike, in one query orderedsub_sort_index ASC, id ASC. OneSubServiceinstance then generates every link for that subscription, sharing a singleusageShownmap. Whichever inbound sorts first for that client keeps{{EMAIL}}; every later one loses it. In your setup the master inbound apparently sorts ahead of the node inbound (lower Sub Sort Index or ID) — the same thing would happen with two ordinary inbounds on the master alone if one client were attached to both.NodeIDplays no role in remark generation; it's only used to resolve the link's host address (resolveInboundAddress,internal/sub/service.go:1139-1156).On
subEmailInRemarkThat exact setting name does not exist in v3.5.0. The current mechanism is the free-form
remarkTemplatesetting (Panel → Settings → Subscription), using the{{EMAIL}}token — which is what you're already using correctly. There is no toggle today to force{{EMAIL}}onto every link of a multi-inbound/multi-node subscription; the first-link-only rule was added specifically to stop the email repeating on every link of one subscription (see #4895), so making it unconditional again for node-hosted inbounds would reopen that complaint for setups with several node-hosted inbounds in one subscription.Minor documentation gap
docs/content/docs/en/config/share-links.mdx:70-75documents that usage tokens are limited to the first link in the body, but doesn't mention{{EMAIL}}/{{USERNAME}}follow the same rule. I've added thedocumentationlabel for that.@MHSanaei flagging for awareness in case a "show identity on every link" template option is worth adding as a separate enhancement.
This reply was generated automatically by an AI agent. A maintainer may follow up.