MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / applyHeadlessVisibility

Function applyHeadlessVisibility

web/scripts/ragnar_modern.js:7237–7267  ·  view source on GitHub ↗

* Apply headless mode visibility settings to UI elements * @param {boolean} isHeadless - Whether the system is in headless mode

(isHeadless)

Source from the content-addressed store, hash-verified

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};
7238function _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}
7252async 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>';

Callers 1

handleHeadlessModeFunction · 0.70

Calls 1

showTabFunction · 0.70

Tested by

no test coverage detected