From b47bac3dc6e5bdec76880b49b5ac4edfa369770c Mon Sep 17 00:00:00 2001 From: root Date: Sun, 26 Apr 2026 01:05:09 +0800 Subject: [PATCH] fix: default flow to vision in client add modals --- ...-26-fix-client-flow-autofill-ui-default.md | 52 +++++++++++++++++++ web/html/modals/client_bulk_modal.html | 11 +++- web/html/modals/client_modal.html | 8 ++- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 docs/Tasktracking/2026-04-26-fix-client-flow-autofill-ui-default.md diff --git a/docs/Tasktracking/2026-04-26-fix-client-flow-autofill-ui-default.md b/docs/Tasktracking/2026-04-26-fix-client-flow-autofill-ui-default.md new file mode 100644 index 00000000..9dc12735 --- /dev/null +++ b/docs/Tasktracking/2026-04-26-fix-client-flow-autofill-ui-default.md @@ -0,0 +1,52 @@ +Task Record + +Date: 2026-04-26 +Related Module: client add modals (web/html) +Change Type: Fix + +Background + +Although backend flow auto-fill was implemented for eligible new clients, the add-client UI still initialized `flow` as empty by default. +This made the feature appear non-functional during client creation. + +Changes + +Updated UI defaults for new VLESS clients in add dialogs: +- `web/html/modals/client_modal.html` + - In single add flow, when inbound `canEnableTlsFlow()` is true and client flow is empty, default to `xtls-rprx-vision`. +- `web/html/modals/client_bulk_modal.html` + - On modal show, default selected bulk `flow` to `xtls-rprx-vision` when `canEnableTlsFlow()` is true. + - In `newClient(...)` for VLESS, initialize empty flow to `xtls-rprx-vision` under the same condition. + +Impact + +Affected modules or files. +- `web/html/modals/client_modal.html` +- `web/html/modals/client_bulk_modal.html` + +Whether APIs, database, config, build, or compatibility are affected. +- No API contract changes. +- No database schema changes. +- UI behavior change only for default values in eligible flow-required scenarios. + +Whether upstream or downstream callers are affected. +- Panel operators adding clients now immediately see expected default flow value. + +Verification + +List validation commands or checks performed. +- `go test ./web/...` + +State the result. +- Passed. + +If not verified, explain why. +- No remote runtime interaction was performed in this local environment. + +Risks And Follow-Up + +Remaining risks. +- Existing browser cache may keep older template assets until refresh/reload. + +Recommended follow-up work. +- Verify add-client and bulk-add flows in panel UI for VLESS+TCP+TLS/Reality in deployed environment. diff --git a/web/html/modals/client_bulk_modal.html b/web/html/modals/client_bulk_modal.html index 1726771c..be78c7db 100644 --- a/web/html/modals/client_bulk_modal.html +++ b/web/html/modals/client_bulk_modal.html @@ -213,13 +213,22 @@ this.flow = ""; this.dbInbound = new DBInbound(dbInbound); this.inbound = dbInbound.toInbound(); + if (this.inbound.canEnableTlsFlow()) { + this.flow = "xtls-rprx-vision"; + } this.delayedStart = false; this.reset = 0; }, newClient(protocol) { switch (protocol) { case Protocols.VMESS: return new Inbound.VmessSettings.VMESS(); - case Protocols.VLESS: return new Inbound.VLESSSettings.VLESS(); + case Protocols.VLESS: { + const client = new Inbound.VLESSSettings.VLESS(); + if (clientsBulkModal.inbound?.canEnableTlsFlow() && !client.flow) { + client.flow = "xtls-rprx-vision"; + } + return client; + } case Protocols.TROJAN: return new Inbound.TrojanSettings.Trojan(); case Protocols.SHADOWSOCKS: { const method = clientsBulkModal.inbound?.settings?.method || ''; diff --git a/web/html/modals/client_modal.html b/web/html/modals/client_modal.html index b9a58d1e..47f60536 100644 --- a/web/html/modals/client_modal.html +++ b/web/html/modals/client_modal.html @@ -73,7 +73,13 @@ addClient(inbound, clients) { switch (inbound.protocol) { case Protocols.VMESS: return clients.push(new Inbound.VmessSettings.VMESS()); - case Protocols.VLESS: return clients.push(new Inbound.VLESSSettings.VLESS()); + case Protocols.VLESS: { + const client = new Inbound.VLESSSettings.VLESS(); + if (inbound.canEnableTlsFlow() && !client.flow) { + client.flow = "xtls-rprx-vision"; + } + return clients.push(client); + } case Protocols.TROJAN: return clients.push(new Inbound.TrojanSettings.Trojan()); case Protocols.SHADOWSOCKS: return clients.push(new Inbound.ShadowsocksSettings.Shadowsocks(inbound.settings.method, RandomUtil.randomShadowsocksPassword(inbound.settings.method))); default: return null;