mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-13 18:02:14 +03:00
fix(frontend): fold sockopt v6only into V6Only on inbound load (#6453)
Prevents duplicate keys and an unreachable switch when Advanced/API configs store lowercase v6only (#6421).
This commit is contained in:
@@ -184,9 +184,17 @@ export function rawInboundToFormValues(row: RawInboundRow): InboundFormValues {
|
||||
}
|
||||
const so = streamRecord.sockopt;
|
||||
if (so && typeof so === 'object' && !Array.isArray(so)) {
|
||||
const parsed = SockoptStreamSettingsSchema.safeParse(so);
|
||||
const raw = { ...(so as Record<string, unknown>) };
|
||||
// Imported/API configs may use lowercase v6only; the form key is V6Only.
|
||||
if ('v6only' in raw) {
|
||||
if (!('V6Only' in raw)) raw.V6Only = Boolean(raw.v6only);
|
||||
delete raw.v6only;
|
||||
}
|
||||
const parsed = SockoptStreamSettingsSchema.safeParse(raw);
|
||||
if (parsed.success) {
|
||||
streamRecord.sockopt = { ...(so as Record<string, unknown>), ...parsed.data };
|
||||
streamRecord.sockopt = { ...raw, ...parsed.data };
|
||||
} else {
|
||||
streamRecord.sockopt = raw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user