mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-04 01:17:15 +00:00
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:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user