diff --git a/public/index.html b/public/index.html
index 5023ac7f..11319aa1 100644
--- a/public/index.html
+++ b/public/index.html
@@ -88,7 +88,7 @@
-
+
diff --git a/public/live.js b/public/live.js
index d7ba7f6f..32293aa4 100644
--- a/public/live.js
+++ b/public/live.js
@@ -1098,12 +1098,48 @@
'';
}
+ html += `
`;
+
html += ``;
content.innerHTML = html;
+
+ // Fetch paths asynchronously
+ api('/nodes/' + encodeURIComponent(n.public_key) + '/paths', { ttl: 300 }).then(pathData => {
+ const pathEl = document.getElementById('liveNodePaths');
+ if (!pathEl) return;
+ if (!pathData || !pathData.paths || !pathData.paths.length) {
+ pathEl.innerHTML = '';
+ return;
+ }
+ const COLLAPSE = 5;
+ function renderPathList(paths) {
+ return paths.map(p => {
+ const chain = p.hops.map(h => {
+ const isThis = h.pubkey === n.public_key || (h.prefix && n.public_key.toLowerCase().startsWith(h.prefix.toLowerCase()));
+ const name = escapeHtml(h.name || h.prefix);
+ if (isThis) return `${name}`;
+ return h.pubkey ? `${name}` : name;
+ }).join(' → ');
+ return `${chain} (${p.count}×)
`;
+ }).join('');
+ }
+ pathEl.innerHTML = `Paths Through (${pathData.totalPaths})
` +
+ `` +
+ renderPathList(pathData.paths.slice(0, COLLAPSE)) +
+ (pathData.paths.length > COLLAPSE ? `` : '') +
+ '
';
+ const moreBtn = document.getElementById('showMorePaths');
+ if (moreBtn) moreBtn.addEventListener('click', () => {
+ document.getElementById('livePathsList').innerHTML = renderPathList(pathData.paths);
+ });
+ }).catch(() => {
+ const pathEl = document.getElementById('liveNodePaths');
+ if (pathEl) pathEl.innerHTML = '';
+ });
} catch (e) {
content.innerHTML = `Error: ${e.message}
`;
}