| Packet ID | From | To | +Channel | Port | @@ -240,6 +254,7 @@ function logPacketTimes(packet) { let lastImportTimeUs = null; let updatesPaused = false; let updateInterval = 3000; +let selectedChannel = ""; async function configureFirehose() { try { @@ -249,6 +264,36 @@ async function configureFirehose() { } catch {} } +async function loadChannels() { + try { + const res = await fetch("/api/channels"); + if (!res.ok) return; + + const data = await res.json(); + const select = document.getElementById("channel-filter"); + const channels = data.channels || []; + + for (const channel of channels) { + const option = document.createElement("option"); + option.value = channel; + option.textContent = channel; + select.appendChild(option); + } + } catch (err) { + console.error("Failed loading channels:", err); + } +} + +function resetFirehose() { + lastImportTimeUs = null; + document.getElementById("packet_list").innerHTML = ""; +} + +function matchesSelectedChannel(packet) { + if (!selectedChannel) return true; + return (packet.channel || "").toLowerCase() === selectedChannel.toLowerCase(); +} + async function fetchUpdates() { if (updatesPaused) return; @@ -269,6 +314,8 @@ async function fetchUpdates() { const list = document.getElementById("packet_list"); for (const pkt of packets.reverse()) { + if (!matchesSelectedChannel(pkt)) continue; + logPacketTimes(pkt); /* FROM — includes translation */ @@ -343,12 +390,13 @@ async function fetchUpdates() {${from} | ${to} | +${pkt.channel || "—"} | ${portLabel(pkt.portnum, pkt.payload, inlineLinks)} | ||
|---|---|---|---|---|---|---|---|---|---|---|
| ${safePayload} | +${safePayload} | |||||||||