[fix](trx-frontend-http): fix bookmark decoder wiring

Two issues prevented bookmark decoder toggles from working:

1. bmPrefillFromStatus() did not prefill decoder checkboxes from the
   current toggle button state, so bookmarks were saved with an empty
   decoders array even when decoders were active.

2. The bookmark apply code fetched /status without the remote parameter,
   comparing against the wrong rig's decoder state in multi-rig setups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-04-03 22:30:48 +02:00
parent 0a8e004a62
commit 96dcbbe8f1
@@ -298,6 +298,15 @@ function bmPrefillFromStatus() {
if (typeof currentBandwidthHz === "number" && currentBandwidthHz > 0) { if (typeof currentBandwidthHz === "number" && currentBandwidthHz > 0) {
document.getElementById("bm-bw").value = Math.round(currentBandwidthHz); document.getElementById("bm-bw").value = Math.round(currentBandwidthHz);
} }
// Prefill decoder checkboxes from current toggle button state.
const activeDecoders = (window.decoderRegistry || [])
.filter(d => d.bookmark_selectable && d.activation === "toggle")
.filter(d => {
const btn = document.getElementById(d.id + "-decode-toggle-btn");
return btn && btn.dataset.enabled === "true";
})
.map(d => d.id);
bmWriteDecoders(activeDecoders);
} }
async function bmSave(e) { async function bmSave(e) {
@@ -445,7 +454,11 @@ async function bmApply(bm) {
); );
const shouldToggle = hasDecoders && toggleDecoders.length > 0; const shouldToggle = hasDecoders && toggleDecoders.length > 0;
const decoderPromise = shouldToggle ? (async () => { const decoderPromise = shouldToggle ? (async () => {
const statusResp = await fetch("/status"); let statusUrl = "/status";
if (typeof lastActiveRigId !== "undefined" && lastActiveRigId) {
statusUrl += "?remote=" + encodeURIComponent(lastActiveRigId);
}
const statusResp = await fetch(statusUrl);
if (statusResp.ok) { if (statusResp.ok) {
const st = await statusResp.json(); const st = await statusResp.json();
const toggles = []; const toggles = [];