[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:
@@ -9,7 +9,6 @@ const hfAprsCollapseDupBtn = document.getElementById("hf-aprs-collapse-dup-btn")
|
||||
const hfAprsTotalCountEl = document.getElementById("hf-aprs-total-count");
|
||||
const hfAprsVisibleCountEl = document.getElementById("hf-aprs-visible-count");
|
||||
const hfAprsLatestSeenEl = document.getElementById("hf-aprs-latest-seen");
|
||||
const HF_APRS_MAX_PACKETS = 100;
|
||||
let hfAprsFilterText = "";
|
||||
let hfAprsPacketHistory = [];
|
||||
let hfAprsPaused = false;
|
||||
@@ -19,6 +18,17 @@ let hfAprsHideCrc = false;
|
||||
let hfAprsCollapseDup = false;
|
||||
let hfAprsTypeFilter = "all";
|
||||
|
||||
function currentHfAprsHistoryRetentionMs() {
|
||||
return typeof window.getDecodeHistoryRetentionMs === "function"
|
||||
? window.getDecodeHistoryRetentionMs()
|
||||
: 24 * 60 * 60 * 1000;
|
||||
}
|
||||
|
||||
function pruneHfAprsPacketHistory() {
|
||||
const cutoffMs = Date.now() - currentHfAprsHistoryRetentionMs();
|
||||
hfAprsPacketHistory = hfAprsPacketHistory.filter((pkt) => Number(pkt?._tsMs) >= cutoffMs);
|
||||
}
|
||||
|
||||
function scheduleHfAprsHistoryRender() {
|
||||
if (typeof window.trxScheduleUiFrameJob === "function") {
|
||||
window.trxScheduleUiFrameJob("hf-aprs-history", () => renderHfAprsHistory());
|
||||
@@ -296,6 +306,7 @@ function renderHfAprsRow(pkt, isFresh) {
|
||||
}
|
||||
|
||||
function renderHfAprsHistory() {
|
||||
pruneHfAprsPacketHistory();
|
||||
if (!hfAprsPacketsEl || hfAprsPaused) {
|
||||
updateHfAprsSummary();
|
||||
updateHfAprsChipState();
|
||||
@@ -318,13 +329,18 @@ window.resetHfAprsHistoryView = function() {
|
||||
renderHfAprsHistory();
|
||||
};
|
||||
|
||||
window.pruneHfAprsHistoryView = function() {
|
||||
pruneHfAprsPacketHistory();
|
||||
renderHfAprsHistory();
|
||||
};
|
||||
|
||||
function addHfAprsPacket(pkt) {
|
||||
const tsMs = Number.isFinite(pkt.ts_ms) ? Number(pkt.ts_ms) : Date.now();
|
||||
pkt._tsMs = tsMs;
|
||||
pkt._ts = new Date(tsMs).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
||||
|
||||
hfAprsPacketHistory.unshift(pkt);
|
||||
if (hfAprsPacketHistory.length > HF_APRS_MAX_PACKETS) hfAprsPacketHistory.length = HF_APRS_MAX_PACKETS;
|
||||
pruneHfAprsPacketHistory();
|
||||
|
||||
if (hfAprsPaused) {
|
||||
hfAprsBufferedWhilePaused += 1;
|
||||
|
||||
Reference in New Issue
Block a user