From 410225d54d4eefab3ba995f85d6186c97d5cb57f Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 13 May 2026 09:33:38 +0100 Subject: [PATCH] fix(drone): conform to established SPA patterns throughout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Device population: move refreshDroneDevices() inline to index.html (same pattern as refreshTscmDevices) and call it from switchMode alongside DroneMode.init(); remove _refreshDevices/populateSelect from drone.js which was never guaranteed to run before lazy-load completed, causing selects to stay on "Loading…" permanently - IIFE pattern: change from named IIFE + window.DroneMode assignment to var DroneMode = (function(){...return{...}})() matching OOK/ SpyStations convention - Init guard: add _initialized flag (OOK state.initialized pattern); re-entry after destroy() re-registers map/SSE cleanly without duplicating click listeners on every mode switch - Lifecycle: destroy() resets _initialized = false so map and SSE are correctly rebuilt on re-entry - Stop phase: add isDroneRunning tracking variable in index.html; _setRunningUI() syncs it; switchMode stop phase now POSTs /drone/stop when leaving drone mode while active, matching TSCM - /drone/devices: add monitor_capable field to WiFi interfaces, add running_as_root and warnings array to response (mirrors /tscm/devices shape); add os import; show privilege warning div in drone.html when not running as root - drone.html: remove for= attribute from SDR label (plain