diff options
| author | tv <tv@krebsco.de> | 2026-11-09 05:22:14 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-09 06:30:44 +0100 |
| commit | b2c5096744c99453856f7281251b3f0cb4b9baae (patch) | |
| tree | cf1ff79be48513eda4b901c7197b452c557547d7 /src/transport/traffic.rs | |
| parent | d7e3d9f8310aa40903f43272fbb30f37a1f68c2b (diff) | |
dashboard: a subscribed node's message written out, read from it when shown
A subscribed node's messages come without being written out (their stream leaves the
text out: up to 8 KiB each, 500 at a time), so the figures box said only when, both
ends, type and size of one. Now the node answers for one message by its number,
`GET /admin/dashboard/messages/own/{seq}` (`{"text": …}`, `404` once it isn't kept),
which pages of other origins may call as they do its streams (`cors::open`), and the
page reads it when the message is shown, with its narrow token, and keeps it on the
message. Where it can't be read, the box says why.
Diffstat (limited to 'src/transport/traffic.rs')
| -rw-r--r-- | src/transport/traffic.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs index bac0da7..5ff588e 100644 --- a/src/transport/traffic.rs +++ b/src/transport/traffic.rs @@ -325,6 +325,16 @@ impl MessageLog { } /// The messages after `seq`, the latest `most` of them. + /// The message `seq` written out, while it is kept. + pub(crate) fn text_of(&self, seq: u64) -> Option<String> { + let inner = self.inner.lock_or_recover(); + inner + .entries + .iter() + .find(|entry| entry.seq == seq) + .map(|entry| entry.text.clone()) + } + pub(crate) fn after(&self, seq: u64, most: usize) -> Vec<Logged> { let inner = self.inner.lock_or_recover(); let newer: Vec<&Logged> = inner.entries.iter().filter(|e| e.seq > seq).collect(); |
