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

Function onScanIntensityChanged

web/scripts/ragnar_modern.js:5473–5499  ·  view source on GitHub ↗
(selectEl)

Source from the content-addressed store, hash-verified

5471 return;
5472 }
5473 if (_wifidef.monitor) {
5474 // Stop any continuous scan first — otherwise its next loop would
5475 // immediately auto-re-enable the monitor and "disable" would look broken.
5476 if (_wifidef.continuous) wifidefStopContinuous();
5477 st.textContent = 'Disabling monitor…';
5478 fetch('/api/wifidef/monitor', { method: 'POST', headers: { 'Content-Type': 'application/json' },
5479 body: JSON.stringify({ action: 'disable' }) })
5480 .then(r => r.json()).then(d => { _wifidef.monitor = null; _wifidefUpdateMonBtn(); st.textContent = 'Monitor disabled'; }).catch(() => {});
5481 return;
5482 }
5483 const iface = _wifidef.iface || document.getElementById('wifidef-iface').value;
5484 if (!iface) return;
5485 st.textContent = 'Enabling monitor…';
5486 fetch('/api/wifidef/monitor', { method: 'POST', headers: { 'Content-Type': 'application/json' },
5487 body: JSON.stringify({ action: 'enable', interface: iface }) })
5488 .then(r => r.json()).then(d => {
5489 if (d.error) { st.textContent = '⚠ ' + d.error; return; }
5490 _wifidef.monitor = d.mon_iface;
5491 _wifidefUpdateMonBtn();
5492 st.textContent = d.warning ? ('⚠ ' + d.warning) : ('Monitor up on ' + d.mon_iface + (d.mode === 'vif' ? ' (link kept)' : ''));
5493 }).catch(() => { st.textContent = 'Enable failed'; });
5494}
5495
5496// ---- Capture progress (live countdown for fixed-length captures) -----------
5497// Every WiFi Defense action captures for a KNOWN number of seconds, so show a
5498// real countdown + progress bar while the request is in flight. Past the
5499// capture window (monitor setup, channel tuning, analysis) it switches to a
5500// pulsing "analyzing…" state, so the user always sees work happening. Returns
5501// a handle whose done() stops the ticker; write the final status after that.
5502function _wifidefProgress(st, secs, label) {

Callers

nothing calls this directly

Calls 3

addMethod · 0.80
errorMethod · 0.80
loadScanIntensityFunction · 0.70

Tested by

no test coverage detected