(endpoint, payload = {})
| 6815 | dhcp: { verdict: 'checking…', reasons: [] }, |
| 6816 | }; |
| 6817 | renderNetIntegrity(state); |
| 6818 | // Slow DHCP check — update the chip (and overall) once it resolves. |
| 6819 | fetchAPI('/api/net/dhcp-guardian?quick=1').then(dhcp => { |
| 6820 | const dhcpV = dhcp ? dhcp.verdict : 'unknown'; |
| 6821 | state.dhcp = { verdict: dhcpV, reasons: (dhcp && dhcp.reasons) || [] }; |
| 6822 | state.overall = ['clean', 'suspicious', 'compromised'][Math.max( |
| 6823 | _NETINT_RANK[dnsV] || 0, _NETINT_RANK[arpV] || 0, _NETINT_RANK[dhcpV] || 0)]; |
| 6824 | renderNetIntegrity(state); |
| 6825 | }).catch(() => { |
| 6826 | state.dhcp = { verdict: 'unknown', reasons: [] }; |
| 6827 | renderNetIntegrity(state); |
| 6828 | }).finally(() => { |
| 6829 | if (btn) { btn.disabled = false; btn.textContent = btn.dataset.orig || 'Check now'; } |
| 6830 | }); |
| 6831 | return; |
| 6832 | } |
| 6833 | renderNetIntegrity(await fetchAPI('/api/net/integrity')); |
| 6834 | } catch (e) { /* offline — leave chips as-is */ |
| 6835 | if (btn) { btn.disabled = false; btn.textContent = btn.dataset.orig || 'Check now'; } |
| 6836 | } |
| 6837 | } |
| 6838 | function _netintFillIfaces() { |
| 6839 | const sel = document.getElementById('netint-iface'); |
| 6840 | if (!sel || sel.dataset.filled === '1') return Promise.resolve(); |
| 6841 | return fetchAPI('/api/net/interfaces').then(x => { |
| 6842 | (x.interfaces || []).forEach(i => { |
| 6843 | const o = document.createElement('option'); |
| 6844 | o.value = i.name; |
no outgoing calls
no test coverage detected