feat(sub): add dynamic remark variables with Jalali date, transport, and status tokens (#5430)

* feat(sub): implement dynamic single-bracket remark variables with timezone-aware inline Jalali conversion

* Update .gitignore

* Update .gitignore

* merge: bring in origin/main commits to resolve conflict base

* fix(sub): address review issues in dynamic remark variables

- Add TIME_LEFT to unlimitedDropTokens so segments containing only
  {TIME_LEFT} are dropped for unlimited clients (same as DAYS_LEFT)
- Remove dead uiSingleBraceRe variable (translateUISingleBrackets uses
  a character scanner, not this regex)
- Change expireDateLabel to use time.Local instead of UTC, consistent
  with jalaliExpireDateLabel

Co-authored-by: Sanaei <MHSanaei@users.noreply.github.com>

* fix

* fix

---------

Co-authored-by: MHSanaei <MHSanaei@users.noreply.github.com>
This commit is contained in:
wahh3b-lgtmandSanaei authored and GitHub committed 2026-06-21 02:00:27 +02:00 Unverified
1 parent ce1d348ece
commit 605e90dbf0
11 files changed
+447 -56

No files matched your search

+2 -1
View File
@@ -43,4 +43,5 @@ system_metrics.gob
docker-compose.override.yml
# Ignore .env (Environment Variables) file
.env
.env
+10
View File
@@ -222,6 +222,10 @@
"description": "Encrypt subscription responses",
"type": "boolean"
},
"subHideSettings": {
"description": "Hide server settings in happ subscription (Only for Happ)",
"type": "boolean"
},
"subJsonEnable": {
"description": "Enable JSON subscription endpoint",
"type": "boolean"
@@ -439,6 +443,7 @@
"subEnable",
"subEnableRouting",
"subEncrypt",
"subHideSettings",
"subJsonEnable",
"subJsonFinalMask",
"subJsonMux",
@@ -698,6 +703,10 @@
"description": "Encrypt subscription responses",
"type": "boolean"
},
"subHideSettings": {
"description": "Hide server settings in happ subscription (Only for Happ)",
"type": "boolean"
},
"subJsonEnable": {
"description": "Enable JSON subscription endpoint",
"type": "boolean"
@@ -922,6 +931,7 @@
"subEnable",
"subEnableRouting",
"subEncrypt",
"subHideSettings",
"subJsonEnable",
"subJsonFinalMask",
"subJsonMux",
+6 -5
View File
@@ -163,13 +163,14 @@ func (s *SubClashService) getProxies(subReq *SubService, inbound *model.Inbound,
}}
}
delete(stream, "externalProxy")
network, _ := stream["network"].(string)
proxies := make([]map[string]any, 0, len(externalProxies))
for _, ep := range externalProxies {
extPrxy := ep.(map[string]any)
// Expand the host's {{VAR}} remark template for this client (no-op for
// the synthetic/legacy entry) before it becomes the proxy name.
subReq.renderHostRemark(inbound, client, extPrxy)
subReq.renderHostRemark(inbound, client, extPrxy, network)
workingInbound := *inbound
workingInbound.Listen = extPrxy["dest"].(string)
workingInbound.Port = int(extPrxy["port"].(float64))
@@ -214,14 +215,14 @@ func (s *SubClashService) buildProxy(subReq *SubService, inbound *model.Inbound,
return s.buildHysteriaProxy(subReq, inbound, client, ep)
}
network, _ := stream["network"].(string)
proxy := map[string]any{
"name": subReq.endpointRemark(inbound, client.Email, ep),
"name": subReq.endpointRemark(inbound, client.Email, ep, network),
"server": inbound.Listen,
"port": inbound.Port,
"udp": true,
}
network, _ := stream["network"].(string)
if !s.applyTransport(proxy, network, stream) {
return nil
}
@@ -298,7 +299,7 @@ func (s *SubClashService) buildHysteriaProxy(subReq *SubService, inbound *model.
}
proxy := map[string]any{
"name": subReq.endpointRemark(inbound, client.Email, ep),
"name": subReq.endpointRemark(inbound, client.Email, ep, "quic"),
"type": proxyType,
"server": inbound.Listen,
"port": inbound.Port,
Loaded 3 of 11 files, more files were not shown because too many files have changed in this diff. Show more