mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-07 04:49:34 +00:00
fix(frontend): seed full Zod-schema defaults for stream slices + QUIC params (B17)
XHTTP showed blank Selects for Session Placement / Sequence Placement /
Padding Method / Uplink HTTP Method (and several other knobs). Those
fields have a literal "" (empty string) value in the schema, which the
Select renders as "Default (path)" / "Default (repeat-x)" / etc.
The form field was `undefined`, not `""`, so the Select showed blank
instead of the labelled default option.
newStreamSlice in InboundFormModal hand-rolled per-network seed
objects with only a handful of fields. Replaced with
{Tcp,Kcp,Ws,Grpc,HttpUpgrade,XHttp}StreamSettingsSchema.parse({}) so
every default declared in the schema populates the form on network
switch. Same change in buildAddModeValues for the initial TCP state.
QUIC Params (FinalMaskForm) had the same shape on a smaller scale —
defaultQuicParams() only seeded congestion + debug + udpHop. The
schema's other fields are .optional() (no Zod default) so a schema
parse won't help. Hard-coded the xray-core / hysteria recommended
values (maxIdleTimeout 30, keepAlivePeriod 10, brutalUp/Down 0,
maxIncomingStreams 1024, four window sizes) so the InputNumber
controls render with usable starting values instead of blank.
This commit is contained in:
@@ -80,10 +80,26 @@ function defaultNoiseItem(): Record<string, unknown> {
|
||||
}
|
||||
|
||||
function defaultQuicParams(): Record<string, unknown> {
|
||||
// Seeded with the xray-core / hysteria recommended defaults so the QUIC
|
||||
// Params sub-form doesn't show blank InputNumber fields when first
|
||||
// enabled. The schema declares these as .optional() (no Zod default)
|
||||
// because the wire shape omits them when xray's built-in default
|
||||
// applies — but the panel needs values to render the controls.
|
||||
return {
|
||||
congestion: 'bbr',
|
||||
debug: false,
|
||||
brutalUp: 0,
|
||||
brutalDown: 0,
|
||||
hasUdpHop: false,
|
||||
udpHop: { ports: '20000-50000', interval: 5 },
|
||||
maxIdleTimeout: 30,
|
||||
keepAlivePeriod: 10,
|
||||
disablePathMTUDiscovery: false,
|
||||
maxIncomingStreams: 1024,
|
||||
initStreamReceiveWindow: 8388608,
|
||||
maxStreamReceiveWindow: 8388608,
|
||||
initConnectionReceiveWindow: 20971520,
|
||||
maxConnectionReceiveWindow: 20971520,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user