mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6098] [Bug]: [Regression 3.5.0] Client remark suffix is applied only to first inbound in multi-inbound subscription #4215
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#4215
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 @x-ander-t on GitHub (Jul 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6098
Describe the bug
Regression after update to 3.5.0
When generating a subscription containing multiple inbounds for one client, the client remark suffix is appended only to the first inbound.
Example client:
iPhone-AT
Expected:
vless-tls-cascade-iPhone-AT
vless-reality-cascade-iPhone-AT
hysteria2-cascade-iPhone-AT
vless-tls-direct-iPhone-AT
vless-reality-direct-iPhone-AT
hysteria2-direct-iPhone-AT
Actual:
vless-tls-cascade-iPhone-AT
vless-reality-cascade
hysteria2-cascade
vless-tls-direct
vless-reality-direct
hysteria2-direct
The issue occurs in both:
Environment
3x-ui:
3.5.0
Xray-core:
26.7.11
Impact
When multiple users have similar inbound names, profiles become indistinguishable.
This makes multi-client subscription management difficult.
Expected behavior
The client remark should be applied to every generated subscription item.
How to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.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
@embyinfuse-debug commented on GitHub (Jul 25, 2026):
生成的配制 不能用呀!
@x-ander-t commented on GitHub (Jul 25, 2026):
Only happens when template is not empty. For an empty template works properly. But for example, this template {{INBOUND}}-{{EMAIL}} for “email=iPhone-AT-happy” gives the attached screenshot.
@MHSanaei commented on GitHub (Jul 25, 2026):
@claude
@github-actions[bot] commented on GitHub (Jul 25, 2026):
Claude finished @MHSanaei's task in 3m 34s —— View job
Confirmed:
{{EMAIL}}is stripped from every link after a client's first oneThis is not specific to the first inbound — it is the first link generated for that client email in the subscription response. Everything after it loses the identity tokens.
Root cause
internal/sub/remark_vars.go:488-491putsEMAIL/USERNAMEin the same bucket as the usage tokens:effectiveTemplate(internal/sub/remark_vars.go:557-567) applies that set to every link after the first, tracked per email ins.usageShown:usageShownis per request (internal/sub/service.go:98), and oneSubServicerenders every link of the subscription, so whichever inbound sorts first for that client —Order("sub_sort_index ASC").Order("id ASC")ingetInboundsBySubId,internal/sub/service.go:470— keeps the email and the rest do not. That is exactly the screenshot:vless-tls-cascade-iPhone-AT-happ, then bare names.It only affects the subscription body (
subscriptionBody == true: raw/sub,/json,/clash). The panel link/QR display path usesdisplayRemoveTokens(internal/sub/remark_vars.go:482), which does not containEMAIL, so the email still shows there — hence the inconsistency you see between the panel and the imported profiles.Your observation about the empty template is also explained: with no template,
genHostRemark(internal/sub/remark_vars.go:606-611) takes thefallbackRemark(inbound.Remark, hostRemark, client.Email)branch (internal/sub/service.go:1883), which appends the email unconditionally to every link.Where it came from
Commit
876d55f2"fix(sub): show {{EMAIL}} on first sub-body link only" (2026-06-27), requested in #5659.git tag --contains 876d55f2reportsv3.4.2andv3.5.0, so the change is present since v3.4.2; upgrading from v3.4.1 or older to v3.5.0 surfaces it as a v3.5.0 regression. Since the shipped default template is{{INBOUND}}-{{EMAIL}}|📊{{TRAFFIC_LEFT}}|⏳{{DAYS_LEFT}}D(internal/web/service/setting.go:39), every default install with a client on several inbounds is affected. The same report came in as #6029.Fix
Restore the identity tokens on every body link, leaving the usage tokens first-link-only as before. In
internal/sub/remark_vars.go, delete thefirstLinkOnlyBodyTokensblock (lines 484-491, comment included) so the file reads:and in
effectiveTemplate(line 563):Two tests pin the current behavior and must be inverted.
internal/sub/remark_vars_test.go:627-655— replaceTestEmailOnFirstLinkOnlywith:internal/sub/remark_vars_test.go:387-391— inTestIdentityTokenBodyVsDisplay, the body half asserts the opposite of the desired behavior:No other test references the identity tokens across multiple links (
export_all_links_test.gogenerates a single link), anddocs/content/docs/en/config/share-links.mdxdocuments the first-link-only rule for usage tokens only, so no doc change is needed.One decision for you
PR #5935 is open and takes the other route: a
subShowIdentityOnAllLinkssetting defaulting tofalse. With that default, a fresh install still produces exactly what is reported here, and #5659 (the request behind876d55f2) is satisfied by an opt-in either way. If you prefer the setting over the plain revert, defaulting it totruecovers both this report and #5659.I could not execute
go test ./internal/sub/in this run (command not permitted), so the fix above is derived from reading the code path rather than from a local test run. This workflow only investigates and replies; it does not commit or open pull requests.@MHSanaei commented on GitHub (Jul 27, 2026):
Fixed in
c004c18d.You were right that it is a regression, and your follow-up about the empty template was the clue that identified it. It is not per-inbound but per-client:
876d55f2putEMAIL/USERNAMEinto the same first-link-only bucket as the usage tokens, so whichever inbound sorts first for that client keeps the identity and every later link is stripped. With no template configured a different code path runs, which appends the email unconditionally — hence "works properly for an empty template".The two token groups are not alike. The usage block repeats the same numbers on every link, so showing it once is reasonable. The identity is what tells one imported profile from another, which is the whole point of putting it in the name.
{{EMAIL}}and{{USERNAME}}are now kept on every subscription-body link; the usage tokens stay first-link-only, unchanged.This also covers #6029 and #5659, which asked for the same thing.
Since the shipped default template is
{{INBOUND}}-{{EMAIL}}|📊{{TRAFFIC_LEFT}}|⏳{{DAYS_LEFT}}D, every default install with a client on several inbounds was affected. It will be in the next release; clients need to re-fetch the subscription to pick up the new names.@MHSanaei commented on GitHub (Jul 27, 2026):
Correction: I was wrong to treat this as a regression, and I have reverted the change in
fd17255f.Showing
{{EMAIL}}/{{USERNAME}}on the first subscription-body link only is deliberate, not an oversight in876d55f2. All links in a single-client subscription carry the same email, so it is treated like the traffic block — shown once, to keep remarks short for operators with many inbounds per subscription. My earlier comment read the intent backwards. Sorry for the noise, and for the churn to anyone who saw the panel behave differently in the meantime.That leaves the underlying request, which is legitimate: some operators do want the identity on every link so profiles stay distinguishable in the client app when several clients share inbound names. The route for that is a setting rather than flipping the default for everyone, and #5935 is exactly that — it adds
subShowIdentityOnAllLinks. If this matters to your deployment, that PR is the place to say so.Until it lands, a template that puts something client-specific outside the identity tokens gives you distinguishable names on every link. For example
{{INBOUND}}-{{SUB_ID}}or{{INBOUND}}-{{SHORT_ID}}, sinceSUB_IDandSHORT_IDare not in the first-link-only set.Closing as intended behaviour. cc @x-ander-t @embyinfuse-debug