[feat](trx-frontend-http): wire HF APRS toggle button and bookmark decoder

- Add "Enable HF APRS" toggle button to the HF APRS tab (same style as
  FT8/WSPR); button is disabled during TX like other decoder toggles
- app.js: sync button text/colour from SSE state updates
- hf-aprs.js: connect button click to /toggle_hf_aprs_decode
- bookmarks.js: add "HF APRS" checkbox to Add/Edit Bookmark decoder
  section; bmReadDecoders/bmWriteDecoders handle "hf-aprs" key; bmApply
  toggles the decoder to match bookmark preference on recall

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-08 20:43:55 +01:00
parent ac586418fc
commit 26fbd37b6d
4 changed files with 20 additions and 0 deletions
@@ -222,6 +222,7 @@ function applyAuthRestrictions() {
"vdes-clear-btn", "vdes-clear-btn",
"ft8-decode-toggle-btn", "ft8-decode-toggle-btn",
"wspr-decode-toggle-btn", "wspr-decode-toggle-btn",
"hf-aprs-decode-toggle-btn",
"cw-auto", "cw-auto",
"aprs-clear-btn", "aprs-clear-btn",
"ft8-clear-btn", "ft8-clear-btn",
@@ -2476,6 +2477,13 @@ function render(update) {
wsprToggleBtn.style.borderColor = wsprOn ? "#00d17f" : ""; wsprToggleBtn.style.borderColor = wsprOn ? "#00d17f" : "";
wsprToggleBtn.style.color = wsprOn ? "#00d17f" : ""; wsprToggleBtn.style.color = wsprOn ? "#00d17f" : "";
} }
const hfAprsToggleBtn = document.getElementById("hf-aprs-decode-toggle-btn");
if (hfAprsToggleBtn) {
const hfAprsOn = !!update.hf_aprs_decode_enabled;
hfAprsToggleBtn.textContent = hfAprsOn ? "Disable HF APRS" : "Enable HF APRS";
hfAprsToggleBtn.style.borderColor = hfAprsOn ? "#00d17f" : "";
hfAprsToggleBtn.style.color = hfAprsOn ? "#00d17f" : "";
}
const cwAutoEl = document.getElementById("cw-auto"); const cwAutoEl = document.getElementById("cw-auto");
const cwWpmEl = document.getElementById("cw-wpm"); const cwWpmEl = document.getElementById("cw-wpm");
const cwToneEl = document.getElementById("cw-tone"); const cwToneEl = document.getElementById("cw-tone");
@@ -336,6 +336,7 @@
<div class="bm-decoder-checks"> <div class="bm-decoder-checks">
<label class="bm-decoder-check"><input type="checkbox" id="bm-dec-ft8" value="ft8" /> FT8</label> <label class="bm-decoder-check"><input type="checkbox" id="bm-dec-ft8" value="ft8" /> FT8</label>
<label class="bm-decoder-check"><input type="checkbox" id="bm-dec-wspr" value="wspr" /> WSPR</label> <label class="bm-decoder-check"><input type="checkbox" id="bm-dec-wspr" value="wspr" /> WSPR</label>
<label class="bm-decoder-check"><input type="checkbox" id="bm-dec-hf-aprs" value="hf-aprs" /> HF APRS</label>
</div> </div>
</div> </div>
<label class="bm-label bm-label-wide">Comment <label class="bm-label bm-label-wide">Comment
@@ -533,6 +534,7 @@
</div> </div>
<div id="subtab-hf-aprs" class="sub-tab-panel" style="display:none;"> <div id="subtab-hf-aprs" class="sub-tab-panel" style="display:none;">
<div class="ft8-controls aprs-controls"> <div class="ft8-controls aprs-controls">
<button id="hf-aprs-decode-toggle-btn" type="button">Enable HF APRS</button>
<button id="hf-aprs-pause-btn" type="button">Pause</button> <button id="hf-aprs-pause-btn" type="button">Pause</button>
<button id="hf-aprs-clear-btn" type="button">Clear</button> <button id="hf-aprs-clear-btn" type="button">Clear</button>
<input id="hf-aprs-filter" class="ft8-filter" type="text" placeholder="Filter (e.g. SP2, beacon)" /> <input id="hf-aprs-filter" class="ft8-filter" type="text" placeholder="Filter (e.g. SP2, beacon)" />
@@ -150,6 +150,7 @@ function bmReadDecoders() {
const decoders = []; const decoders = [];
if (document.getElementById("bm-dec-ft8").checked) decoders.push("ft8"); if (document.getElementById("bm-dec-ft8").checked) decoders.push("ft8");
if (document.getElementById("bm-dec-wspr").checked) decoders.push("wspr"); if (document.getElementById("bm-dec-wspr").checked) decoders.push("wspr");
if (document.getElementById("bm-dec-hf-aprs").checked) decoders.push("hf-aprs");
return decoders; return decoders;
} }
@@ -158,6 +159,7 @@ function bmWriteDecoders(decoders) {
const list = decoders || []; const list = decoders || [];
document.getElementById("bm-dec-ft8").checked = list.includes("ft8"); document.getElementById("bm-dec-ft8").checked = list.includes("ft8");
document.getElementById("bm-dec-wspr").checked = list.includes("wspr"); document.getElementById("bm-dec-wspr").checked = list.includes("wspr");
document.getElementById("bm-dec-hf-aprs").checked = list.includes("hf-aprs");
} }
function bmOpenForm(bm) { function bmOpenForm(bm) {
@@ -306,6 +308,10 @@ async function bmApply(bm) {
if (wantWspr !== !!st.wspr_decode_enabled) { if (wantWspr !== !!st.wspr_decode_enabled) {
await postPath("/toggle_wspr_decode"); await postPath("/toggle_wspr_decode");
} }
const wantHfAprs = bm.decoders.includes("hf-aprs");
if (wantHfAprs !== !!st.hf_aprs_decode_enabled) {
await postPath("/toggle_hf_aprs_decode");
}
} }
} }
} catch (err) { } catch (err) {
@@ -327,6 +327,10 @@ function addHfAprsPacket(pkt) {
renderHfAprsHistory(); renderHfAprsHistory();
} }
document.getElementById("hf-aprs-decode-toggle-btn")?.addEventListener("click", async () => {
try { await postPath("/toggle_hf_aprs_decode"); } catch (e) { console.error("HF APRS toggle failed", e); }
});
document.getElementById("hf-aprs-clear-btn")?.addEventListener("click", async () => { document.getElementById("hf-aprs-clear-btn")?.addEventListener("click", async () => {
try { try {
await postPath("/clear_hf_aprs_decode"); await postPath("/clear_hf_aprs_decode");