mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6763] [Feature]: Conditional remark templates for limited and unlimited clients #4504
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#4504
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 @nxabc on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6763
Is your feature request related to a problem?
Yes.
The current subscription remark template looks inconsistent depending on whether traffic and expiration limits are enabled.
For example, when limits are enabled:
This contains useful information, but the remark can become quite long and may be truncated in some proxy clients.
When traffic and expiration limits are disabled, the remaining traffic and expiration fields disappear, leaving only something like:
This looks too short and visually empty.
So the same template can be too long in one situation and too short in another, which affects readability and overall appearance.
Describe the solution you'd like
I would like the remark template system to support conditional display logic based on whether traffic and expiration limits are enabled.
The goal is to let users freely combine existing variables such as:
depending on the client status.
For example:
When traffic and expiration limits are disabled:
Another possible layout could be:
This shows why a general conditional mechanism would be more useful than adding one hard-coded variable.
A possible syntax could be:
The exact syntax is not important. The key requirement is that the same remark template can produce different layouts automatically depending on whether traffic or expiration limits are enabled.
Expected behavior:
-,|, icons, and text should be user-defined.This would allow many different combinations and greatly improve the flexibility, readability, visual consistency, and overall appearance of subscription remarks.
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?
Before submitting
@github-actions[bot] commented on GitHub (Oct 7, 2026):
This is a valid feature request. The remark template has no conditional (
if / else) syntax today. All it can do with a limit is hide it: a|-separated segment that holds nothing but an unlimited quota or expiry is dropped. So✅Tom|📊85GB|⏳30Dturns into✅Tom, and nothing can be shown in its place.How it works now, from
internal/sub/remark_vars.go:expandRemarkVars(line 133) splits the template on|and expands each segment on its own:segments := strings.Split(template, "|"). Its doc comment states the intent: "an unlimited client gets "host" instead of "host|📊∞|⏳∞D"."expandSegment(line 163) drops a segment when every token in it is empty or renders∞. That only applies to the tokens inunlimitedDropTokens(lines 71-76):TRAFFIC_LEFT,TRAFFIC_TOTAL,DAYS_LEFTandTIME_LEFT.`\{\{([A-Z_]+)\}\}`(line 41), andremarkVarValue(lines 193-290) has no condition or branch tokens. An unknown token such as{{IF_TRAFFIC_LIMITED}}resolves to""(line 127: "Unknown tokens resolve to "" (never the literal text)").What you can do today: separators already behave the way you want. Dropped
|segments leave no stray|, and a-between two tokens is removed when one side is empty (lines 155-162). Only the unlimited/limited swap is missing. For example, this template:gives
✅美国-VLESS+Reality-Tomfor an unlimited client and✅美国-VLESS+Reality-Tom|📊85GB|⏳30Dfor a limited one. The limited form is longer, which is the trade-off you describe. No current template can show{{INBOUND}}only when a client is unlimited.What the feature would need: a conditional block in
expandRemarkVars, evaluated before the|split. It would need at least two conditions: traffic limited (Total > 0) and expiry limited (ExpiryTime != 0). Existing templates would stay unchanged as long as they contain no block. Any new syntax also has to pass throughfilterRemarkTemplate(line 555), which strips usage tokens for some display contexts. It would also need to be reflected in the frontend token help and in the docs.I found no earlier request for this. Related but different issues about the remark template: #5443, #5998, #5618.
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.