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

Function toggleBluetoothPower

web/scripts/ragnar_modern.js:9716–9748  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9714 return `<span class="px-2 py-0.5 rounded border text-xs ${cls}">${label}</span>`;
9715}
9716function _certFillIfaces() {
9717 const sel = document.getElementById('cert-iface');
9718 if (!sel || sel.dataset.filled === '1') return Promise.resolve();
9719 return fetchAPI('/api/net/interfaces').then(x => {
9720 (x.interfaces || []).forEach(i => {
9721 const o = document.createElement('option');
9722 o.value = i.name;
9723 const tag = i.type === 'wifi' ? ' (WiFi)' : i.type === 'ethernet' ? ' (LAN)' : (i.type ? ' (' + i.type + ')' : '');
9724 o.textContent = i.name + tag;
9725 sel.appendChild(o);
9726 });
9727 sel.dataset.filled = '1';
9728 }).catch(() => {});
9729}
9730async function runCertWatch() {
9731 const out = document.getElementById('cert-results');
9732 if (!out) return;
9733 const btn = (typeof event !== 'undefined' && event && event.target) ? event.target : null;
9734 const targets = (document.getElementById('cert-targets') || {}).value || '';
9735 const discover = !!(document.getElementById('cert-discover') || {}).checked;
9736 const ifaceSel = document.getElementById('cert-iface');
9737 const iface = ifaceSel && ifaceSel.value ? ifaceSel.value : '';
9738 const secsEl = document.getElementById('cert-secs');
9739 const secs = secsEl && secsEl.value ? parseInt(secsEl.value, 10) : 8;
9740 if (!targets.trim() && !discover) {
9741 out.classList.remove('hidden');
9742 out.innerHTML = '<p class="text-sm text-amber-300">Enter one or more host[:port] targets, or tick Discover.</p>';
9743 return;
9744 }
9745 _ndBusy(btn, true, discover ? 'Discovering + grading…' : 'Grading…');
9746 out.classList.remove('hidden');
9747 out.innerHTML = '<p class="text-sm text-gray-400">Completing TLS handshakes and grading certificates…</p>';
9748 try {
9749 _certFillIfaces();
9750 const d = await postAPI('/api/net/cert-watch', { targets, discover, interface: iface, seconds: secs });
9751 if (!d || d.success === false) {

Callers

nothing calls this directly

Calls 3

errorMethod · 0.80
postAPIFunction · 0.70
addConsoleMessageFunction · 0.70

Tested by

no test coverage detected