3x-ui/sub
MHSanaei a038ad6135
fix(sub): multi-inbound traffic + trojan/hysteria userinfo + utf-8 vmess remark
Three bugs surfaced by the new SubPage and the recent client-record
refactor:

- xray.ClientTraffic.Email is globally unique, so a multi-inbound
  client has exactly one traffic row attached to whichever inbound
  claimed it. Iterating inbound.ClientStats per inbound dedup-locked
  the first lookup to zero for clients that lived under any other
  inbound, so the SubPage info table read 0 B for all the multi-
  inbound subs. Replaced appendUniqueTraffic with a single
  AggregateTrafficByEmails(emails) helper that runs one WHERE email
  IN (?) over xray.ClientTraffic and folds the rows. GetSubs /
  SubClashService.GetClash / SubJsonService.GetJson all share it.

- Trojan and Hysteria share-links embedded the raw password/auth into
  the userinfo (scheme://<value>@host) without percent-encoding, so
  passwords containing `/` or `=` (e.g., base64-with-padding) broke
  popular trojan clients with parse errors. Added encodeUserinfo()
  that wraps url.QueryEscape and rewrites the `+` (space) back to
  `%20` for parity with encodeURIComponent on the frontend; applied
  to trojan.password and hysteria.auth. Same fix on the frontend's
  genTrojanLink.

- VMess link remarks ride inside a base64-encoded JSON payload, but
  the SubPage / ClientInfoModal parser used JSON.parse(atob(body)),
  which treats the binary string as Latin-1 and shreds any multi-byte
  UTF-8 sequence. Most visible on the emoji decorations
  (genRemark appends 📊/), so a remark like `test-1.00GB📊` rendered
  as `test-1.00GBð…`. Routed through Uint8Array +
  TextDecoder('utf-8') so multi-byte codepoints survive.
2026-05-27 04:22:51 +02:00
..
default.json dokodemo-door, socks renamed to mixed, tunnel 2025-09-09 13:57:40 +02:00
dist.go feat(inbounds): add sub/client link endpoints; hide panel version on login 2026-05-11 15:03:47 +02:00
links.go feat(sub): compact subscription rows with per-link email + PQ QR hide 2026-05-27 03:11:59 +02:00
links_test.go Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00
sub.go Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00
subClashService.go fix(sub): multi-inbound traffic + trojan/hysteria userinfo + utf-8 vmess remark 2026-05-27 04:22:51 +02:00
subClashService_test.go fix: address open bug reports (#4539, #4538, #4535, #4531, #4515) (#4545) 2026-05-25 00:08:06 +02:00
subController.go feat(sub): compact subscription rows with per-link email + PQ QR hide 2026-05-27 03:11:59 +02:00
subJsonService.go fix(sub): multi-inbound traffic + trojan/hysteria userinfo + utf-8 vmess remark 2026-05-27 04:22:51 +02:00
subService.go fix(sub): multi-inbound traffic + trojan/hysteria userinfo + utf-8 vmess remark 2026-05-27 04:22:51 +02:00
subService_test.go fix: address open bug reports (#4539, #4538, #4535, #4531, #4515) (#4545) 2026-05-25 00:08:06 +02:00