(isEnabled)
| 6876 | const o = document.createElement('option'); |
| 6877 | o.value = i.name; |
| 6878 | const tag = i.type === 'wifi' ? ' (WiFi)' : i.type === 'ethernet' ? ' (LAN)' : (i.type ? ' (' + i.type + ')' : ''); |
| 6879 | o.textContent = i.name + tag; |
| 6880 | sel.appendChild(o); |
| 6881 | }); |
| 6882 | sel.dataset.filled = '1'; |
| 6883 | }).catch(() => {}); |
| 6884 | } |
| 6885 | async function runDhcpGuardian() { |
| 6886 | const out = document.getElementById('dhcp-results'); |
| 6887 | if (!out) return; |
| 6888 | const btn = (typeof event !== 'undefined' && event && event.target) ? event.target : null; |
| 6889 | const ifaceSel = document.getElementById('dhcp-iface'); |
| 6890 | const iface = ifaceSel && ifaceSel.value ? ifaceSel.value : ''; |
| 6891 | _ndBusy(btn, true, 'Scanning…'); |
| 6892 | out.classList.remove('hidden'); |
| 6893 | out.innerHTML = '<p class="text-sm text-gray-400">Provoking DHCP offers and watching for a DISCOVER flood… (a few seconds)</p>'; |
| 6894 | try { |
| 6895 | _dhcpFillIfaces(); |
| 6896 | const d = await fetchAPI('/api/net/dhcp-guardian' + (iface ? '?interface=' + encodeURIComponent(iface) : '')); |
no test coverage detected