From b9e84e4d4a35d0e4b112dab6ddedf20c63a2a4db Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Wed, 18 Mar 2026 13:26:30 +0100 Subject: [PATCH] Restore loadDecoders and fix live listen controls --- web/app.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/web/app.js b/web/app.js index 38ec495..28f8447 100644 --- a/web/app.js +++ b/web/app.js @@ -321,6 +321,25 @@ async function loadSignals() { } catch {} } +async function loadDecoders() { + if (!decodeModeSelect) return; + try { + const res = await fetch('/api/decoders'); + if (!res.ok) return; + const list = await res.json(); + if (!Array.isArray(list)) return; + const current = decodeModeSelect.value; + decodeModeSelect.innerHTML = ''; + list.forEach((mode) => { + const opt = document.createElement('option'); + opt.value = mode; + opt.textContent = mode; + decodeModeSelect.appendChild(opt); + }); + if (current) decodeModeSelect.value = current; + } catch {} +} + async function loadStats() { try { const res = await fetch('/api/stats'); @@ -1226,10 +1245,14 @@ if (liveListenBtn) { if (!first) return; const freq = parseFloat(first.dataset.center); const bw = parseFloat(first.dataset.bw || '12000'); - const mode = first.dataset.class || 'NFM'; - const url = `/api/demod?freq=${freq}&bw=${bw}&mode=${mode}&sec=2`; - const audio = new Audio(url); - audio.play(); + const mode = (listenModeSelect?.value || first.dataset.class || 'NFM'); + const sec = parseInt(listenSecondsInput?.value || '2', 10); + const url = `/api/demod?freq=${freq}&bw=${bw}&mode=${mode}&sec=${sec}`; + if (liveAudio) { + liveAudio.pause(); + } + liveAudio = new Audio(url); + liveAudio.play().catch(() => {}); }); }