mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-21 18:37:14 +00:00
fix(xhttp): stop XMUX maxConcurrency from reverting on save
XHttpXmuxSchema defaulted maxConnections to 6 (added to mirror xray-core v26.6.27's anti-RKN client default), so load-time hydration backfilled a non-zero maxConnections onto every config whose saved xmux lacked the key. Since maxConnections and maxConcurrency are mutually exclusive on the wire, the save-time exclusivity rule then saw both fields set and silently deleted the user's maxConcurrency; the missing key came back as the '16-32' schema default on the next load, so edits appeared to never save. Revert the bare schema default to 0 and seed the anti-RKN maxConnections=6 only when XMUX is freshly toggled on (XMUX_FRESH_DEFAULTS, with maxConcurrency left blank — xray-core parses an empty range string as 0), so the two strategies never start out conflicting. The inbound and outbound XMUX forms now also clear the opposing field live as soon as the user sets one, so whichever strategy was actually typed is the one persisted. Closes #5864
This commit is contained in:
@@ -521,6 +521,29 @@ describe('outbound-form-adapter: xhttp xmux toggle', () => {
|
||||
const wireXhttp = (back.streamSettings as Record<string, unknown>).xhttpSettings as Record<string, unknown>;
|
||||
expect(wireXhttp).not.toHaveProperty('xmux');
|
||||
});
|
||||
|
||||
it('keeps a saved maxConcurrency through a load/re-save round-trip', () => {
|
||||
const wire = {
|
||||
...xmuxWire,
|
||||
streamSettings: {
|
||||
...xmuxWire.streamSettings,
|
||||
xhttpSettings: {
|
||||
...xmuxWire.streamSettings.xhttpSettings,
|
||||
xmux: { maxConcurrency: '1-2' },
|
||||
},
|
||||
},
|
||||
};
|
||||
const form = rawOutboundToFormValues(wire);
|
||||
const xhttp = (form.streamSettings as Record<string, unknown>).xhttpSettings as Record<string, unknown>;
|
||||
const xmux = xhttp.xmux as Record<string, unknown>;
|
||||
expect(xmux.maxConcurrency).toBe('1-2');
|
||||
expect(xmux.maxConnections).toBe(0);
|
||||
|
||||
const back = formValuesToWirePayload(form);
|
||||
const wireXhttp = (back.streamSettings as Record<string, unknown>).xhttpSettings as Record<string, unknown>;
|
||||
const wireXmux = wireXhttp.xmux as Record<string, unknown>;
|
||||
expect(wireXmux.maxConcurrency).toBe('1-2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('outbound-form-adapter: full optional-block round-trip', () => {
|
||||
|
||||
Reference in New Issue
Block a user