mirror of
https://github.com/smittix/intercept.git
synced 2026-07-13 12:08:12 -07:00
Fix agent/local mode state sync and process cleanup
Agent fixes: - Fix stop not killing secondary processes (pager_rtl, aprs_rtl, rtlamr_tcp) - Modes using piped processes now properly terminate all child processes UI state sync fixes: - Add syncLocalModeStates() to check local status when switching to local - Fix switchMode() to re-sync with agent/local when changing mode tabs - Only stop local modes when actually in local mode - UI now correctly reflects running state when switching agents or modes
This commit is contained in:
+19
-7
@@ -2092,16 +2092,28 @@
|
||||
|
||||
// Mode switching
|
||||
function switchMode(mode) {
|
||||
// Stop any running scans when switching modes
|
||||
if (isRunning) stopDecoding();
|
||||
if (isSensorRunning) stopSensorDecoding();
|
||||
if (isWifiRunning) stopWifiScan();
|
||||
if (isBtRunning) stopBtScan();
|
||||
if (isAprsRunning) stopAprs();
|
||||
if (isTscmRunning) stopTscmSweep();
|
||||
// Only stop local scans if in local mode (not agent mode)
|
||||
const isAgentMode = typeof currentAgent !== 'undefined' && currentAgent !== 'local';
|
||||
if (!isAgentMode) {
|
||||
if (isRunning) stopDecoding();
|
||||
if (isSensorRunning) stopSensorDecoding();
|
||||
if (isWifiRunning) stopWifiScan();
|
||||
if (isBtRunning) stopBtScan();
|
||||
if (isAprsRunning) stopAprs();
|
||||
if (isTscmRunning) stopTscmSweep();
|
||||
}
|
||||
|
||||
currentMode = mode;
|
||||
|
||||
// Sync mode state with current agent/local after switching
|
||||
if (isAgentMode && typeof syncAgentModeStates === 'function') {
|
||||
// Re-sync with agent to update this mode's UI state
|
||||
syncAgentModeStates(currentAgent);
|
||||
} else if (!isAgentMode && typeof syncLocalModeStates === 'function') {
|
||||
// Sync with local status
|
||||
syncLocalModeStates();
|
||||
}
|
||||
|
||||
// Close dropdowns and update active state
|
||||
closeAllDropdowns();
|
||||
updateDropdownActiveState();
|
||||
|
||||
Reference in New Issue
Block a user