dashboard: support multiple checktype badges
All checks were successful
CI / syntax-check (push) Successful in 2s
CI / memory-leak-check (push) Successful in 10s

This commit is contained in:
Username
2025-12-26 19:34:23 +01:00
parent adbe20dae3
commit 59fe2c4a14
2 changed files with 13 additions and 7 deletions

View File

@@ -13,7 +13,7 @@
<h1>PPF Dashboard <a href="/map" style="font-size:12px;font-weight:normal;color:var(--dim);margin-left:12px">Map</a> <a href="/mitm" style="font-size:12px;font-weight:normal;color:var(--dim);margin-left:8px">MITM Search</a></h1> <h1>PPF Dashboard <a href="/map" style="font-size:12px;font-weight:normal;color:var(--dim);margin-left:12px">Map</a> <a href="/mitm" style="font-size:12px;font-weight:normal;color:var(--dim);margin-left:8px">MITM Search</a></h1>
<div class="status"> <div class="status">
<span class="mode-badge mode-ssl" id="sslBadge" style="display:none">SSL</span> <span class="mode-badge mode-ssl" id="sslBadge" style="display:none">SSL</span>
<span class="mode-badge mode-judges" id="checktypeBadge">-</span> <span id="checktypeBadges"></span>
<span class="mode-badge mode-profile" id="profileBadge" style="display:none">PROFILING</span> <span class="mode-badge mode-profile" id="profileBadge" style="display:none">PROFILING</span>
<div class="status-item"><div class="dot" id="dot"></div><span id="statusTxt">Connecting</span></div> <div class="status-item"><div class="dot" id="dot"></div><span id="statusTxt">Connecting</span></div>
<div class="status-item">Updated: <span id="lastUpdate">-</span></div> <div class="status-item">Updated: <span id="lastUpdate">-</span></div>

View File

@@ -267,12 +267,18 @@ function update(d) {
if (sslBadge) { if (sslBadge) {
sslBadge.style.display = d.use_ssl ? 'inline-block' : 'none'; sslBadge.style.display = d.use_ssl ? 'inline-block' : 'none';
} }
// Check type badge (fallback/secondary indicator) // Check type badges (multiple supported)
var ct = d.checktype || 'unknown'; var ctContainer = $('checktypeBadges');
var ctBadge = $('checktypeBadge'); if (ctContainer) {
if (ctBadge) { var checktypes = (d.checktype || 'unknown').split(',');
ctBadge.textContent = ct.toUpperCase(); var badgeColors = {judges: 'blu', head: 'grn', ssl: 'cyn', irc: 'pur', unknown: 'dim'};
ctBadge.className = 'mode-badge mode-' + ct; var html = '';
checktypes.forEach(function(ct) {
ct = ct.trim();
var color = badgeColors[ct] || 'dim';
html += '<span class="mode-badge mode-' + ct + '" style="background:var(--' + color + ');margin-right:4px">' + ct.toUpperCase() + '</span>';
});
ctContainer.innerHTML = html;
} }
// Profiling badge // Profiling badge
var profBadge = $('profileBadge'); var profBadge = $('profileBadge');