[feat](trx-client): add configurable decode history retention

Add a default decode history retention setting in minutes with per-rig overrides, resolve the active rig retention in the HTTP frontend runtime, and apply that retention consistently across backend decode history buffers and frontend decoder views. This removes fixed APRS, HF APRS, AIS, VDES, FT8, and WSPR browser-side history caps in favor of time-based pruning, and includes the pending longest-QSO card style reset.

Verification: cargo test -p trx-client config
Verification: cargo test -p trx-frontend-http --no-run
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/aprs.js
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/hf-aprs.js
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/ais.js
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/vdes.js
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/ft8.js
Verification: node --check src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/wspr.js
Verification: git diff --check -- src/trx-client/src/config.rs src/trx-client/src/main.rs src/trx-client/trx-frontend/src/lib.rs src/trx-client/trx-frontend/trx-frontend-http/src/api.rs src/trx-client/trx-frontend/trx-frontend-http/src/audio.rs src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/aprs.js src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/hf-aprs.js src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/ais.js src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/vdes.js src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/ft8.js src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/wspr.js

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-14 17:18:09 +01:00
parent 86768c8e7f
commit a924902074
12 changed files with 306 additions and 51 deletions
@@ -8,7 +8,6 @@ const aisBarOverlay = document.getElementById("ais-bar-overlay");
const aisChannelSummaryEl = document.getElementById("ais-channel-summary");
const aisVesselCountEl = document.getElementById("ais-vessel-count");
const aisLatestSeenEl = document.getElementById("ais-latest-seen");
const AIS_MAX_MESSAGES = 200;
const AIS_BAR_WINDOW_MS = 15 * 60 * 1000;
const AIS_DEFAULT_A_HZ = 161_975_000;
const AIS_CHANNEL_SPACING_HZ = 50_000;
@@ -17,6 +16,17 @@ let aisMessageHistory = [];
let aisPaused = false;
let aisBufferedWhilePaused = 0;
function currentAisHistoryRetentionMs() {
return typeof window.getDecodeHistoryRetentionMs === "function"
? window.getDecodeHistoryRetentionMs()
: 24 * 60 * 60 * 1000;
}
function pruneAisMessageHistory() {
const cutoffMs = Date.now() - currentAisHistoryRetentionMs();
aisMessageHistory = aisMessageHistory.filter((msg) => Number(msg?._tsMs) >= cutoffMs);
}
function scheduleAisUi(key, job) {
if (typeof window.trxScheduleUiFrameJob === "function") {
window.trxScheduleUiFrameJob(key, job);
@@ -295,6 +305,7 @@ window.resetAisHistoryView = function() {
};
function renderAisHistory() {
pruneAisMessageHistory();
if (!aisMessagesEl || aisPaused) {
updateAisSummary();
return;
@@ -317,7 +328,7 @@ function addAisMessage(msg) {
});
aisMessageHistory.unshift(msg);
if (aisMessageHistory.length > AIS_MAX_MESSAGES) aisMessageHistory.length = AIS_MAX_MESSAGES;
pruneAisMessageHistory();
scheduleAisBarUpdate();
if (aisPaused) {
@@ -332,6 +343,12 @@ function addAisMessage(msg) {
}
}
window.pruneAisHistoryView = function() {
pruneAisMessageHistory();
updateAisBar();
renderAisHistory();
};
if (aisClearBtn) {
aisClearBtn.addEventListener("click", async () => {
try {