Files
mailgoserver/graphify-out/graph.html
T

320 lines
903 KiB
HTML
Raw Normal View History

2026-08-12 12:56:22 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>graphify - graphify-out/graph.html</title>
<script src="https://unpkg.com/vis-network@9.1.6/standalone/umd/vis-network.min.js"
integrity="sha384-Ux6phic9PEHJ38YtrijhkzyJ8yQlH8i/+buBR8s3mAZOJrP1gwyvAcIYl3GWtpX1"
crossorigin="anonymous"></script>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f0f1a; color: #e0e0e0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; height: 100vh; overflow: hidden; }
#graph { flex: 1; }
#sidebar { width: 280px; background: #1a1a2e; border-left: 1px solid #2a2a4e; display: flex; flex-direction: column; overflow: hidden; }
#search-wrap { padding: 12px; border-bottom: 1px solid #2a2a4e; }
#search { width: 100%; background: #0f0f1a; border: 1px solid #3a3a5e; color: #e0e0e0; padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none; }
#search:focus { border-color: #4E79A7; }
#search-results { max-height: 140px; overflow-y: auto; padding: 4px 12px; border-bottom: 1px solid #2a2a4e; display: none; }
.search-item { padding: 4px 6px; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item:hover { background: #2a2a4e; }
#info-panel { padding: 14px; border-bottom: 1px solid #2a2a4e; min-height: 140px; }
#info-panel h3 { font-size: 13px; color: #aaa; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
#info-content { font-size: 13px; color: #ccc; line-height: 1.6; }
#info-content .field { margin-bottom: 5px; }
#info-content .field b { color: #e0e0e0; }
#info-content .empty { color: #555; font-style: italic; }
.neighbor-link { display: block; padding: 2px 6px; margin: 2px 0; border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #333; }
.neighbor-link:hover { background: #2a2a4e; }
#neighbors-list { max-height: 160px; overflow-y: auto; margin-top: 4px; }
#legend-wrap { flex: 1; overflow-y: auto; padding: 12px; }
#legend-wrap h3 { font-size: 13px; color: #aaa; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; border-radius: 4px; font-size: 12px; }
.legend-item:hover { background: #2a2a4e; padding-left: 4px; }
.legend-item.dimmed { opacity: 0.35; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: #666; font-size: 11px; }
#stats { padding: 10px 14px; border-top: 1px solid #2a2a4e; font-size: 11px; color: #555; }
#legend-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px 0; }
#legend-controls label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: #aaa; user-select: none; }
#legend-controls label:hover { color: #e0e0e0; }
.legend-cb, #select-all-cb { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border: 1.5px solid #3a3a5e; border-radius: 3px; background: #0f0f1a; cursor: pointer; position: relative; flex-shrink: 0; }
.legend-cb:checked, #select-all-cb:checked { background: #4E79A7; border-color: #4E79A7; }
.legend-cb:checked::after, #select-all-cb:checked::after { content: ''; position: absolute; left: 3.5px; top: 1px; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#select-all-cb:indeterminate { background: #4E79A7; border-color: #4E79A7; }
#select-all-cb:indeterminate::after { content: ''; position: absolute; left: 2px; top: 5px; width: 8px; height: 2px; background: #fff; border: none; transform: none; }
</style>
</head>
<body>
<div id="graph"></div>
<div id="sidebar">
<div id="search-wrap">
<input id="search" type="text" placeholder="Search nodes..." autocomplete="off">
<div id="search-results"></div>
</div>
<div id="info-panel">
<h3>Node Info</h3>
<div id="info-content"><span class="empty">Click a node to inspect it</span></div>
</div>
<div id="legend-wrap">
<h3>Communities</h3>
<div id="legend-controls">
<label><input type="checkbox" id="select-all-cb" checked onchange="toggleAllCommunities(!this.checked)">Select All</label>
</div>
<div id="legend"></div>
</div>
2026-08-12 21:14:19 +01:00
<div id="stats">1025 nodes &middot; 2084 edges &middot; 69 communities</div>
2026-08-12 12:56:22 +01:00
</div>
<script>
2026-08-12 21:14:19 +01:00
const RAW_NODES = [{"id": "pkg_mailgoserver", "label": "mailgoserver", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "mailgoserver", "community": 68, "community_name": "Project Root", "source_file": "go.mod", "file_type": "code", "degree": 0}, {"id": "internal_config_config", "label": "config.go", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 11.8, "font": {"size": 0, "color": "#ffffff"}, "title": "config.go", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config.go", "file_type": "code", "degree": 4}, {"id": "config_defaultkv", "label": "defaultKV", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "defaultKV", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config.go", "file_type": "code", "degree": 1}, {"id": "internal_config_config_generatesettingsini", "label": "GenerateSettingsIni()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.9, "font": {"size": 0, "color": "#ffffff"}, "title": "GenerateSettingsIni()", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config.go", "file_type": "code", "degree": 2}, {"id": "internal_config_config_load", "label": "Load()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 12.3, "font": {"size": 0, "color": "#ffffff"}, "title": "Load()", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config.go", "file_type": "code", "degree": 5}, {"id": "internal_config_config_go_file", "label": "File", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "File", "community": 29, "community_name": "Config Loading & Settings", "source_file": "", "file_type": "code", "degree": 1}, {"id": "internal_config_config_absolutesqlitepath", "label": "AbsoluteSQLitePath()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 11.4, "font": {"size": 0, "color": "#ffffff"}, "title": "AbsoluteSQLitePath()", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config.go", "file_type": "code", "degree": 3}, {"id": "internal_config_config_test", "label": "config_test.go", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.9, "font": {"size": 0, "color": "#ffffff"}, "title": "config_test.go", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config_test.go", "file_type": "code", "degree": 2}, {"id": "internal_config_config_test_testgenerateandloadroundtrip", "label": "TestGenerateAndLoadRoundTrip()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 11.4, "font": {"size": 0, "color": "#ffffff"}, "title": "TestGenerateAndLoadRoundTrip()", "community": 29, "community_name": "Config Loading & Settings", "source_file": "internal/config/config_test.go", "file_type": "code", "degree": 3}, {"id": "internal_config_config_test_go_t", "label": "T", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.9, "font": {"size": 0, "color": "#ffffff"}, "title": "T", "community": 29, "community_name": "Config Loading & Settings", "source_file": "", "file_type": "code", "degree": 2}, {"id": "internal_config_config_test_testabsolutesqlitepat
const RAW_EDGES = [{"from": "internal_config_config", "to": "config_defaultkv", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config", "to": "internal_config_config_absolutesqlitepath", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config", "to": "internal_config_config_generatesettingsini", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config", "to": "internal_config_config_load", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config_generatesettingsini", "to": "internal_config_config_load", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config_load", "to": "internal_config_config_go_file", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config_load", "to": "internal_config_config_test_testgenerateandloadroundtrip", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "internal_config_config_load", "to": "main_main", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "internal_config_config_absolutesqlitepath", "to": "internal_config_config_test_testabsolutesqlitepath", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "internal_config_config_absolutesqlitepath", "to": "main_main", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "internal_config_config_test", "to": "internal_config_config_test_testabsolutesqlitepath", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config_test", "to": "internal_config_config_test_testgenerateandloadroundtrip", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config_test_testgenerateandloadroundtrip", "to": "internal_config_config_test_go_t", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_config_config_test_go_t", "to": "internal_config_config_test_testabsolutesqlitepath", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_db_admin_models", "to": "db_adminsession", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_db_admin_models", "to": "db_adminuser", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "internal_db_admin_models", "to": "db_webauthncredential", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "db_adminuser", "to": "internal_db_admin_models_go_time", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "db_adminuser", "to": "db_db_getadminuserbyid", "label": "references", "title": "references [EXTR
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Domain Access Web Requests", "count": 91}, {"cid": 1, "color": "#F28E2B", "label": "Admin User &amp; Session Management", "count": 70}, {"cid": 2, "color": "#E15759", "label": "IMAP Fetch/Append Protocol Types", "count": 63}, {"cid": 3, "color": "#76B7B2", "label": "Dashboard &amp; Login Tests", "count": 57}, {"cid": 4, "color": "#59A14F", "label": "Admin Web UI Add-Forms", "count": 54}, {"cid": 5, "color": "#EDC948", "label": "Spam/DKIM Verification &amp; Attachments", "count": 51}, {"cid": 6, "color": "#B07AA1", "label": "Mailbox App Passwords &amp; Schema", "count": 49}, {"cid": 7, "color": "#FF9DA7", "label": "DKIM Web Routes &amp; Tests", "count": 47}, {"cid": 8, "color": "#9C755F", "label": "DKIM Key Management", "count": 44}, {"cid": 9, "color": "#BAB0AC", "label": "Admin Session Auth Middleware", "count": 43}, {"cid": 10, "color": "#4E79A7", "label": "Webmail Session Auth Middleware", "count": 37}, {"cid": 11, "color": "#F28E2B", "label": "Mailbox Alias SMTP Tests", "count": 34}, {"cid": 12, "color": "#E15759", "label": "Mailbox CRUD Queries", "count": 23}, {"cid": 13, "color": "#76B7B2", "label": "Dashboard Web UI", "count": 22}, {"cid": 14, "color": "#59A14F", "label": "Email Log Persistence", "count": 19}, {"cid": 15, "color": "#EDC948", "label": "Mailboxes Web UI Handlers", "count": 17}, {"cid": 16, "color": "#B07AA1", "label": "Admin Dashboard &amp; Deployment Docs", "count": 16}, {"cid": 17, "color": "#FF9DA7", "label": "TLS Cert &amp; Mailstore Master Key", "count": 15}, {"cid": 18, "color": "#9C755F", "label": "Mailbox Rules/Lists/Sessions Queries", "count": 14}, {"cid": 19, "color": "#BAB0AC", "label": "Mailbox App Password Auth", "count": 13}, {"cid": 20, "color": "#4E79A7", "label": "Mailbox Message Storage Queries", "count": 13}, {"cid": 21, "color": "#F28E2B", "label": "Sender/Domain/IP Lookup Queries", "count": 13}, {"cid": 22, "color": "#E15759", "label": "SPF Heuristic Tests", "count": 13}, {"cid": 23, "color": "#76B7B2", "label": "DKIM Key CRUD", "count": 12}, {"cid": 24, "color": "#59A14F", "label": "Domain CRUD", "count": 12}, {"cid": 25, "color": "#EDC948", "label": "Sender CRUD", "count": 12}, {"cid": 26, "color": "#B07AA1", "label": "Outbound Relay Delivery", "count": 12}, {"cid": 27, "color": "#FF9DA7", "label": "Mailbox Allow/Block List", "count": 11}, {"cid": 28, "color": "#9C755F", "label": "IP Whitelist CRUD", "count": 11}, {"cid": 29, "color": "#BAB0AC", "label": "Config Loading &amp; Settings", "count": 10}, {"cid": 30, "color": "#4E79A7", "label": "Mailbox Session/WebAuthn Queries", "count": 10}, {"cid": 31, "color": "#F28E2B", "label": "Toolbox Logger &amp; Utilities", "count": 9}, {"cid": 32, "color": "#E15759", "label": "Mailbox Alias Queries", "count": 8}, {"cid": 33, "color": "#76B7B2", "label": "DKIM Key Queries", "count": 8}, {"cid": 34, "color": "#59A14F", "label": "SMTP Server Listeners", "count": 8}, {"cid": 35, "color": "#EDC948", "label": "Auth/Custom Header Models", "count": 7}, {"cid": 36, "color": "#B07AA1", "label": "Logger Levels", "count": 7}, {"cid": 37, "color": "#FF9DA7", "label": "SMTP Backend &amp; Session", "count": 6}, {"cid": 38, "color": "#9C755F", "label": "Relay Email Logging", "count": 6}, {"cid": 39, "color": "#BAB0AC", "label": "Filter Rule Evaluation", "count": 5}, {"cid": 40, "color": "#4E79A7", "label": "List/Edit Web UI Pages", "count": 5}, {"cid": 41, "color": "#F28E2B", "label": "Login &amp; MFA Setup Pages", "count": 5}, {"cid": 42, "color": "#E15759", "label": "Webmail Auth Handlers", "count": 5}, {"cid": 43, "color": "#76B7B2", "label": "Domain DKIM/Sender Counts", "count": 4}, {"cid": 44, "color": "#59A14F", "label": "SMTP Management JS", "count": 4}, {"cid": 45, "color": "#EDC948", "label": "Login Server Middleware", "count": 3}, {"cid": 46, "color": "#B07AA1", "label": "Mailstore Quota Status", "count": 2}, {"cid": 47, "color": "#FF9DA7", "label": "DKIM Management JS", "count": 2}, {"cid": 48, "color": "#9C755F", "label": "Logs &amp; Message Viewer Pages", "count": 2}, {"cid": 49, "c
2026-08-12 12:56:22 +01:00
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
function esc(s) {
return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');
}
// Build vis datasets
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({
id: n.id, label: n.label, color: n.color, size: n.size,
font: n.font, title: n.title,
_community: n.community, _community_name: n.community_name,
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
})));
const edgesDS = new vis.DataSet(RAW_EDGES.map((e, i) => ({
id: i, from: e.from, to: e.to,
label: '',
title: e.title,
dashes: e.dashes,
width: e.width,
color: e.color,
arrows: { to: { enabled: true, scaleFactor: 0.5 } },
})));
const container = document.getElementById('graph');
const network = new vis.Network(container, { nodes: nodesDS, edges: edgesDS }, {
physics: {
enabled: true,
solver: 'forceAtlas2Based',
forceAtlas2Based: {
gravitationalConstant: -60,
centralGravity: 0.005,
springLength: 120,
springConstant: 0.08,
damping: 0.4,
avoidOverlap: 0.8,
},
stabilization: { iterations: 200, fit: true },
},
interaction: {
hover: true,
tooltipDelay: 100,
hideEdgesOnDrag: true,
navigationButtons: false,
keyboard: false,
},
nodes: { shape: 'dot', borderWidth: 1.5 },
edges: { smooth: { type: 'continuous', roundness: 0.2 }, selectionWidth: 3 },
});
network.once('stabilizationIterationsDone', () => {
network.setOptions({ physics: { enabled: false } });
});
function showInfo(nodeId) {
const n = nodesDS.get(nodeId);
if (!n) return;
const neighborIds = network.getConnectedNodes(nodeId);
const neighborItems = neighborIds.map(nid => {
const nb = nodesDS.get(nid);
const color = nb ? nb.color.background : '#555';
return `<span class="neighbor-link" style="border-left-color:${esc(color)}" data-nid="${esc(nid)}">${esc(nb ? nb.label : nid)}</span>`;
}).join('');
document.getElementById('info-content').innerHTML = `
<div class="field"><b>${esc(n.label)}</b></div>
<div class="field">Type: ${esc(n._file_type || 'unknown')}</div>
<div class="field">Community: ${esc(n._community_name)}</div>
<div class="field">Source: ${esc(n._source_file || '-')}</div>
<div class="field">Degree: ${n._degree}</div>
${neighborIds.length ? `<div class="field" style="margin-top:8px;color:#aaa;font-size:11px">Neighbors (${neighborIds.length})</div><div id="neighbors-list">${neighborItems}</div>` : ''}
`;
}
function focusNode(nodeId) {
network.focus(nodeId, { scale: 1.4, animation: true });
network.selectNodes([nodeId]);
showInfo(nodeId);
}
// Neighbor links use a data attribute + one delegated listener rather than an
// inline onclick. A node id/label sourced from a document or a scraped URL
// (graphify add) can contain a double-quote; dropping the stringified id
// unescaped into a quoted onclick both broke every link and allowed a hostile
// source to inject an event handler into the local report (stored XSS, #1838).
// esc() on data-nid keeps the value inside the attribute; the listener reads it
// back verbatim. Bound to document so it survives the innerHTML rebuild that
// recreates #neighbors-list on each showInfo().
document.addEventListener('click', e => {
const el = e.target.closest('.neighbor-link');
if (el && el.dataset.nid !== undefined) focusNode(el.dataset.nid);
});
// Track hovered node — hover detection is more reliable than click params
let hoveredNodeId = null;
network.on('hoverNode', params => {
hoveredNodeId = params.node;
container.style.cursor = 'pointer';
});
network.on('blurNode', () => {
hoveredNodeId = null;
container.style.cursor = 'default';
});
container.addEventListener('click', () => {
if (hoveredNodeId !== null) {
showInfo(hoveredNodeId);
network.selectNodes([hoveredNodeId]);
}
});
network.on('click', params => {
if (params.nodes.length > 0) {
showInfo(params.nodes[0]);
} else if (hoveredNodeId === null) {
document.getElementById('info-content').innerHTML = '<span class="empty">Click a node to inspect it</span>';
}
});
const searchInput = document.getElementById('search');
const searchResults = document.getElementById('search-results');
searchInput.addEventListener('input', () => {
const q = searchInput.value.toLowerCase().trim();
searchResults.innerHTML = '';
if (!q) { searchResults.style.display = 'none'; return; }
const matches = RAW_NODES.filter(n => n.label.toLowerCase().includes(q)).slice(0, 20);
if (!matches.length) { searchResults.style.display = 'none'; return; }
searchResults.style.display = 'block';
matches.forEach(n => {
const el = document.createElement('div');
el.className = 'search-item';
el.textContent = n.label;
el.style.borderLeft = `3px solid ${n.color.background}`;
el.style.paddingLeft = '8px';
el.onclick = () => {
network.focus(n.id, { scale: 1.5, animation: true });
network.selectNodes([n.id]);
showInfo(n.id);
searchResults.style.display = 'none';
searchInput.value = '';
};
searchResults.appendChild(el);
});
});
document.addEventListener('click', e => {
if (!searchResults.contains(e.target) && e.target !== searchInput)
searchResults.style.display = 'none';
});
const hiddenCommunities = new Set();
const selectAllCb = document.getElementById('select-all-cb');
function updateSelectAllState() {
const total = LEGEND.length;
const hidden = hiddenCommunities.size;
selectAllCb.checked = hidden === 0;
selectAllCb.indeterminate = hidden > 0 && hidden < total;
}
function toggleAllCommunities(hide) {
document.querySelectorAll('.legend-item').forEach(item => {
hide ? item.classList.add('dimmed') : item.classList.remove('dimmed');
});
document.querySelectorAll('.legend-cb').forEach(cb => {
cb.checked = !hide;
});
LEGEND.forEach(c => {
if (hide) hiddenCommunities.add(c.cid); else hiddenCommunities.delete(c.cid);
});
const updates = RAW_NODES.map(n => ({ id: n.id, hidden: hide }));
nodesDS.update(updates);
updateSelectAllState();
}
const legendEl = document.getElementById('legend');
LEGEND.forEach(c => {
const item = document.createElement('div');
item.className = 'legend-item';
const cb = document.createElement('input');
cb.type = 'checkbox';
cb.className = 'legend-cb';
cb.checked = true;
cb.addEventListener('change', (e) => {
e.stopPropagation();
if (cb.checked) {
hiddenCommunities.delete(c.cid);
item.classList.remove('dimmed');
} else {
hiddenCommunities.add(c.cid);
item.classList.add('dimmed');
}
const updates = RAW_NODES
.filter(n => n.community === c.cid)
.map(n => ({ id: n.id, hidden: !cb.checked }));
nodesDS.update(updates);
updateSelectAllState();
});
item.innerHTML = `<div class="legend-dot" style="background:${c.color}"></div>
<span class="legend-label">${c.label}</span>
<span class="legend-count">${c.count}</span>`;
item.prepend(cb);
item.onclick = (e) => {
if (e.target === cb) return;
cb.checked = !cb.checked;
cb.dispatchEvent(new Event('change'));
};
legendEl.appendChild(item);
});
</script>
<script>
// Render hyperedges as shaded regions
2026-08-12 21:14:19 +01:00
const hyperedges = [{"id": "mfa_second_factor_flow", "label": "Optional MFA / Second-Factor Setup Flow", "nodes": ["readme_admin_dashboard_login", "internal_webui_templates_account_account_settings_page", "internal_webui_templates_account_totp_mfa_section", "internal_webui_templates_account_passkey_management"], "relation": "participate_in", "confidence": "INFERRED", "confidence_score": 0.85, "source_file": "internal/webui/templates/account.html"}, {"id": "admin_delegation_crud_flow", "label": "Delegated Admin Management CRUD Flow", "nodes": ["internal_webui_templates_admins_manage_admins_page", "internal_webui_templates_add_admin_add_admin_page", "internal_webui_templates_edit_admin_edit_admin_access_page"], "relation": "form", "confidence": "INFERRED", "confidence_score": 0.85, "source_file": "internal/webui/templates/admins.html"}, {"id": "domain_dns_verification_workflow", "label": "Domain DNS / DKIM / SPF Verification Workflow", "nodes": ["internal_webui_templates_dkim_dkim_key_management_page", "internal_webui_templates_domains_domain_management_page", "internal_webui_templates_add_domain_add_domain_page"], "relation": "participate_in", "confidence": "INFERRED", "confidence_score": 0.8, "source_file": "internal/webui/templates/dkim.html"}, {"id": "ip_whitelist_management_flow", "label": "IP Whitelist Management Flow", "nodes": ["internal_webui_templates_ips_ips_list_page", "internal_webui_templates_edit_ip_edit_ip_whitelist_page", "internal_webui_templates_sidebar_email_sidebar_navigation"], "relation": "participate_in", "confidence": "INFERRED", "confidence_score": 0.8, "source_file": "internal/webui/templates/ips.html"}, {"id": "mfa_authentication_flow", "label": "Multi-Factor Authentication Flow", "nodes": ["internal_webui_templates_login_login_page", "internal_webui_templates_login_mfa_login_mfa_page", "internal_webui_templates_totp_setup_totp_setup_page"], "relation": "form", "confidence": "INFERRED", "confidence_score": 0.8, "source_file": "internal/webui/templates/login_mfa.html"}, {"id": "sender_management_flow", "label": "Sender Management Flow", "nodes": ["internal_webui_templates_senders_senders_list_page", "internal_webui_templates_edit_sender_edit_sender_page", "internal_webui_templates_sidebar_email_sidebar_navigation"], "relation": "participate_in", "confidence": "INFERRED", "confidence_score": 0.8, "source_file": "internal/webui/templates/senders.html"}, {"id": "mailbox_management_flow", "label": "Mailbox Management Flow (Aliases, App Passwords, Lists, Rules)", "nodes": ["internal_webui_templates_mailboxes_mailboxes_list_page", "internal_webui_templates_edit_mailbox_edit_mailbox_page", "internal_webui_templates_mailbox_aliases_aliases_page", "internal_webui_templates_mailbox_apppasswords_app_passwords_page", "internal_webui_templates_mailbox_lists_allow_block_list_page", "internal_webui_templates_mailbox_rules_filter_rules_page"], "relation": "participate_in", "confidence": "INFERRED", "confidence_score": 0.85, "source_file": "internal/webui/templates/edit_mailbox.html"}, {"id": "self_service_webmail_flow", "label": "Self-Service Webmail Login-to-Account Flow", "nodes": ["internal_webui_templates_webmail_login_login_page", "internal_webui_templates_webmail_login_mfa_mfa_verification_page", "internal_webui_templates_webmail_totp_setup_totp_setup_page", "internal_webui_templates_webmail_account_account_dashboard_page"], "relation": "form", "confidence": "INFERRED", "confidence_score": 0.85, "source_file": "internal/webui/templates/webmail_login.html"}, {"id": "admin_base_layout_template_system", "label": "Admin Base Layout Template System", "nodes": ["internal_webui_templates_base_base_layout", "internal_webui_templates_dashboard_dashboard_page", "internal_webui_templates_mailboxes_mailboxes_list_page", "internal_webui_templates_add_mailbox_add_mailbox_page", "internal_webui_templates_edit_mailbox_edit_mailbox_page", "internal_webui_templates_mailbox_aliases_aliases_page", "internal_webui_templates_mailbox_apppasswords_app_passwords_page", "internal_webui_templates_mailbox_lists_allow_block_list_page
2026-08-12 12:56:22 +01:00
// afterDrawing passes ctx already transformed to network coordinate space.
// Draw node positions raw — no manual pan/zoom/DPR math needed.
network.on('afterDrawing', function(ctx) {
hyperedges.forEach(h => {
const positions = h.nodes
.map(nid => network.getPositions([nid])[nid])
.filter(p => p !== undefined);
if (positions.length < 2) return;
ctx.save();
ctx.globalAlpha = 0.12;
ctx.fillStyle = '#6366f1';
ctx.strokeStyle = '#6366f1';
ctx.lineWidth = 2;
ctx.beginPath();
// Centroid and expanded hull in network coordinates
const cx = positions.reduce((s, p) => s + p.x, 0) / positions.length;
const cy = positions.reduce((s, p) => s + p.y, 0) / positions.length;
const expanded = positions.map(p => ({
x: cx + (p.x - cx) * 1.15,
y: cy + (p.y - cy) * 1.15
}));
ctx.moveTo(expanded[0].x, expanded[0].y);
expanded.slice(1).forEach(p => ctx.lineTo(p.x, p.y));
ctx.closePath();
ctx.fill();
ctx.globalAlpha = 0.4;
ctx.stroke();
// Label
ctx.globalAlpha = 0.8;
ctx.fillStyle = '#4f46e5';
ctx.font = 'bold 11px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(h.label, cx, cy - 5);
ctx.restore();
});
});
</script>
</body>
</html>