fix(sub): restore client email in panel copy/QR link remark (#5532)

Display-context links (Clients page QR + Information modals and the sub info page) dropped the client email from the link fragment in 3.4.0, showing only the inbound remark. Append the email back so the imported profile keeps its per-client label: inbound-host-email when a host is set, inbound-email otherwise. The usage template stays bypassed in display context, so no traffic or expiry data leaks.
This commit is contained in:
MHSanaei
2026-06-24 15:25:41 +02:00
parent bd60e770f4
commit 5dbd5b1d12
6 changed files with 33 additions and 48 deletions
+8 -15
View File
@@ -1641,24 +1641,17 @@ func (s *SubService) genRemark(inbound *model.Inbound, email string, extra strin
if s.remarkTemplate != "" && s.subscriptionBody {
return s.genTemplatedRemark(inbound, s.lookupClient(inbound, email), extra, transport)
}
// Sub info page + panel link/QR displays: just the config name (no template,
// so no per-client email/usage leaks into the shown remark).
return fallbackRemark(inbound.Remark, extra)
return fallbackRemark(inbound.Remark, extra, email)
}
// fallbackRemark is the minimal remark used only when no template is configured
// (an operator explicitly cleared it): the inbound remark and the host/extra
// remark joined by "-", skipping empties. The configurable remark model was
// removed in favour of the template, whose default already includes the email.
func fallbackRemark(inboundRemark, extra string) string {
switch {
case inboundRemark == "":
return extra
case extra == "":
return inboundRemark
default:
return inboundRemark + "-" + extra
func fallbackRemark(parts ...string) string {
out := make([]string, 0, len(parts))
for _, p := range parts {
if p != "" {
out = append(out, p)
}
}
return strings.Join(out, "-")
}
// findClientStats returns the inbound's traffic record for email, if present.