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

Function handleLynisUpdate

web/scripts/ragnar_modern.js:3660–3764  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

3658// full-screen controls — the in-page buttons are the source of truth.
3659function _wifiFsSyncGates() {
3660 const zb = document.getElementById('wifi-fs-zb'), zbl = document.getElementById('wifi-fs-zb-label');
3661 const zbMain = document.getElementById('wifi-zb');
3662 if (zb && zbMain) {
3663 zb.disabled = zbMain.disabled;
3664 if (zbl) { zbl.style.opacity = zbMain.disabled ? '.4' : '1'; zbl.style.cursor = zbMain.disabled ? 'not-allowed' : 'pointer'; }
3665 }
3666 const ble = document.getElementById('wifi-fs-ble'), blel = document.getElementById('wifi-fs-ble-label');
3667 const bleMain = document.getElementById('wifi-ble');
3668 if (ble && bleMain) {
3669 ble.disabled = bleMain.disabled;
3670 if (blel) { blel.style.opacity = bleMain.disabled ? '.4' : '1'; blel.style.cursor = bleMain.disabled ? 'not-allowed' : 'pointer'; }
3671 }
3672 const wf = document.getElementById('wifi-fs-view-wf'), wfMain = document.getElementById('wifi-view-wf');
3673 if (wf && wfMain) {
3674 wf.disabled = wfMain.disabled;
3675 wf.style.opacity = wfMain.disabled ? '.4' : '1';
3676 wf.style.cursor = wfMain.disabled ? 'not-allowed' : 'pointer';
3677 wf.title = wfMain.title;
3678 }
3679}
3680
3681// Repaint everything the console owns (called after each render/scan).
3682function _wifiFsRender() {
3683 if (!_wifiState.fs.open) return;
3684 const d = _wifiState.data;
3685 const iface = document.getElementById('wifi-fs-iface');
3686 if (iface) iface.textContent = _wifiState.iface ? `· ${_wifiState.iface}` : '';
3687 const st = document.getElementById('wifi-fs-status'), main = document.getElementById('wifi-scan-status');
3688 if (st && main) st.textContent = main.textContent;
3689 _wifiFsSyncGates();
3690 // Band chips — clicking one filters the spectrum to that band.
3691 const summ = document.getElementById('wifi-fs-summary');
3692 if (summ) {
3693 const ratingColor = { clear: '#22c55e', moderate: '#eab308', congested: '#ef4444' };
3694 let chips = '';
3695 if (d) chips = Object.keys(d.spectrum).sort().map(b => {
3696 const s = d.spectrum[b];
3697 const on = _wifiState.band === b;
3698 const wa = s.width_advice ? ` · <span title="${_esc(s.width_advice.reason)}">→ ${s.width_advice.mhz}MHz</span>` : '';
3699 return `<button onclick="wifiSetBand('${on ? 'all' : b}')" title="${on ? 'Show all bands' : 'Show only this band'}"
3700 style="background:${_WIFI_BAND_COLOR[b]}${on ? '33' : '18'};border:1px solid ${_WIFI_BAND_COLOR[b]}${on ? 'cc' : '55'};border-radius:6px;padding:3px 8px;cursor:pointer">
3701 <b style="color:${_WIFI_BAND_COLOR[b]}">${b} GHz</b> · ${s.ap_count} AP ·
3702 <span style="color:${ratingColor[s.rating]}">${s.rating}</span> · best ch ${s.recommend.join(', ')}${wa}</button>`;
3703 }).join('');
3704 if (d && d.noise_floor != null) chips += `<span class="wifi-fs-tag" style="padding:3px 8px">noise floor ${d.noise_floor} dBm</span>`;
3705 summ.innerHTML = chips || '<span class="wifi-fs-meta">No APs heard yet — hit Scan.</span>';
3706 }
3707 const leg = document.getElementById('wifi-fs-legend');
3708 if (leg) leg.innerHTML = '<span>Signal:</span>' +
3709 [['#22c55e', 'strong ≥−55'], ['#84cc16', 'good ≥−67'], ['#eab308', 'fair ≥−75'], ['#f97316', 'weak ≥−85'], ['#ef4444', 'v.weak']]
3710 .map(([c, l]) => `<span style="display:inline-flex;align-items:center;gap:4px"><span style="width:10px;height:10px;background:${c};border-radius:2px;display:inline-block"></span>${l}</span>`).join('') +
3711 '<span style="color:#a78bfa">◆ DFS/radar</span><span style="color:#fbbf24">⚠ security issue</span>' +
3712 '<span class="wifi-fs-meta">keys: ↑↓ select · s scan · b/d view · a/2/5/6 band · Esc exit</span>';
3713 _wifiFsRenderList();
3714 _wifiFsRenderSide();
3715}
3716
3717function _wifiFsRenderList() {

Callers 1

initializeSocketFunction · 0.70

Calls 2

addMethod · 0.80
addConsoleMessageFunction · 0.70

Tested by

no test coverage detected