From ece20d16f7195206da557cbf595c73f7c2757760 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 26 May 2026 16:24:39 +0200 Subject: [PATCH] fix(frontend): inbound TCP HTTP camouflage drops request fields + KCP UI field rename (B15/B16) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit B15 — Inbound TCP HTTP camouflage exposed Host / Path / Method / Version / request-headers inputs. Per Xray docs (https://xtls.github.io/config/transports/raw.html#httpheaderobject), the `request` object is honored only by outbound proxies; the inbound listener reads `response`. Those inputs were writing dead data the server ignored. Removed them from the inbound modal; only Response {version, status, reason, headers} remain. The toggle still seeds an empty request object so the wire shape stays valid against the schema. B16 — KCP Uplink / Downlink inputs bound to non-existent form fields `upCap` / `downCap`, while the schema (and wire) use `uplinkCapacity` / `downlinkCapacity`. Renamed the Form.Items to the schema names so defaults populate and saves persist. Also corrected newStreamSlice('kcp') to seed the four KCP defaults (uplinkCapacity / downlinkCapacity / cwndMultiplier / maxSendingWindow) — the missing two were why "CWND Multiplier" and "Max Sending Window" still showed empty after switching to KCP. --- .../src/pages/inbounds/InboundFormModal.tsx | 69 ++++--------------- 1 file changed, 12 insertions(+), 57 deletions(-) diff --git a/frontend/src/pages/inbounds/InboundFormModal.tsx b/frontend/src/pages/inbounds/InboundFormModal.tsx index 91f093fb..c871c49d 100644 --- a/frontend/src/pages/inbounds/InboundFormModal.tsx +++ b/frontend/src/pages/inbounds/InboundFormModal.tsx @@ -1311,9 +1311,9 @@ export default function InboundFormModal({ return { header: { type: 'none' } }; case 'kcp': return { - mtu: 1350, tti: 20, uplinkCapacity: 5, downlinkCapacity: 20, - congestion: false, readBufferSize: 2, writeBufferSize: 2, - header: { type: 'none' }, seed: '', + mtu: 1350, tti: 20, + uplinkCapacity: 5, downlinkCapacity: 20, + cwndMultiplier: 1, maxSendingWindow: 2097152, }; case 'ws': return { path: '/', host: '', headers: {}, heartbeatPeriod: 0 }; @@ -1545,10 +1545,13 @@ export default function InboundFormModal({ }} - {/* Host + path camouflage inputs only render when the Switch - above is on. Both are string[] on the wire; normalize + - getValueProps translate to/from comma-joined input. Mirrors - the symmetric outbound side. */} + {/* Per Xray docs (transports/raw.html#httpheaderobject), the + `request` object is honored only by outbound proxies; the + inbound listener reads `response`. Showing Host / Path / + Method / Version / request-headers on the inbound side was + a regression from this modal's earlier iteration — those + inputs wrote to the wire but xray-core ignored them. The + inbound modal now only exposes the response side. */} @@ -1563,54 +1566,6 @@ export default function InboundFormModal({ if (headerType !== 'http') return null; return ( <> - - typeof v === 'string' - ? v.split(',').map((s) => s.trim()).filter(Boolean) - : Array.isArray(v) ? v : [] - } - getValueProps={(v: unknown) => ({ - value: Array.isArray(v) ? v.join(',') : '', - })} - > - - - - typeof v === 'string' - ? v.split(',').map((s) => s.trim()).filter(Boolean) - : Array.isArray(v) ? v : ['/'] - } - getValueProps={(v: unknown) => ({ - value: Array.isArray(v) ? v.join(',') : '/', - })} - > - - - - - - - {/* Response side: shaped as a separate sub-object on the - wire ({version, status, reason, headers}). Inbound is - the server, so the response side is the one the panel - sends back to clients during HTTP camouflage. */} - + - +