fix(ui): DNS apply no longer blanks the page + WiFi/DNS modals cover the whole app
All checks were successful
Demo images / Build & push demo images (push) Successful in 2m39s

Applying DNS assigned the RPC response's fields into networkData without
guarding the shape; the demo mock answered {success:true} with no
servers array, dnsServers became undefined, and the dnsDisplayLabel
computed crashed the whole page render on .length. Guard the assignment,
teach the mock to round-trip DNS state per session, and Teleport the
WiFi + DNS modals to body so they overlay the full app instead of just
the right panel (position:fixed is containing-block-relative inside the
dashboard).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-07-15 03:49:23 -04:00
parent 2fce4fb842
commit 2f78fb6907
3 changed files with 29 additions and 7 deletions

View File

@ -2418,20 +2418,34 @@ app.post('/rpc/v1', (req, res) => {
}
case 'network.dns-status': {
const dns = mockState.dns || { provider: 'system', servers: ['1.1.1.1', '9.9.9.9'], doh_enabled: false }
return res.json({
result: {
provider: 'system',
servers: ['1.1.1.1', '9.9.9.9'],
doh_enabled: false,
provider: dns.provider,
servers: dns.servers,
doh_enabled: dns.doh_enabled,
doh_url: null,
resolv_conf_servers: ['1.1.1.1', '9.9.9.9'],
resolv_conf_servers: dns.servers,
},
})
}
case 'network.configure-dns': {
console.log(`[Network] DNS configured: ${params?.provider}`)
return res.json({ result: { success: true } })
const dnsProviders = {
system: ['192.168.4.1'],
cloudflare: ['1.1.1.1', '1.0.0.1'],
google: ['8.8.8.8', '8.8.4.4'],
quad9: ['9.9.9.9', '149.112.112.112'],
mullvad: ['194.242.2.2'],
}
const provider = params?.provider || 'system'
const servers = provider === 'custom'
? (Array.isArray(params?.servers) ? params.servers : [])
: (dnsProviders[provider] || dnsProviders.system)
const doh_enabled = ['cloudflare', 'google', 'quad9', 'mullvad'].includes(provider)
mockState.dns = { provider, servers, doh_enabled }
console.log(`[Network] DNS configured: ${provider}${servers.join(', ')}`)
return res.json({ result: { provider, servers, doh_enabled } })
}
case 'network.accept-request': {

View File

@ -630,7 +630,11 @@ async function applyDnsConfig(customServers: string) {
const params: { provider: DnsProviderValue; servers?: string[] } = { provider }
if (provider === 'custom') { params.servers = customServers.split(',').map(s => s.trim()).filter(s => s.length > 0) }
const res = await rpcClient.configureDns(params)
networkData.value.dnsProvider = res.provider; networkData.value.dnsServers = res.servers; networkData.value.dnsDoH = res.doh_enabled
// Never trust the response shape: an undefined `servers` used to reach the
// dnsDisplayLabel computed and crash the whole page render on `.length`.
networkData.value.dnsProvider = res?.provider ?? provider
networkData.value.dnsServers = Array.isArray(res?.servers) ? res.servers : (params.servers ?? [])
networkData.value.dnsDoH = !!res?.doh_enabled
showDnsModal.value = false
} catch (e) { dnsError.value = e instanceof Error ? e.message : 'DNS configuration failed.' } finally { dnsApplying.value = false }
}

View File

@ -94,6 +94,7 @@
</Teleport>
<!-- WiFi Scan Modal -->
<Teleport to="body">
<div v-if="showWifiModal" class="fixed inset-0 bg-black/60 backdrop-blur-md z-50 flex items-center justify-center p-4" @click.self="$emit('closeWifi')">
<div class="glass-card p-6 w-full max-w-md">
<div class="flex items-center justify-between mb-4">
@ -161,8 +162,10 @@
</div>
</div>
</div>
</Teleport>
<!-- DNS Configuration Modal -->
<Teleport to="body">
<div v-if="showDnsModal" class="fixed inset-0 bg-black/60 backdrop-blur-md z-50 flex items-center justify-center p-4" @click.self="$emit('closeDns')">
<div class="glass-card p-6 w-full max-w-md">
<div class="flex items-center justify-between mb-4">
@ -223,6 +226,7 @@
</div>
</div>
</div>
</Teleport>
</template>
<script setup lang="ts">