[GH-ISSUE #5659] [Feature]: show {{EMAIL}} on first sub-body link only #3941

Closed
opened 2026-10-31 20:36:03 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ArrayKamko on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5659

Please revert this commit: github.com/MHSanaei/3x-ui@876d55f274 to the previous state! Or add an option so that when it's enabled, the Email is displayed for all links!

Describe the solution you'd like

Please revert this commit to the previous state! Or add an option so that when it's enabled, the Email is displayed for all links!

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @ArrayKamko on GitHub (Jun 29, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5659 ### Is your feature request related to a problem? Please revert this commit: https://github.com/MHSanaei/3x-ui/commit/876d55f2741bed1c3ea62fa328312947ceed05be to the previous state! Or add an option so that when it's enabled, the Email is displayed for all links! ### Describe the solution you'd like Please revert this commit to the previous state! Or add an option so that when it's enabled, the Email is displayed for all links! ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:36:03 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 29, 2026):

The behavior you are describing is intentional in the current codebase and was introduced by the commit you referenced. Here is exactly what it does and why.

What the code does

internal/sub/remark_vars.go defines firstLinkOnlyBodyTokens (line 491), which is a set containing all usage/info tokens (TRAFFIC_LEFT, TRAFFIC_USED, DAYS_LEFT, etc.) plus EMAIL and USERNAME. The effectiveTemplate() function (lines 560–569) applies this filter: after the first link is emitted for a given client email, every subsequent link for that same client goes through filterRemarkTemplate(translated, firstLinkOnlyBodyTokens), which strips {{EMAIL}} and {{USERNAME}} from the remark template. The first link carries the email; all following links do not.

This is the test that documents the intended contract: TestEmailOnFirstLinkOnly in internal/sub/remark_vars_test.go (line 614).

The design rationale

All links in a single-client subscription share the same email, so repeating it on every link provides no extra information to a client app — it is treated the same as traffic statistics, which are also shown on the first link only. The intent was to reduce remark noise for users with many inbounds per subscription.

Your request

The request for a configurable option — e.g. a toggle that, when enabled, keeps {{EMAIL}} on every link regardless of position — is reasonable. There is currently no such setting; the behavior is hardcoded in effectiveTemplate(). Adding a SubService field (loaded from a panel setting) that, when set, bypasses the firstLinkOnlyBodyTokens filter for identity tokens while still applying it to usage tokens would address the use case without a full revert. The alternative, reverting the entire commit, would also restore the per-link traffic stats on every link, which was the original motivation for the change.

If you or someone else wants to open a PR, the relevant code is entirely in internal/sub/remark_vars.go (effectiveTemplate, firstLinkOnlyBodyTokens) and the setting would need to be loaded in internal/sub/service.go from the panel settings (see how remarkTemplate is already loaded there).

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4833304742 --> @github-actions[bot] commented on GitHub (Jun 29, 2026): The behavior you are describing is intentional in the current codebase and was introduced by the commit you referenced. Here is exactly what it does and why. **What the code does** `internal/sub/remark_vars.go` defines `firstLinkOnlyBodyTokens` (line 491), which is a set containing all usage/info tokens (`TRAFFIC_LEFT`, `TRAFFIC_USED`, `DAYS_LEFT`, etc.) **plus** `EMAIL` and `USERNAME`. The `effectiveTemplate()` function (lines 560–569) applies this filter: after the first link is emitted for a given client email, every subsequent link for that same client goes through `filterRemarkTemplate(translated, firstLinkOnlyBodyTokens)`, which strips `{{EMAIL}}` and `{{USERNAME}}` from the remark template. The first link carries the email; all following links do not. This is the test that documents the intended contract: `TestEmailOnFirstLinkOnly` in `internal/sub/remark_vars_test.go` (line 614). **The design rationale** All links in a single-client subscription share the same email, so repeating it on every link provides no extra information to a client app — it is treated the same as traffic statistics, which are also shown on the first link only. The intent was to reduce remark noise for users with many inbounds per subscription. **Your request** The request for a configurable option — e.g. a toggle that, when enabled, keeps `{{EMAIL}}` on every link regardless of position — is reasonable. There is currently no such setting; the behavior is hardcoded in `effectiveTemplate()`. Adding a `SubService` field (loaded from a panel setting) that, when set, bypasses the `firstLinkOnlyBodyTokens` filter for identity tokens while still applying it to usage tokens would address the use case without a full revert. The alternative, reverting the entire commit, would also restore the per-link traffic stats on every link, which was the original motivation for the change. If you or someone else wants to open a PR, the relevant code is entirely in `internal/sub/remark_vars.go` (`effectiveTemplate`, `firstLinkOnlyBodyTokens`) and the setting would need to be loaded in `internal/sub/service.go` from the panel settings (see how `remarkTemplate` is already loaded there). *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@moshkinura commented on GitHub (Jul 6, 2026):

I agree with that.

<!-- gh-comment-id:4896631398 --> @moshkinura commented on GitHub (Jul 6, 2026): I agree with that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3941
No description provided.