diff options
| author | tv <tv@krebsco.de> | 2026-11-09 02:39:04 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-09 02:39:04 +0000 |
| commit | 51c7a4c2588b3f4064ba116276796741b3170de6 (patch) | |
| tree | 47741a7920ebe95c798aea1749781e6445d0bfbb /src/api | |
| parent | 8a6ed7cc711e797542a531091b3bdbc73e5f61e4 (diff) | |
dashboard: no subscription to this node itself
A page opened from another node's page takes that page's subscriptions
along; one of them can be this node, another there. The page then
followed this node as a subscribed one too, and showed its messages
twice, from its own log and from the subscription (`→ LLL PING` and
`LLL ← RRR PING`, the same message), on the map as in the console.
The page follows no subscription of its own node: not when it knows
which node it is, and one begun before that stops once it does; its
messages, if any came, are left out.
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/dashboard/dashboard.html | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index 0be3526..d173418 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -2810,7 +2810,11 @@ async function obtainTokens() { } } // Follows `id`'s own links, again after a while if it fails (2 s, doubling to a minute). +// Not this node itself (a subscription handed over from another node's page, where it +// was another): its links and messages are the page's own already, and read twice +// they'd show twice. function follow(id, delay = 2000) { + if (state && id === state.node.id) return; const old = subscribed.get(id); if (old) old.stop(); const controller = new AbortController(); @@ -3552,7 +3556,7 @@ function ownMessagesArrived(list, sent) { // sent): each message once. Each named by both ends (`from`, `to`) and the node that // logged it (`node`), its number and exchange made its own (`node:seq`). function remoteMessagesArrived(id, entry, list, sent) { - if (!state) return; + if (!state || id === state.node.id) return; noteStream(id, list, sent); const self = state.node.id; // Its messages come whole, those since the last event, up to the latest 500: one @@ -4056,6 +4060,9 @@ function connect() { remakesArrived(); if (treeShown && writerTree === null) loadTree(); if (token === null && tokenTimer === null) obtainTokens(); + // Followed before the page knew which node it is: not any more. + const own = subscribed.get(state.node.id); + if (own) { own.stop(); subscribed.delete(state.node.id); } for (const id of subscriptions) if (!subscribed.has(id)) follow(id); }); events.addEventListener("patch", event => { |
