diff --git a/web/app.py b/web/app.py index 4d4fc9e..495862a 100644 --- a/web/app.py +++ b/web/app.py @@ -134,7 +134,11 @@ async def security_headers(request: Request, call_next): "default-src 'self'; " "script-src 'self' https://cdn.tailwindcss.com https://unpkg.com; " "style-src 'self' https://cdn.tailwindcss.com https://unpkg.com 'unsafe-inline'; " - "img-src 'self' data: https://*.tile.openstreetmap.org https://tile.openstreetmap.org https://unpkg.com; " + "img-src 'self' data: " + "https://*.tile.openstreetmap.org https://tile.openstreetmap.org " + "https://*.basemaps.cartocdn.com https://basemaps.cartocdn.com " + "https://*.tiles.openrailwaymap.org https://tiles.openrailwaymap.org " + "https://unpkg.com; " "connect-src 'self'; frame-ancestors 'none';" ) return resp diff --git a/web/static/map.js b/web/static/map.js index 9f6ec13..4f7e85d 100644 --- a/web/static/map.js +++ b/web/static/map.js @@ -48,7 +48,6 @@ function renderMarkers(data) { markerLayer = L.layerGroup().addTo(mapInstance); } - const bounds = []; data.forEach((f) => { if (typeof f.lat !== "number" || typeof f.lng !== "number") return; const rent = f.rent ? Math.round(f.rent) + " €" : ""; @@ -61,14 +60,7 @@ function renderMarkers(data) { `${safeAddr}` + (meta ? `
${meta}` : "") + `
Zur Anzeige →`, ); - bounds.push([f.lat, f.lng]); }); - - if (bounds.length === 1) { - mapInstance.setView(bounds[0], 14); - } else if (bounds.length > 1) { - mapInstance.fitBounds(bounds, { padding: [30, 30] }); - } } function buildMap(el) { @@ -81,10 +73,18 @@ function buildMap(el) { touchZoom: false, keyboard: false, }).setView(BERLIN_CENTER, BERLIN_ZOOM); - L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { - attribution: "© OpenStreetMap", - maxZoom: 18, + // CartoDB Voyager — clean, Google-Maps-ish base style. + L.tileLayer("https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png", { + attribution: "© OpenStreetMap · © CARTO", + subdomains: "abcd", + maxZoom: 19, + }).addTo(mapInstance); + // Transit overlay — OpenRailwayMap highlights S-/U-/Tram-Linien. + L.tileLayer("https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png", { + attribution: "© OpenRailwayMap", subdomains: "abc", + maxZoom: 19, + opacity: 0.75, }).addTo(mapInstance); markerLayer = L.layerGroup().addTo(mapInstance); }