From b0fece16c85f5bbe64be59703ddd0df51efa1339 Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 5 Jun 2026 08:52:36 +0200 Subject: [PATCH] Fix: CSP worker-src 'self' blob: (SW-Registrierung war durch blob:-only blockiert) + Vektor-Basemap auf Staging default-an MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - worker-src blob: hatte sw.js (same-origin) blockiert → SW-Registrierung schlug app-weit fehl → alter SW servierte stale ui.js → UI.map.vectorLayer undefined → stiller Raster-Fallback - _vectorMapEnabled: Staging default AN (Reifephase), Prod AUS bis Freigabe, Flag überschreibt --- VERSION | 2 +- backend/main.py | 2 +- backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 2 +- backend/static/js/ui.js | 9 +++++++-- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index 3352d4f..dea24de 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1176 \ No newline at end of file +1177 \ No newline at end of file diff --git a/backend/main.py b/backend/main.py index 077c42c..a077881 100644 --- a/backend/main.py +++ b/backend/main.py @@ -111,7 +111,7 @@ class SecurityHeadersMiddleware(BaseHTTPMiddleware): response.headers["Content-Security-Policy"] = ( "default-src 'self'; " "script-src 'self' https://umami.motocamp.de; " # ohne unsafe-inline/eval — alle Inline-Scripts extrahiert - "worker-src blob:; " # MapLibre GL spawnt Web-Worker aus blob-URLs (Tile-Server) + "worker-src 'self' blob:; " # 'self' = Service Worker (sw.js); blob: = MapLibre-GL-Worker "style-src 'self' 'unsafe-inline'; " # Inline-Styles bleiben (zu viele Fundstellen für jetzt) "img-src 'self' data: blob: https:; " "connect-src 'self' https:; " diff --git a/backend/static/index.html b/backend/static/index.html index 97f3692..964f064 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,14 +86,14 @@ Ban Yaro - + - - - - - + + + + + @@ -617,11 +617,11 @@ - - - - - + + + + + @@ -631,7 +631,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 533079f..cb2129d 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '1176'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1177'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator) window.APP_VERSION = APP_VERSION; diff --git a/backend/static/js/ui.js b/backend/static/js/ui.js index 7dd0f12..8b7beb4 100644 --- a/backend/static/js/ui.js +++ b/backend/static/js/ui.js @@ -869,14 +869,19 @@ const UI = (() => { return _protomapsPromise; } - // Feature-Flag: localStorage 'by_vector_map'==='1'. ?vectormap=1/0 setzt ihn (Testing). + // Feature-Flag Vektor-Basemap: ?vectormap=1/0 setzt localStorage 'by_vector_map'. + // Default: auf Staging AN (Reifephase), auf Produktion AUS bis zur Freigabe. + // Explizit überschreibbar per Flag (1=an, 0=aus) — gilt auch in der installierten PWA. function _vectorMapEnabled() { try { const u = new URLSearchParams(location.search); if (u.has('vectormap')) { localStorage.setItem('by_vector_map', u.get('vectormap') === '0' ? '0' : '1'); } - return localStorage.getItem('by_vector_map') === '1'; + const flag = localStorage.getItem('by_vector_map'); + if (flag === '1') return true; + if (flag === '0') return false; + return /(^|\.)staging\.banyaro\.app$/.test(location.hostname); } catch (e) { return false; } } diff --git a/backend/static/landing.html b/backend/static/landing.html index 2cf65fe..62af3f8 100644 --- a/backend/static/landing.html +++ b/backend/static/landing.html @@ -4,7 +4,7 @@ - + Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz diff --git a/backend/static/sw.js b/backend/static/sw.js index 6035887..c45ba47 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -4,7 +4,7 @@ ============================================================ */ // ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab -const VER = '1176'; +const VER = '1177'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten