fix: airband start crash when device selector not yet populated

When the /devices fetch hasn't completed or fails, parseInt on an empty
select returns NaN which JSON-serializes to null. The backend then calls
int(None) and raises TypeError. Fix both layers: frontend falls back to
0 on NaN, backend uses `or` defaults so null values don't bypass the
fallback.

Also adds a short TTL cache to detect_all_devices() so multiple
concurrent callers on the same page load don't each spawn blocking
subprocess probes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-03-03 18:56:38 +00:00
parent fb4482fac7
commit 2f5f429e83
4 changed files with 42 additions and 7 deletions

View File

@@ -3652,8 +3652,8 @@ sudo make install</code>
async function startAirband() {
const frequency = getAirbandFrequency();
const device = parseInt(document.getElementById('airbandDeviceSelect').value);
const squelch = parseInt(document.getElementById('airbandSquelch').value);
const device = parseInt(document.getElementById('airbandDeviceSelect').value) || 0;
const squelch = parseInt(document.getElementById('airbandSquelch').value) || 0;
console.log('[AIRBAND] Starting with device:', device, 'freq:', frequency, 'squelch:', squelch);