fix(clients): render all tunnel configs for multi-inbound client (#6346) (#6349)

When a client belongs to multiple AmneziaWG or WireGuard inbounds (e.g. across
remote nodes), findAmneziaWGInbounds and findWireguardInbounds only returned the
first matching inbound. Consequently, ClientInfoModal and ClientQrModal rendered
only one config block, making other inbounds' configs unreachable.

- Add findAmneziaWGInbounds and findWireguardInbounds returning all matching inbounds
- Add formatTunnelConfigMeta helper to unify label, fileName, and qrRemark resolution
- Support addressOverride in buildWireguardClientConfig from tunnelAllowedIPs
- Render all tunnel configs in ClientInfoModal and ClientQrModal with node remarks
- Distinguish download filenames with inbound remark suffix to avoid collisions
- Add component integration tests covering multi-inbound modal rendering
This commit is contained in:
MRVX
2026-09-03 18:33:48 +03:30
committed by GitHub
parent de18c5a006
commit 47964afbc5
6 changed files with 349 additions and 105 deletions
+23
View File
@@ -7,3 +7,26 @@ export function formatInboundLabel(tag?: string, remark?: string): string {
if (remarkText) return remarkText;
return (tag || '').trim();
}
export function formatTunnelConfigMeta(
inbound: { id?: number; tag?: string; remark?: string },
email?: string,
totalCount = 1,
): {
label?: string;
fileName: string;
qrRemark: string;
} {
const inboundName =
formatInboundLabel(inbound.tag, inbound.remark) ||
(inbound.id != null ? `inbound-${inbound.id}` : '');
const label = totalCount > 1 ? inboundName : undefined;
const suffix = inbound.remark || inbound.tag || (inbound.id != null ? `${inbound.id}` : '');
const safeSuffix = suffix ? `-${suffix.replace(/[^\w.-]+/g, '_')}` : '';
const emailPrefix = email || 'client';
const fileName = `${emailPrefix}${totalCount > 1 ? safeSuffix : ''}.conf`;
const qrRemark =
totalCount > 1 && inboundName ? [inboundName, email].filter(Boolean).join(' - ') : email || '';
return { label, fileName, qrRemark };
}