From 96dcbbe8f12e38bea7ed0471b566eb2cc564b3a4 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Fri, 3 Apr 2026 22:30:48 +0200 Subject: [PATCH] [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 Signed-off-by: Stan Grams --- .../assets/web/plugins/bookmarks.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/bookmarks.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/bookmarks.js index 6154670..397006e 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/bookmarks.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/bookmarks.js @@ -298,6 +298,15 @@ function bmPrefillFromStatus() { if (typeof currentBandwidthHz === "number" && currentBandwidthHz > 0) { 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) { @@ -445,7 +454,11 @@ async function bmApply(bm) { ); const shouldToggle = hasDecoders && toggleDecoders.length > 0; 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) { const st = await statusResp.json(); const toggles = [];