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

Function toggleBluetoothDiscoverable

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

Source from the content-addressed store, hash-verified

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) {
9752 out.innerHTML = '<p class="text-sm text-red-400">Error: ' + escapeHtml((d && d.error) || 'failed') + '</p>';
9753 return;
9754 }
9755 const [cls, label] = _CERT_VERDICT_STYLE[d.verdict] || _CERT_VERDICT_STYLE.unknown;
9756 let html = `<div class="mb-2 px-3 py-2 rounded border ${cls} text-sm">${escapeHtml((d.reasons && d.reasons[0]) || label)}</div>`;
9757 html += `<p class="text-xs text-gray-500 mb-2">${d.graded || 0} graded${d.discovered ? ' · ' + d.discovered + ' discovered passively' : ''}${d.discover_error ? ' · <span class="text-amber-300">discovery: ' + escapeHtml(d.discover_error) + '</span>' : ''}</p>`;
9758 const rows = d.targets || [];
9759 if (rows.length) {
9760 html += '<table class="min-w-full text-xs text-gray-300 whitespace-nowrap"><thead>' +
9761 '<tr class="text-left text-gray-500"><th class="px-2 py-1">Target</th><th class="px-2 py-1">Verdict</th><th class="px-2 py-1">Expires</th><th class="px-2 py-1">Key / Sig</th><th class="px-2 py-1">TLS</th><th class="px-2 py-1">Finding</th></tr>' +
9762 '</thead><tbody>' +
9763 rows.map(t => {
9764 const graded = t.status === 'graded';
9765 const exp = graded ? `${escapeHtml(t.not_after || '?')} <span class="${t.days_left < 0 ? 'text-red-300' : t.days_left <= 21 ? 'text-amber-300' : 'text-gray-500'}">(${t.days_left}d)</span>` : '—';
9766 const keysig = graded ? `${escapeHtml(t.key || '?')} / ${escapeHtml((t.sig_alg || '').toUpperCase())}` : '—';
9767 const proto = graded ? escapeHtml(t.proto || '?') : '—';
9768 const finding = escapeHtml((t.reasons || [])[0] || '');
9769 const sni = t.sni ? ` <span class="text-gray-500">SNI ${escapeHtml(t.sni)}</span>` : '';
9770 return `<tr class="border-t border-slate-800 align-top">
9771 <td class="px-2 py-1 font-mono text-gray-200">${escapeHtml(t.target)}${sni}${t.cert_changed ? ' <span class="text-red-300">⟳changed</span>' : ''}</td>
9772 <td class="px-2 py-1">${_tlsBadge(t.verdict)}</td>
9773 <td class="px-2 py-1 font-mono">${exp}</td>
9774 <td class="px-2 py-1 font-mono text-gray-400">${keysig}</td>
9775 <td class="px-2 py-1 font-mono text-gray-400">${proto}</td>
9776 <td class="px-2 py-1 text-gray-400">${finding}</td>
9777 </tr>`;
9778 }).join('') + '</tbody></table>';
9779 }
9780 if (d.advisories && d.advisories.length) {
9781 html += '<ul class="text-xs text-cyan-400/80 mt-2 list-disc pl-5">' +
9782 d.advisories.map(a => '<li>' + escapeHtml(a) + '</li>').join('') + '</ul>';
9783 }
9784 out.innerHTML = html;
9785 } catch (e) {

Callers

nothing calls this directly

Calls 3

errorMethod · 0.80
postAPIFunction · 0.70
addConsoleMessageFunction · 0.70

Tested by

no test coverage detected