3x-ui/frontend/src/test
MHSanaei 9de527b35f
feat(frontend): link import on outbound modal (vmess/vless/trojan/ss/hy2)
The legacy outbound modal could import a vmess://, vless://, trojan://,
ss://, or hysteria2:// share link via a Convert button on the JSON
tab. Restore that UX with a focused pure-function parser.

lib/xray/outbound-link-parser.ts:
- parseVmessLink: base64 JSON, maps net/tls + per-network params onto
  the discriminated stream branch.
- parseVlessLink: standard URL with type/security/sni/pbk/sid/fp/flow
  query params, dispatches transport via buildStream + applies
  security params via applySecurityParams.
- parseTrojanLink: same URL pattern, defaults security to tls.
- parseShadowsocksLink: both modern (base64 userinfo@host:port) and
  legacy (base64 of whole thing) ss:// formats.
- parseHysteria2Link: accepts both hysteria2:// and hy2:// schemes,
  uses the hysteria stream branch with version=2 + TLS h3.
- parseOutboundLink dispatcher returns the first non-null parser
  result, or null when no scheme matches.

test/outbound-link-parser.test.ts:
- 13 cases covering happy paths for each protocol family plus malformed
  input, ss:// dual-format handling, hy2:// alias.

OutboundFormModal.tsx:
- Import button on the JSON tab Input.Search; on success, parsed
  payload flows through rawOutboundToFormValues, the form is reset,
  and we switch back to the Basic tab.
- Tag is preserved when the parsed link does not carry one.

Out of scope: advanced fields the legacy parser handled (xmux, padding
obfs, reality short IDs, finalmask from fm= param). Power users can
finish the import in the form after the basics land.
2026-05-26 13:28:04 +02:00
..
__snapshots__ test(frontend): convert legacy-class parity tests to snapshot baselines 2026-05-26 12:27:25 +02:00
golden/fixtures refactor(frontend): extract genHysteriaLink + Wireguard link/config to lib/xray 2026-05-26 00:27:11 +02:00
headers.test.ts test(frontend): convert legacy-class parity tests to snapshot baselines 2026-05-26 12:27:25 +02:00
inbound-defaults.test.ts refactor(frontend): add createDefault*InboundSettings factories for all 10 protocols 2026-05-25 23:46:16 +02:00
inbound-form-adapter.test.ts feat(frontend): adapter between raw inbound rows and InboundFormValues 2026-05-26 01:26:43 +02:00
inbound-full.test.ts feat(frontend): stream extras + full InboundSchema with DU intersection 2026-05-26 00:00:34 +02:00
inbound-link.test.ts test(frontend): convert legacy-class parity tests to snapshot baselines 2026-05-26 12:27:25 +02:00
outbound-defaults.test.ts feat(frontend): outbound settings factories + dispatcher 2026-05-26 01:58:07 +02:00
outbound-form-adapter.test.ts feat(frontend): outbound form schema + wire adapter foundation 2026-05-26 11:58:36 +02:00
outbound-link-parser.test.ts feat(frontend): link import on outbound modal (vmess/vless/trojan/ss/hy2) 2026-05-26 13:28:04 +02:00
protocol-capabilities.test.ts test(frontend): convert legacy-class parity tests to snapshot baselines 2026-05-26 12:27:25 +02:00
protocols.test.ts test(frontend): vitest harness with golden-file fixtures for inbound protocols 2026-05-25 23:22:12 +02:00
security.test.ts test(frontend): broaden golden coverage to remaining inbounds + stream + security DUs 2026-05-25 23:26:27 +02:00
setup.ts refactor(frontend): extract genVmessLink to lib/xray/inbound-link.ts 2026-05-26 00:07:36 +02:00
stream.test.ts test(frontend): broaden golden coverage to remaining inbounds + stream + security DUs 2026-05-25 23:26:27 +02:00