CI / lint (pull_request) Successful in 2m24s
CI / test (pull_request) Successful in 8m34s
CI / test (push) Successful in 7m47s
CI / frontend (pull_request) Successful in 4m28s
CI / reuse (pull_request) Successful in 5s
CI / lint (push) Successful in 2m21s
CI / frontend (push) Successful in 3m37s
CI / reuse (push) Successful in 6s
A client connected to several rigs decodes all of them at once, and the decode stream carries every rig's traffic to every browser. The decoder panels listed all of it: a station a background rig copied on another band appeared in the APRS list next to the selected rig's, the vessel counts and the "latest seen" lines counted both, the status lines said "Receiving" because some other rig was, and the CW pane interleaved two rigs into one stream of text that read as neither. The page is about the rig the operator selected — the one whose spectrum is on screen and whose audio is playing — so each panel now shows what that rig heard: rows, counts, latest-seen, status, the live picture a WEFAX or SSTV frame is painting, and the CW pane. Nothing is dropped on the way in. The map is the whole station's view, has its own rig filter, and would empty out if the plugins stopped feeding it, so the histories still hold every rig and the map still plots them. That also means a switch loses nothing: the runtime gained a rerender hook, which the rig switch calls, and switching back brings the other rig's traffic up again. The CW pane is the exception — a running stream of text cannot be unpicked after the fact — so it starts empty on the rig switched to. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyX26FCpMQxiBoC7r5K1A7 Signed-off-by: Stan Grams <sjg@haxx.space>
27 lines
1.3 KiB
TypeScript
27 lines
1.3 KiB
TypeScript
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
|
//
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import { hostState } from "./host.js";
|
|
|
|
// The decode stream is not rig-scoped: every rig a client is connected to sends
|
|
// its decodes to every browser, each frame naming the rig that heard it (the
|
|
// client stamps `rig_id` as it leaves the audio connection). The map wants all
|
|
// of them — it has its own filter, and plotting only one rig would empty it —
|
|
// but the radio page and the decoder panels describe one rig at a time: the one
|
|
// the operator selected, whose spectrum is on screen and whose audio is
|
|
// playing. A frame a background rig copied on another band belongs to neither
|
|
// picture, so both filter on this.
|
|
export function isActiveRigDecode(rigId: string | null | undefined): boolean {
|
|
const activeRigId = hostState.lastActiveRigId;
|
|
// Before the rig list has arrived, and for a decode that reached the browser
|
|
// without a rig of its own, there is nothing to disagree with.
|
|
if (!activeRigId || !rigId) return true;
|
|
return rigId === activeRigId;
|
|
}
|
|
|
|
/** The decodes of `items` that the selected rig heard, in their original order. */
|
|
export function forActiveRig<T extends { rig_id?: string | null | undefined }>(items: T[]): T[] {
|
|
return items.filter((item) => isActiveRigDecode(item.rig_id));
|
|
}
|