mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Force local dashboard assets and quiet BT locate warnings
This commit is contained in:
39
app.py
39
app.py
@@ -96,19 +96,32 @@ def add_security_headers(response):
|
||||
# CONTEXT PROCESSORS
|
||||
# ============================================
|
||||
|
||||
@app.context_processor
|
||||
def inject_offline_settings():
|
||||
"""Inject offline settings into all templates."""
|
||||
from utils.database import get_setting
|
||||
return {
|
||||
'offline_settings': {
|
||||
'enabled': get_setting('offline.enabled', False),
|
||||
'assets_source': get_setting('offline.assets_source', 'cdn'),
|
||||
'fonts_source': get_setting('offline.fonts_source', 'cdn'),
|
||||
'tile_provider': get_setting('offline.tile_provider', 'cartodb_dark_cyan'),
|
||||
'tile_server_url': get_setting('offline.tile_server_url', '')
|
||||
}
|
||||
}
|
||||
@app.context_processor
|
||||
def inject_offline_settings():
|
||||
"""Inject offline settings into all templates."""
|
||||
from utils.database import get_setting
|
||||
|
||||
# Privacy-first defaults: keep dashboard assets/fonts local to avoid
|
||||
# third-party tracker/storage defenses in strict browsers.
|
||||
assets_source = str(get_setting('offline.assets_source', 'local') or 'local').lower()
|
||||
fonts_source = str(get_setting('offline.fonts_source', 'local') or 'local').lower()
|
||||
if assets_source not in ('local', 'cdn'):
|
||||
assets_source = 'local'
|
||||
if fonts_source not in ('local', 'cdn'):
|
||||
fonts_source = 'local'
|
||||
# Force local delivery for core dashboard pages.
|
||||
assets_source = 'local'
|
||||
fonts_source = 'local'
|
||||
|
||||
return {
|
||||
'offline_settings': {
|
||||
'enabled': get_setting('offline.enabled', False),
|
||||
'assets_source': assets_source,
|
||||
'fonts_source': fonts_source,
|
||||
'tile_provider': get_setting('offline.tile_provider', 'cartodb_dark_cyan'),
|
||||
'tile_server_url': get_setting('offline.tile_server_url', '')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# ============================================
|
||||
|
||||
@@ -431,7 +431,7 @@ const BtLocate = (function() {
|
||||
});
|
||||
|
||||
eventSource.onerror = function() {
|
||||
console.warn('[BtLocate] SSE error, polling fallback active');
|
||||
debugLog('[BtLocate] SSE error, polling fallback active');
|
||||
if (eventSource && eventSource.readyState === EventSource.CLOSED) {
|
||||
eventSource = null;
|
||||
}
|
||||
@@ -645,7 +645,7 @@ const BtLocate = (function() {
|
||||
try {
|
||||
mapPointAdded = addMapMarker(d, { suppressFollow: options.suppressFollow === true });
|
||||
} catch (error) {
|
||||
console.warn('[BtLocate] Map update skipped:', error);
|
||||
debugLog('[BtLocate] Map update skipped:', error);
|
||||
mapPointAdded = false;
|
||||
}
|
||||
}
|
||||
@@ -1103,7 +1103,7 @@ const BtLocate = (function() {
|
||||
if (map.hasLayer(heatLayer)) {
|
||||
map.removeLayer(heatLayer);
|
||||
}
|
||||
console.warn('[BtLocate] Heatmap redraw deferred:', error);
|
||||
debugLog('[BtLocate] Heatmap redraw deferred:', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user