* Apply headless mode visibility settings to UI elements * @param {boolean} isHeadless - Whether the system is in headless mode
(isHeadless)
| 7235 | storm: ['bg-red-950/60 border-red-800 text-red-300', '🛑 Router Advertisement flood (RA-flood DoS)'], |
| 7236 | unknown: ['bg-slate-800 border-slate-700 text-slate-400', '— Could not determine'], |
| 7237 | }; |
| 7238 | function _ipv6FillIfaces() { |
| 7239 | const sel = document.getElementById('ipv6-iface'); |
| 7240 | if (!sel || sel.dataset.filled === '1') return Promise.resolve(); |
| 7241 | return fetchAPI('/api/net/interfaces').then(x => { |
| 7242 | (x.interfaces || []).forEach(i => { |
| 7243 | const o = document.createElement('option'); |
| 7244 | o.value = i.name; |
| 7245 | const tag = i.type === 'wifi' ? ' (WiFi)' : i.type === 'ethernet' ? ' (LAN)' : (i.type ? ' (' + i.type + ')' : ''); |
| 7246 | o.textContent = i.name + tag; |
| 7247 | sel.appendChild(o); |
| 7248 | }); |
| 7249 | sel.dataset.filled = '1'; |
| 7250 | }).catch(() => {}); |
| 7251 | } |
| 7252 | async function runIpv6Watch() { |
| 7253 | const out = document.getElementById('ipv6-results'); |
| 7254 | if (!out) return; |
| 7255 | const btn = (typeof event !== 'undefined' && event && event.target) ? event.target : null; |
| 7256 | const ifaceSel = document.getElementById('ipv6-iface'); |
| 7257 | const iface = ifaceSel && ifaceSel.value ? ifaceSel.value : ''; |
| 7258 | const secsEl = document.getElementById('ipv6-secs'); |
| 7259 | const secs = secsEl && secsEl.value ? secsEl.value : '12'; |
| 7260 | _ndBusy(btn, true, 'Listening…'); |
| 7261 | out.classList.remove('hidden'); |
| 7262 | out.innerHTML = '<p class="text-sm text-gray-400">Passively capturing RA / DHCPv6 on the segment…</p>'; |
| 7263 | try { |
| 7264 | _ipv6FillIfaces(); |
| 7265 | const qs = '?seconds=' + encodeURIComponent(secs) + (iface ? '&interface=' + encodeURIComponent(iface) : ''); |
| 7266 | const d = await fetchAPI('/api/net/ipv6-watch' + qs); |
| 7267 | if (!d || d.success === false) { |
| 7268 | const msg = (d && d.error) || 'failed'; |
| 7269 | let extra = ''; |
| 7270 | if (d && d.missing_tool) extra = ' <button onclick="installNetTool(\'tcpdump\', this, runIpv6Watch)" class="ml-2 underline text-cyan-400">Install tcpdump</button>'; |
no test coverage detected