From 5af02265ecca42e2404f7eacbc4ab45003727e21 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 12 Jun 2026 15:35:41 +0200 Subject: [PATCH] fix(inbound): remove stale mkcp-legacy finalmask when switching away from mKCP Switching the transport to mKCP auto-seeds a mkcp-legacy entry into finalmask.udp, but switching back to another transport only dropped the kcpSettings blob and left the mask behind. It survived downstream pruning (finalmask.udp was non-empty) and bled into every client share link. Strip auto-seeded mkcp-legacy entries from finalmask.udp whenever the network changes away from kcp, leaving user-authored masks intact. Fixes #5221 --- .../pages/inbounds/form/InboundFormModal.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/pages/inbounds/form/InboundFormModal.tsx b/frontend/src/pages/inbounds/form/InboundFormModal.tsx index 575329f39..6d238f5e6 100644 --- a/frontend/src/pages/inbounds/form/InboundFormModal.tsx +++ b/frontend/src/pages/inbounds/form/InboundFormModal.tsx @@ -691,13 +691,13 @@ export default function InboundFormModal({ {isFallbackHost && fallbacksCard} {(protocol === Protocols.VLESS || protocol === Protocols.TROJAN) && network === 'tcp' && !isFallbackHost && ( - - )} + + )} ); @@ -749,6 +749,12 @@ export default function InboundFormModal({ udp: [...udp, { type: 'mkcp-legacy', settings: { header: '', value: '' } }], }; } + } else { + const fm = cleaned.finalmask as Record | undefined; + if (fm && Array.isArray(fm.udp)) { + const udp = (fm.udp as unknown[]).filter((m) => (m as { type?: string })?.type !== 'mkcp-legacy'); + cleaned.finalmask = { ...fm, udp }; + } } form.setFieldValue('streamSettings', cleaned); };