fix(clients): hide WireGuard config after detaching the WG inbound

The client info and QR modals rendered a WireGuard config whenever the
client still carried leftover WG key material (privateKey / publicKey /
allowedIPs / preSharedKey / keepAlive), regardless of whether a WireGuard
inbound was actually attached. After detaching the WG inbound the config
kept showing, built with an empty endpoint port and public key.

Gate wgConfigText on an attached WireGuard inbound (wgInbound) being
present, not just isWireguardClient(client), in both ClientInfoModal and
ClientQrModal.

Also rename the i18n key pages.clients.conf -> config and add the missing
pages.clients keys (wireguardConfig, config, bulkFlow, bulkFlowNoChange,
bulkFlowDisable) to all 12 non-English locales so each one matches en-US.
This commit is contained in:
MHSanaei
2026-06-29 01:15:37 +02:00
parent a329882e0e
commit 6c71b725da
15 changed files with 64 additions and 4 deletions
@@ -138,7 +138,7 @@ export default function ClientInfoModal({
const showSubscription = !!(subSettings?.enable && client?.subId);
const wgInbound = useMemo(() => findWireguardInbound(client, inboundsById), [client, inboundsById]);
const wgConfigText = useMemo(() => {
if (!client || !isWireguardClient(client)) return '';
if (!client || !wgInbound || !isWireguardClient(client)) return '';
return buildWireguardClientConfig(client, wgInbound, window.location.hostname, subSettings?.publicHost ?? '');
}, [client, wgInbound, subSettings?.publicHost]);
@@ -494,7 +494,7 @@ export default function ClientInfoModal({
<>
<Divider>{t('pages.clients.wireguardConfig')}</Divider>
<ConfigBlock
label={t('pages.clients.conf')}
label={t('pages.clients.config')}
text={wgConfigText}
fileName={`${client.email}.conf`}
qrRemark={client.email || 'peer'}
+1 -1
View File
@@ -55,7 +55,7 @@ export default function ClientQrModal({
const wgInbound = useMemo(() => findWireguardInbound(client, inboundsById), [client, inboundsById]);
const wgConfigText = useMemo(() => {
if (!client || !isWireguardClient(client)) return '';
if (!client || !wgInbound || !isWireguardClient(client)) return '';
return buildWireguardClientConfig(client, wgInbound, window.location.hostname, subSettings?.publicHost ?? '');
}, [client, wgInbound, subSettings?.publicHost]);