From cfdb7e85d0ddc46b4ed4e5e635d05b18f4b50acd Mon Sep 17 00:00:00 2001 From: you Date: Sat, 21 Mar 2026 03:47:32 +0000 Subject: [PATCH] fix: add paths section to mobile full-screen node view (loadFullNode) --- public/index.html | 2 +- public/nodes.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 11319aa1..c74c72c9 100644 --- a/public/index.html +++ b/public/index.html @@ -85,7 +85,7 @@ - + diff --git a/public/nodes.js b/public/nodes.js index 5c0ea528..c27272d8 100644 --- a/public/nodes.js +++ b/public/nodes.js @@ -151,6 +151,11 @@ ` : ''} +
+

Paths Through This Node

+
Loading paths…
+
+

Recent Packets (${adverts.length})

@@ -208,6 +213,44 @@ } catch {} } + // Fetch paths through this node (full-screen view) + api('/nodes/' + encodeURIComponent(n.public_key) + '/paths', { ttl: CLIENT_TTL.nodeDetail }).then(pathData => { + const el = document.getElementById('fullPathsContent'); + if (!el) return; + if (!pathData || !pathData.paths || !pathData.paths.length) { + el.innerHTML = '
No paths observed through this node
'; + return; + } + document.querySelector('#fullPathsSection h4').textContent = `Paths Through This Node (${pathData.totalPaths} unique, ${pathData.totalTransmissions} transmissions)`; + const COLLAPSE_LIMIT = 10; + function renderPaths(paths) { + return paths.map(p => { + const chain = p.hops.map(h => { + const isThis = h.pubkey === n.public_key; + const name = escapeHtml(h.name || h.prefix); + const link = h.pubkey ? `${name}` : `${name}`; + return link; + }).join(' → '); + return `
+
${chain}
+
${p.count}× · last ${timeAgo(p.lastSeen)} · Analyze →
+
`; + }).join(''); + } + if (pathData.paths.length <= COLLAPSE_LIMIT) { + el.innerHTML = renderPaths(pathData.paths); + } else { + el.innerHTML = renderPaths(pathData.paths.slice(0, COLLAPSE_LIMIT)) + + ``; + document.getElementById('showAllFullPaths').addEventListener('click', function() { + el.innerHTML = renderPaths(pathData.paths); + }); + } + }).catch(() => { + const el = document.getElementById('fullPathsContent'); + if (el) el.innerHTML = '
Failed to load paths
'; + }); + } catch (e) { body.innerHTML = `
Failed to load node: ${e.message}
`; }