Fix recursive showNotification call in ISMS module

Renamed local notification helper to ismsNotify to avoid
infinite recursion with global showNotification from audio.js.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-16 11:17:51 +00:00
parent 82835d2346
commit 57fa6d79e0
+25 -25
View File
@@ -147,13 +147,13 @@ function ismsUseGPS() {
ismsLocation.lat = data.position.latitude; ismsLocation.lat = data.position.latitude;
ismsLocation.lon = data.position.longitude; ismsLocation.lon = data.position.longitude;
updateIsmsLocationDisplay(); updateIsmsLocationDisplay();
showNotification('ISMS', 'GPS location acquired'); ismsNotify('ISMS', 'GPS location acquired');
} else { } else {
showNotification('ISMS', 'GPS not available. Connect GPS first.'); ismsNotify('ISMS', 'GPS not available. Connect GPS first.');
} }
}) })
.catch(() => { .catch(() => {
showNotification('ISMS', 'Failed to get GPS position'); ismsNotify('ISMS', 'Failed to get GPS position');
}); });
} }
@@ -242,10 +242,10 @@ async function ismsStartScan() {
ismsPeaks = []; ismsPeaks = [];
updateIsmsFindingsBadges(); updateIsmsFindingsBadges();
} else { } else {
showNotification('ISMS Error', data.message || 'Failed to start scan'); ismsNotify('ISMS Error', data.message || 'Failed to start scan');
} }
} catch (e) { } catch (e) {
showNotification('ISMS Error', 'Failed to start scan: ' + e.message); ismsNotify('ISMS Error', 'Failed to start scan: ' + e.message);
} }
} }
@@ -521,7 +521,7 @@ function updateIsmsStatus(data) {
updateIsmsUI('stopped'); updateIsmsUI('stopped');
if (data.state === 'error') { if (data.state === 'error') {
showNotification('ISMS Error', data.message || 'Scan error'); ismsNotify('ISMS Error', data.message || 'Scan error');
} }
} }
} }
@@ -530,7 +530,7 @@ function updateIsmsStatus(data) {
async function ismsRefreshTowers() { async function ismsRefreshTowers() {
if (!ismsLocation.lat || !ismsLocation.lon) { if (!ismsLocation.lat || !ismsLocation.lon) {
showNotification('ISMS', 'Set location first to query towers'); ismsNotify('ISMS', 'Set location first to query towers');
return; return;
} }
@@ -544,7 +544,7 @@ async function ismsRefreshTowers() {
if (data.status === 'error') { if (data.status === 'error') {
if (towerCountEl) towerCountEl.textContent = data.message; if (towerCountEl) towerCountEl.textContent = data.message;
if (data.config_required) { if (data.config_required) {
showNotification('ISMS', 'OpenCelliD token required. Set OPENCELLID_TOKEN environment variable.'); ismsNotify('ISMS', 'OpenCelliD token required. Set OPENCELLID_TOKEN environment variable.');
} }
return; return;
} }
@@ -689,10 +689,10 @@ async function ismsStartBaselineRecording() {
} }
if (status) status.style.display = 'block'; if (status) status.style.display = 'block';
showNotification('ISMS', 'Baseline recording started'); ismsNotify('ISMS', 'Baseline recording started');
} }
} catch (e) { } catch (e) {
showNotification('ISMS Error', 'Failed to start recording'); ismsNotify('ISMS Error', 'Failed to start recording');
} }
} }
@@ -725,11 +725,11 @@ async function ismsStopBaselineRecording() {
} }
if (status) status.style.display = 'none'; if (status) status.style.display = 'none';
showNotification('ISMS', `Baseline saved: ${data.summary.bands} bands, ${data.summary.towers} towers`); ismsNotify('ISMS', `Baseline saved: ${data.summary.bands} bands, ${data.summary.towers} towers`);
ismsRefreshBaselines(); ismsRefreshBaselines();
} }
} catch (e) { } catch (e) {
showNotification('ISMS Error', 'Failed to save baseline'); ismsNotify('ISMS Error', 'Failed to save baseline');
} }
} }
@@ -748,10 +748,10 @@ function ismsToggleBaselinePanel() {
// ============== UTILITY ============== // ============== UTILITY ==============
function showNotification(title, message) { function ismsNotify(title, message) {
// Use existing notification system if available // Use existing notification system if available (defined in audio.js)
if (typeof window.showNotification === 'function') { if (typeof showNotification === 'function' && showNotification !== ismsNotify) {
window.showNotification(title, message); showNotification(title, message);
} else { } else {
console.log(`[${title}] ${message}`); console.log(`[${title}] ${message}`);
} }
@@ -796,12 +796,12 @@ async function ismsStartGsmScan() {
connectIsmsStream(); connectIsmsStream();
} }
showNotification('ISMS', `GSM scan started on ${band}`); ismsNotify('ISMS', `GSM scan started on ${band}`);
} else { } else {
showNotification('ISMS Error', data.message || 'Failed to start GSM scan'); ismsNotify('ISMS Error', data.message || 'Failed to start GSM scan');
} }
} catch (e) { } catch (e) {
showNotification('ISMS Error', 'Failed to start GSM scan: ' + e.message); ismsNotify('ISMS Error', 'Failed to start GSM scan: ' + e.message);
} }
} }
@@ -879,7 +879,7 @@ function handleGsmScanComplete(data) {
countEl.textContent = data.cell_count || ismsGsmCells.length; countEl.textContent = data.cell_count || ismsGsmCells.length;
} }
showNotification('ISMS', `GSM scan complete: ${data.cell_count} cells found`); ismsNotify('ISMS', `GSM scan complete: ${data.cell_count} cells found`);
} }
function handleGsmStatus(data) { function handleGsmStatus(data) {
@@ -904,7 +904,7 @@ function handleGsmStatus(data) {
statusText.textContent = 'Error'; statusText.textContent = 'Error';
statusText.style.color = 'var(--accent-red)'; statusText.style.color = 'var(--accent-red)';
} }
showNotification('ISMS Error', data.message || 'GSM scan error'); ismsNotify('ISMS Error', data.message || 'GSM scan error');
} }
} }
@@ -957,7 +957,7 @@ function getOperatorName(plmn) {
async function ismsSetGsmBaseline() { async function ismsSetGsmBaseline() {
if (ismsGsmCells.length === 0) { if (ismsGsmCells.length === 0) {
showNotification('ISMS', 'No GSM cells to save. Run a scan first.'); ismsNotify('ISMS', 'No GSM cells to save. Run a scan first.');
return; return;
} }
@@ -970,12 +970,12 @@ async function ismsSetGsmBaseline() {
const data = await response.json(); const data = await response.json();
if (data.status === 'saved') { if (data.status === 'saved') {
showNotification('ISMS', `GSM baseline saved: ${data.cell_count} cells`); ismsNotify('ISMS', `GSM baseline saved: ${data.cell_count} cells`);
} else { } else {
showNotification('ISMS Error', data.message || 'Failed to save baseline'); ismsNotify('ISMS Error', data.message || 'Failed to save baseline');
} }
} catch (e) { } catch (e) {
showNotification('ISMS Error', 'Failed to save GSM baseline'); ismsNotify('ISMS Error', 'Failed to save GSM baseline');
} }
} }