[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:
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user