mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Fix APRS stop/start not repopulating stations
- Make stopAprs() async and await backend stop completion before re-enabling the Start button, preventing race where a late stop request kills newly started processes - Add cache-buster param to EventSource URL to prevent browser SSE connection reuse between stop/start cycles - Capture aprs_active_device locally in stream_aprs_output so the old thread's finally block doesn't release a device claimed by a new session Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9687,7 +9687,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
function stopAprs() {
|
||||
async function stopAprs() {
|
||||
const isAgentMode = aprsCurrentAgent !== null;
|
||||
const endpoint = isAgentMode
|
||||
? `/controller/agents/${aprsCurrentAgent}/aprs/stop`
|
||||
@@ -9697,9 +9697,8 @@
|
||||
isAprsRunning = false;
|
||||
aprsCurrentAgent = null;
|
||||
resetAprsAgentStationTracking();
|
||||
document.getElementById('aprsStripStartBtn').style.display = 'inline-block';
|
||||
document.getElementById('aprsStripStopBtn').style.display = 'none';
|
||||
document.getElementById('aprsMapStatus').textContent = 'STANDBY';
|
||||
document.getElementById('aprsMapStatus').textContent = 'STOPPING';
|
||||
document.getElementById('aprsMapStatus').style.color = '';
|
||||
updateAprsStatus('standby');
|
||||
document.getElementById('aprsStripFreq').textContent = '--';
|
||||
@@ -9722,7 +9721,9 @@
|
||||
aprsPollTimer = null;
|
||||
}
|
||||
|
||||
return postStopRequest(endpoint, timeoutMs);
|
||||
await postStopRequest(endpoint, timeoutMs);
|
||||
document.getElementById('aprsStripStartBtn').style.display = 'inline-block';
|
||||
document.getElementById('aprsMapStatus').textContent = 'STANDBY';
|
||||
}
|
||||
|
||||
function startAprsStream(isAgentMode = false) {
|
||||
@@ -9730,7 +9731,7 @@
|
||||
|
||||
// Use different stream endpoint for agent mode
|
||||
const streamUrl = isAgentMode ? '/controller/stream/all' : '/aprs/stream';
|
||||
aprsEventSource = new EventSource(streamUrl);
|
||||
aprsEventSource = new EventSource(streamUrl + (streamUrl.includes('?') ? '&' : '?') + 't=' + Date.now());
|
||||
|
||||
aprsEventSource.onmessage = function (e) {
|
||||
const data = JSON.parse(e.data);
|
||||
|
||||
Reference in New Issue
Block a user