[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:
@@ -4,13 +4,23 @@ const wsprPeriodEl = document.getElementById("wspr-period");
|
||||
const wsprMessagesEl = document.getElementById("wspr-messages");
|
||||
const wsprFilterInput = document.getElementById("wspr-filter");
|
||||
const wsprPauseBtn = document.getElementById("wspr-pause-btn");
|
||||
const WSPR_MAX_MESSAGES = 200;
|
||||
const WSPR_PERIOD_SECONDS = 120;
|
||||
let wsprFilterText = "";
|
||||
let wsprMessageHistory = [];
|
||||
let wsprPaused = false;
|
||||
let wsprBufferedWhilePaused = 0;
|
||||
|
||||
function currentWsprHistoryRetentionMs() {
|
||||
return typeof window.getDecodeHistoryRetentionMs === "function"
|
||||
? window.getDecodeHistoryRetentionMs()
|
||||
: 24 * 60 * 60 * 1000;
|
||||
}
|
||||
|
||||
function pruneWsprMessageHistory() {
|
||||
const cutoffMs = Date.now() - currentWsprHistoryRetentionMs();
|
||||
wsprMessageHistory = wsprMessageHistory.filter((msg) => Number(msg?._tsMs ?? msg?.ts_ms) >= cutoffMs);
|
||||
}
|
||||
|
||||
function scheduleWsprHistoryRender() {
|
||||
if (typeof window.trxScheduleUiFrameJob === "function") {
|
||||
window.trxScheduleUiFrameJob("wspr-history", () => renderWsprHistory());
|
||||
@@ -59,6 +69,7 @@ function updateWsprPauseUi() {
|
||||
}
|
||||
|
||||
function renderWsprHistory() {
|
||||
pruneWsprMessageHistory();
|
||||
if (!wsprMessagesEl || wsprPaused) {
|
||||
updateWsprPauseUi();
|
||||
return;
|
||||
@@ -72,8 +83,9 @@ function renderWsprHistory() {
|
||||
}
|
||||
|
||||
function addWsprMessage(msg) {
|
||||
msg._tsMs = Number.isFinite(msg?.ts_ms) ? Number(msg.ts_ms) : Date.now();
|
||||
wsprMessageHistory.unshift(msg);
|
||||
if (wsprMessageHistory.length > WSPR_MAX_MESSAGES) wsprMessageHistory.length = WSPR_MAX_MESSAGES;
|
||||
pruneWsprMessageHistory();
|
||||
if (wsprPaused) {
|
||||
wsprBufferedWhilePaused += 1;
|
||||
updateWsprPauseUi();
|
||||
@@ -82,6 +94,11 @@ function addWsprMessage(msg) {
|
||||
scheduleWsprHistoryRender();
|
||||
}
|
||||
|
||||
window.pruneWsprHistoryView = function() {
|
||||
pruneWsprMessageHistory();
|
||||
renderWsprHistory();
|
||||
};
|
||||
|
||||
function escapeWsprHtml(input) {
|
||||
return input
|
||||
.replaceAll("&", "&")
|
||||
|
||||
Reference in New Issue
Block a user