From 695908f937a68a3620c3cd59d2cc8f5d2fcaf9cf Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 09:18:28 +0200 Subject: [PATCH 01/15] Rechtsseiten oeffentlich erreichbar: Hash-Routing ohne Login + Pfad-Redirects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - app.js init(): Hash-Route wird auch ohne Login angesteuert — vorher wurden anonyme Besucher IMMER auf 'welcome' geworfen, #agb/#datenschutz/#impressum liefen damit ins Leere (DSGVO-Problem, broken Links aus iOS-App + SEO-Footer). Auth-pflichtige Seiten schuetzt weiterhin der requiresAuth-Guard in navigate(). - main.py: /agb, /datenschutz, /impressum -> 302 auf die SPA-Hash-Routen (vor dem SPA-Fallback registriert) - make bump: v1221 --- VERSION | 2 +- backend/main.py | 12 ++++++++++++ backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 8 ++++++-- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/VERSION b/VERSION index ededf28..35c53b6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1220 \ No newline at end of file +1221 \ No newline at end of file diff --git a/backend/main.py b/backend/main.py index bf4f74b..e399801 100644 --- a/backend/main.py +++ b/backend/main.py @@ -2601,6 +2601,18 @@ async def wurfboerse_page(): return HTMLResponse(content=html, headers={"Cache-Control": "max-age=1800"}) +# Rechtsseiten: Pfad-URLs (SEO-Footer, App-Store-Metadaten, E-Mails) auf die +# SPA-Hash-Routen umleiten — die Inhalte leben als SPA-Seiten (#agb, …). +# Muss VOR dem SPA-Fallback registriert sein. +@app.get("/agb") +@app.get("/datenschutz") +@app.get("/impressum") +async def legal_page_redirect(request: _Request): + from fastapi.responses import RedirectResponse + page = request.url.path.strip("/") + return RedirectResponse(f"/#{page}", status_code=302) + + # SPA Fallback — ALLE nicht-API-Routen gehen zur index.html @app.get("/{full_path:path}") async def spa_fallback(full_path: str): diff --git a/backend/static/index.html b/backend/static/index.html index 9b1271c..5555dbd 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 a55f2a6..9462986 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 = '1220'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1221'; // ← 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; @@ -1198,7 +1198,11 @@ const App = (() => { } const startPage = (hashPage && pages[hashPage]) ? hashPage : 'welcome'; - navigate(state.user ? startPage : 'welcome', false, hashParams); + // Hash-Route auch ohne Login ansteuern — öffentliche Seiten (AGB, + // Datenschutz, Impressum, …) müssen für anonyme Besucher erreichbar sein. + // Auth-pflichtige Seiten leitet navigate() über den requiresAuth-Guard + // selbst auf 'welcome' um. + navigate(startPage, false, hashParams); if (window.Worlds && state.user) window.Worlds.init(state); } diff --git a/backend/static/landing.html b/backend/static/landing.html index ddc5d3d..e19f5f0 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 c168f51..c514aff 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 = '1220'; +const VER = '1221'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten From 30e82b79313290e77b08752ba0f7474d9ac100b3 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 10:13:56 +0200 Subject: [PATCH 02/15] POI-Refresh: Abdeckung auf alle 15 Tile-Laender erweitert (war nur DACH) Der monatliche DSM-Job fragte nur germany/austria/switzerland ab, die Karte deckt aber TILES_REGIONS (DACH + 12 Anrainer) ab -> POIs fehlten ausserhalb DACH. Laenderliste jetzt in docker-compose.osm.yml als Env gesetzt (wirkt ohne Image-Rebuild) und als Default in refresh.sh gespiegelt. --- docker-compose.osm.yml | 5 ++++- tools/osm-extract/refresh.sh | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docker-compose.osm.yml b/docker-compose.osm.yml index c786098..e496720 100644 --- a/docker-compose.osm.yml +++ b/docker-compose.osm.yml @@ -12,5 +12,8 @@ services: - ./data:/data # gleiche DB wie die App (/data/banyaro.db) environment: - DB_PATH=/data/banyaro.db - # - COUNTRIES=switzerland austria germany # bei Bedarf überschreiben + # Abdeckung = TILES_REGIONS im Makefile — Karten- und POI-Abdeckung + # synchron halten! Env überschreibt den Default in refresh.sh, daher + # wirkt eine Änderung hier OHNE Image-Rebuild. + - COUNTRIES=germany austria switzerland france italy czech-republic poland slovakia hungary slovenia netherlands belgium luxembourg denmark liechtenstein restart: "no" diff --git a/tools/osm-extract/refresh.sh b/tools/osm-extract/refresh.sh index 903ed27..a2f9ec9 100644 --- a/tools/osm-extract/refresh.sh +++ b/tools/osm-extract/refresh.sh @@ -11,7 +11,9 @@ set -euo pipefail DB="${DB_PATH:-/data/banyaro.db}" WORK="${WORK_DIR:-/work}" -COUNTRIES="${COUNTRIES:-switzerland austria germany}" +# Default = TILES_REGIONS im Makefile (Karten- und POI-Abdeckung synchron halten). +# Produktiv setzt docker-compose.osm.yml die Liste zusätzlich per Env. +COUNTRIES="${COUNTRIES:-germany austria switzerland france italy czech-republic poland slovakia hungary slovenia netherlands belgium luxembourg denmark liechtenstein}" GEOFABRIK="${GEOFABRIK_BASE:-https://download.geofabrik.de/europe}" KEEP_BACKUPS="${KEEP_BACKUPS:-3}" PREBUILT_SQLITE="${PREBUILT_SQLITE:-}" From 70a1f5856a034c9288860cce717568a2f7077fd4 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 11:03:46 +0200 Subject: [PATCH 03/15] Offline-Karten Follow-ups: Staging-Default AN, Karten-Download-Button, Glyph-Persistenz - by_offline_tiles Default AN auf staging.banyaro.app (localStorage/?tilesoffline=1/0 uebersteuert) - Speed-Dial 'Karte offline speichern': GL -> MapOffline.downloadAround(Kartenmitte, 5km), Leaflet -> alter Raster-Prefetch (_cacheTiles war seit FAB-Redesign verwaist) - Glyphs in IndexedDB (Key-Praefix f/) + byt://f/-Protokoll: ueberlebt App-Updates - OSM-Raster-Prefetch im Offline-Tiles-Modus uebersprungen (GL nutzt das Raster nicht) - Button-Sichtbarkeit gated: GL ohne Offline-Flag (= Production) zeigt ihn nicht --- backend/static/js/boot.js | 4 +++ backend/static/js/map-gl-style.js | 18 +++++++--- backend/static/js/map-offline.js | 43 +++++++++++++++++------ backend/static/js/offline-indicator.js | 13 +++++-- backend/static/js/pages/map.js | 47 ++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 16 deletions(-) diff --git a/backend/static/js/boot.js b/backend/static/js/boot.js index 85becee..8a8421c 100644 --- a/backend/static/js/boot.js +++ b/backend/static/js/boot.js @@ -24,6 +24,10 @@ // MapLibre-GL-Karte (zentrale Karte) aus ?mapgl=1/0 — wird in pages/map.js _useGL() ausgewertet. var mg = new URLSearchParams(location.search).get('mapgl'); if (mg !== null) localStorage.setItem('by_map_gl', mg === '0' ? '0' : '1'); + // Offline-Vektorkacheln (byt://) aus ?tilesoffline=1/0 — wird in map-gl-style.js + // _offlineEnabled() ausgewertet (Staging-Default AN, localStorage übersteuert). + var to = new URLSearchParams(location.search).get('tilesoffline'); + if (to !== null) localStorage.setItem('by_offline_tiles', to === '0' ? '0' : '1'); } catch (e) {} })(); diff --git a/backend/static/js/map-gl-style.js b/backend/static/js/map-gl-style.js index 9a02bc9..97da80d 100644 --- a/backend/static/js/map-gl-style.js +++ b/backend/static/js/map-gl-style.js @@ -12,10 +12,16 @@ var TILES_VER = '20260605'; function tilesUrl() { return window.location.origin + '/tiles/' + TILES_FILE + '?v=' + TILES_VER; } - // Offline-Tiles-Modus (byt://-Quelle). Opt-in via localStorage by_offline_tiles='1' bzw. ?tilesoffline=1. - // Default AUS, bis auf Gerät verifiziert — dann hier auf Staging-Default umstellen (analog by_map_gl). + // Offline-Tiles-Modus (byt://-Quelle). localStorage by_offline_tiles bzw. ?tilesoffline=1/0 übersteuert. + // Staging-Default AN seit 2026-06-06 (Gerätetest); Production bleibt AUS bis Freigabe (dann analog by_map_gl). + // ACHTUNG: Default-Logik synchron halten mit offline-indicator.js _offlineTilesMode(). function _offlineEnabled() { - try { return localStorage.getItem('by_offline_tiles') === '1'; } catch (e) { return false; } + try { + var flag = localStorage.getItem('by_offline_tiles'); + if (flag === '1') return true; + if (flag === '0') return false; + return location.hostname === 'staging.banyaro.app'; + } catch (e) { return false; } } var THEMES = { @@ -52,7 +58,11 @@ : { type: 'vector', url: 'pmtiles://' + tilesUrl() }; return { version: 8, - glyphs: window.location.origin + '/fonts/{fontstack}/{range}.pbf', + // Offline-Modus: Glyphs übers byt://f/-Protokoll (IndexedDB-first, remote-Fallback) — + // der SW-Cache für /fonts wird bei App-Updates gepurged, IndexedDB nicht. + glyphs: useOffline + ? 'byt://f/{fontstack}/{range}' + : window.location.origin + '/fonts/{fontstack}/{range}.pbf', sources: { by: src, }, diff --git a/backend/static/js/map-offline.js b/backend/static/js/map-offline.js index 76741ee..78db35c 100644 --- a/backend/static/js/map-offline.js +++ b/backend/static/js/map-offline.js @@ -52,17 +52,22 @@ window.MapOffline = (function () { }); } - // MapLibre-Protokoll `byt://t/{z}/{x}/{y}` registrieren (idempotent). + // MapLibre-Protokolle registrieren (idempotent): + // byt://t/{z}/{x}/{y} → Vektorkachel (MVT) + // byt://f/{fontstack}/{range} → Glyph-PBF (fontstack ggf. URL-encodiert, je nach MapLibre-Version) function registerProtocol() { if (registerProtocol._done || typeof maplibregl === 'undefined') return; registerProtocol._done = true; maplibregl.addProtocol('byt', function (params) { - var m = /byt:\/\/t\/(\d+)\/(\d+)\/(\d+)/.exec(params.url); - if (!m) return Promise.resolve({ data: new ArrayBuffer(0) }); - return tile(+m[1], +m[2], +m[3]).then(function (u) { + var ret = function (u) { if (!u) return { data: new ArrayBuffer(0) }; return { data: u.buffer.slice(u.byteOffset, u.byteOffset + u.byteLength) }; - }); + }; + var t = /byt:\/\/t\/(\d+)\/(\d+)\/(\d+)/.exec(params.url); + if (t) return tile(+t[1], +t[2], +t[3]).then(ret); + var f = /byt:\/\/f\/([^/]+)\/(\d+-\d+)/.exec(params.url); + if (f) return glyph(decodeURIComponent(f[1]), f[2]).then(ret); + return Promise.resolve({ data: new ArrayBuffer(0) }); }); } @@ -82,21 +87,39 @@ window.MapOffline = (function () { return list; } - // Glyphs (Open Sans Regular/Semibold, Latin + Latin-Extended) holen, damit der Service-Worker sie cacht. + // Glyphs (Open Sans Regular/Semibold, Latin + Latin-Extended) in IndexedDB persistieren + // (Key-Präfix 'f/' im Tiles-Store, kein Schema-Bump) — überlebt App-Updates, anders als der + // SW-Cache, der beim Update gepurged wird. Offline serviert übers byt://f/-Protokoll. // KRITISCH: ohne Glyphs lässt MapLibre offline die GANZE Kachel fallen (nicht nur die Labels) → leer. - // 0-255 + 256-511 deckt DE/FR/PL/CZ/IT-Sonderzeichen ab. (Persistenz über App-Updates = Follow-up.) + // 0-255 + 256-511 deckt DE/FR/PL/CZ/IT-Sonderzeichen ab. var FONTS = ['Open Sans Regular', 'Open Sans Semibold'], RANGES = ['0-255', '256-511']; + function _glyphUrl(font, range) { return '/fonts/' + encodeURIComponent(font) + '/' + range + '.pbf'; } function _cacheGlyphs() { var bytes = 0, jobs = []; FONTS.forEach(function (f) { RANGES.forEach(function (rg) { - jobs.push(fetch('/fonts/' + encodeURIComponent(f) + '/' + rg + '.pbf') + jobs.push(fetch(_glyphUrl(f, rg)) .then(function (r) { return r.ok ? r.arrayBuffer() : null; }) - .then(function (b) { if (b) bytes += b.byteLength; }) + .then(function (b) { + if (!b) return; + bytes += b.byteLength; + return _put('f/' + f + '/' + rg, new Uint8Array(b)); + }) .catch(function () {})); }); }); return Promise.all(jobs).then(function () { return bytes; }); } + // Glyph-Bytes für fontstack/range — IndexedDB zuerst, sonst remote (online), sonst null. + function glyph(font, range) { + return _get('f/' + font + '/' + range).then(function (hit) { + if (hit) return hit instanceof Uint8Array ? hit : new Uint8Array(hit); + return fetch(_glyphUrl(font, range)) + .then(function (r) { return r.ok ? r.arrayBuffer() : null; }) + .then(function (b) { return b ? new Uint8Array(b) : null; }) + .catch(function () { return null; }); + }); + } + // Bereich um lat/lon (radiusKm, Default 5) herunterladen + in IndexedDB ablegen. // onProgress({done,total,bytes}). Liefert {tiles,bytes}. function downloadAround(lat, lon, radiusKm, onProgress) { @@ -135,7 +158,7 @@ window.MapOffline = (function () { } return { - registerProtocol: registerProtocol, downloadAround: downloadAround, tile: tile, + registerProtocol: registerProtocol, downloadAround: downloadAround, tile: tile, glyph: glyph, stats: stats, hasRegion: hasRegion, clear: clear, MAXZOOM: MAXZOOM, }; })(); diff --git a/backend/static/js/offline-indicator.js b/backend/static/js/offline-indicator.js index 55e93b1..7d7e9c4 100644 --- a/backend/static/js/offline-indicator.js +++ b/backend/static/js/offline-indicator.js @@ -21,8 +21,15 @@ window.OfflineIndicator = (() => { } // GL-Offline-Tiles-Modus (byt://-Vektorkacheln in IndexedDB) statt OSM-Raster. + // Default-Logik MUSS map-gl-style.js _offlineEnabled() entsprechen (Staging-AN seit 2026-06-06); + // dupliziert weil map-gl-style.js lazy mit der GL-Karte lädt, dieses Modul aber sofort. function _offlineTilesMode() { - try { return localStorage.getItem('by_offline_tiles') === '1'; } catch (e) { return false; } + try { + const flag = localStorage.getItem('by_offline_tiles'); + if (flag === '1') return true; + if (flag === '0') return false; + return location.hostname === 'staging.banyaro.app'; + } catch (e) { return false; } } // Ist eine Offline-Region (Vektorkacheln) in IndexedDB gespeichert? (ohne MapOffline zu laden) // WICHTIG: dasselbe Schema/Version wie map-offline.js anlegen — sonst legt ein versionsloses open() @@ -373,7 +380,9 @@ window.OfflineIndicator = (() => { function init() { refresh(); _prefetchPages(); - _prefetchTiles(); + // OSM-Raster-Prefetch nur für die Leaflet-Karte — die GL-Karte (byt://-Vektorkacheln) + // nutzt das Raster nicht. Komplett-Entfernung wenn Flag dauerhaft AN (OFFLINE_MAPS_PLAN.md). + if (!_offlineTilesMode()) _prefetchTiles(); _prefetchData(); _bindLongPress(); diff --git a/backend/static/js/pages/map.js b/backend/static/js/pages/map.js index 9f06461..75d0d30 100644 --- a/backend/static/js/pages/map.js +++ b/backend/static/js/pages/map.js @@ -257,6 +257,11 @@ window.Page_map = (() => { Marker setzen + ${(!_useGL() || _offlineTilesEnabled()) ? ` +
+ Karte offline speichern + +
` : ''} ${App.hasPro(_appState?.user) ? `
Regenradar @@ -368,6 +373,11 @@ window.Page_map = (() => { _sdEl?.classList.remove('open'); _togglePlacementMode(); }); + document.getElementById('map-offline-btn')?.addEventListener('click', () => { + _sdEl?.classList.remove('open'); + if (_engineGL) _downloadVectorRegion(); // GL: Vektorkacheln → IndexedDB (byt://) + else _cacheTiles(); // Leaflet: OSM-Raster → SW-Cache + }); document.getElementById('map-radar-btn')?.addEventListener('click', () => { _sdEl?.classList.remove('open'); _toggleRadar(); @@ -763,6 +773,18 @@ window.Page_map = (() => { } catch (e) { return false; } } + // Offline-Vektorkacheln-Flag — gleiche Default-Logik wie map-gl-style.js _offlineEnabled() + // (dupliziert, weil map-gl-style.js erst mit der GL-Karte lazy lädt, das Markup aber sofort rendert). + // Steuert nur die Button-Sichtbarkeit: im GL-Modus ohne byt://-Quelle wäre der Download nutzlos. + function _offlineTilesEnabled() { + try { + const flag = localStorage.getItem('by_offline_tiles'); + if (flag === '1') return true; + if (flag === '0') return false; + return location.hostname === 'staging.banyaro.app'; + } catch (e) { return false; } + } + function loadMapLibre() { if (_maplibreLoaded) return Promise.resolve(); const v = '?v=' + (window.APP_VER || ''); @@ -2115,6 +2137,31 @@ window.Page_map = (() => { return urls; } + // GL-Modus: Vektorkacheln (5 km um die Kartenmitte) + Glyphs → IndexedDB (byt://). + // Gegenstück zum Welten-FAB-Download (GPS-Position) — hier zählt die KARTENMITTE, + // damit man eine entfernte Gegend (Urlaubsort) vorab speichern kann. docs/OFFLINE_MAPS_PLAN.md + async function _downloadVectorRegion() { + if (!_map || !window.MapOffline) return; + const btn = document.getElementById('map-offline-btn'); + if (btn?.classList.contains('loading')) return; // läuft bereits + const c = _map.getCenter(); + btn?.classList.add('loading'); + _setOsmStatus('Offline: 0 %…'); + try { + const res = await MapOffline.downloadAround(c.lat, c.lng, 5, p => { + _setOsmStatus(`Offline: ${Math.round(p.done / p.total * 100)} %…`); + }); + _setOsmStatus(''); + UI.toast.success(`Gegend offline gespeichert — ${res.tiles} Kacheln, ${(res.bytes / 1048576).toFixed(1)} MB.`); + window.OfflineIndicator?.refresh(); // Pfoten-Segment 5 sofort grün + } catch (e) { + _setOsmStatus(''); + UI.toast.error('Offline-Download fehlgeschlagen — bitte erneut versuchen.'); + } finally { + btn?.classList.remove('loading'); + } + } + async function _cacheTiles() { if (!_map) return; if (!('serviceWorker' in navigator) || !navigator.serviceWorker.controller) { From de25901fa242d79fbaf5c05500ed688af2da4092 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 11:05:22 +0200 Subject: [PATCH 04/15] Rechtsseiten-Hash-Links bleiben in der SPA statt /info-Redirect fuer anonyme Besucher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #impressum/#datenschutz/#agb setzen jetzt by_stay_in_app — vorher schlug _checkAuth anonym fehl und welcome.js leitete auf /info um (blitzte kurz auf). Betraf iOS-App-Links, App-Store-Metadaten und /impressum-Pfad-Redirects. Fix uebernommen aus banyaro-ios-Handoff (relevant fuer Build-6-Resubmit). --- backend/static/js/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 9462986..07a14ea 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -1123,7 +1123,12 @@ const App = (() => { const _rawHash = location.hash.replace('#', ''); const _hashQuery = _rawHash.split('?')[1] || ''; const _hashP = new URLSearchParams(_hashQuery); - if (_hashP.get('verified') || _hashP.get('token') || location.pathname.startsWith('/teilen/')) { + // Rechtsseiten direkt verlinkt (iOS-App, App-Store-Metadaten, E-Mails, + // /impressum-Redirects) → ebenfalls in App bleiben statt /info + const _hashPage = _rawHash.split('?')[0]; + const _legalPages = ['impressum', 'datenschutz', 'agb']; + if (_hashP.get('verified') || _hashP.get('token') || location.pathname.startsWith('/teilen/') + || _legalPages.includes(_hashPage)) { sessionStorage.setItem('by_stay_in_app', '1'); } From 8e623d8909e244c01884571f02eefddc88d17fbc Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 11:05:35 +0200 Subject: [PATCH 05/15] Bump v1222 (SW-Cache fuer Offline-Follow-ups + Impressum-Fix) --- VERSION | 2 +- backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 2 +- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/VERSION b/VERSION index 35c53b6..904b8f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1221 \ No newline at end of file +1222 \ No newline at end of file diff --git a/backend/static/index.html b/backend/static/index.html index 5555dbd..579e5c6 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 07a14ea..a273e12 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 = '1221'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1222'; // ← 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/landing.html b/backend/static/landing.html index e19f5f0..f4d7b6d 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 c514aff..f09fbd6 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 = '1221'; +const VER = '1222'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten From c5bdad2d8650b2827d45bec00f1940d6d2a9452d Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 11:07:42 +0200 Subject: [PATCH 06/15] Offline-Plan: Follow-ups Runde 1 dokumentiert (Staging-AN v1222, Runde 2 offen) --- docs/OFFLINE_MAPS_PLAN.md | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/docs/OFFLINE_MAPS_PLAN.md b/docs/OFFLINE_MAPS_PLAN.md index 73135e3..3fafa26 100644 --- a/docs/OFFLINE_MAPS_PLAN.md +++ b/docs/OFFLINE_MAPS_PLAN.md @@ -1,28 +1,41 @@ # Offline-Karten (GL/Vektor) — Feature-Plan -**Status:** KERN UMGESETZT + headless verifiziert (2026-06-05, v1213), **flag-gated `by_offline_tiles` (Default AUS)** bis Gerätetest. -**Stand:** 2026-06-05. Autor: René + Claude (Design). +**Status:** KERN + Follow-ups Runde 1 umgesetzt, **Staging-Default AN seit 2026-06-06 (v1222)** — Gerätetest ausstehend; Production AUS bis Freigabe. +**Stand:** 2026-06-06. Autor: René + Claude (Design). -## Umsetzungsstand (2026-06-05) -**✅ Fertig + headless bewiesen:** +## Umsetzungsstand (2026-06-06, v1222 auf Staging) +**✅ Fertig + headless bewiesen (2026-06-05, v1213):** - `map-offline.js` (`window.MapOffline`): Region-Download (`downloadAround(lat,lon,radiusKm)`) → Vektorkacheln z0–14 via `pmtiles.getZxy` (liefert bereits dekomprimierte MVT) + Glyphs in **IndexedDB** (`by-offline-tiles`). `byt://`-MapLibre-Protokoll (IndexedDB-first, remote-Fallback). ~15 MB / 5 km (dekomprimiert). -- `map-gl-style.js` `build({offline})`: `byt`-Source statt `pmtiles://`. Flag `by_offline_tiles` (Default AUS). +- `map-gl-style.js` `build({offline})`: `byt`-Source statt `pmtiles://`. - ui.js/map.js laden map-offline + registrieren `byt`. `UI.loadMapLibreUI` exportiert. - Welten-FAB Segment 5: prüft im GL-Modus gespeicherte Region (nicht mehr OSM-Raster); „Fehlende nachladen" stößt `MapOffline.downloadAround(GPS, 5km)` an. - **Beweis:** Download 97 Tiles (5 km München) → Netz AUS → **1903 Features gerendert**, nicht geladene Gegend (Paris) leer; Glyphs nötig (sonst lässt MapLibre offline die ganze Kachel fallen). -**🔲 Offen (Follow-ups):** -- **Gerätetest (iOS-PWA offline/IndexedDB)** → dann Flag-Default auf Staging-AN (analog `by_map_gl`). -- Download-Button auf der **Karte** (`map-offline-btn`) im GL-Modus auf `downloadAround(Karten-Center)` umbiegen - (bisher OSM-Raster-Prefetch). +**✅ Follow-ups Runde 1 (2026-06-06, v1222):** +- **Flag-Default Staging-AN:** `by_offline_tiles` Default AN auf `staging.banyaro.app`, AUS sonst; + localStorage `1`/`0` bzw. `?tilesoffline=1/0` (boot.js) übersteuert. Default-Logik 3× synchron: + `map-gl-style.js _offlineEnabled()`, `offline-indicator.js _offlineTilesMode()`, `pages/map.js _offlineTilesEnabled()`. +- **Karten-Download-Button:** Speed-Dial „Karte offline speichern" (`map-offline-btn`, war seit FAB-Redesign + verwaist) — GL-Modus → `downloadAround(Kartenmitte, 5 km)` mit Fortschritt in der Statusbar (Kartenmitte + statt GPS: Urlaubsort vorab speicherbar); Leaflet-Modus → alter Raster-Prefetch (`_cacheTiles`). + Sichtbarkeit gated: GL ohne Offline-Flag (= Production) zeigt den Button nicht. +- **Glyph-Persistenz:** Glyphs in IndexedDB (Key-Präfix `f/` im Tiles-Store, kein Schema-Bump) + Protokoll + `byt://f/{fontstack}/{range}` (IndexedDB-first, remote-Fallback); Style nutzt offline die byt-Glyph-URL + → überlebt App-Updates (SW-Cache wird gepurged, IndexedDB nicht). +- **Raster-Prefetch gegated:** `offline-indicator.js init()` überspringt `_prefetchTiles()` im + Offline-Tiles-Modus (GL nutzt das OSM-Raster nicht). + +**🔲 Offen (Follow-ups Runde 2):** +- **Gerätetest (iOS-PWA offline/IndexedDB)** auf Staging — jetzt ohne Flag-Frickelei möglich (Default AN). + Danach: Prod-Freigabe-Entscheidung (Default-Hostnames erweitern analog `by_map_gl`). - **Adaptives Lernen** (rollendes Vorausladen beim Aufzeichnen + Funkloch-Gedächtnis). - **Bereichsauswahl / Routen-Korridor** (inkl. „Route offline speichern" aus routes.js `_openDetail`). -- **Glyph-Persistenz** über App-Updates (aktuell SW-Cache, wird bei Update gepurged) → in IndexedDB ablegen + via `byt://f/` servieren. -- Alten OSM-Raster-Prefetch (`offline-indicator.js _prefetchTiles`) entfernen, wenn Flag dauerhaft AN. +- Alten OSM-Raster-Prefetch (`offline-indicator.js _prefetchTiles` + `map.js _cacheTiles`) komplett + entfernen, wenn Flag dauerhaft AN (auch Prod). ## Ziel GL-Vektorkarten offline-tauglich machen — Kernszenario **Gassi/Wandern im Funkloch**. From e2c75f04bcfccbacaa71c47c348ab049c7014d08 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 11:25:40 +0200 Subject: [PATCH 07/15] Offline-Karten: POI-Marker offlinetauglich + Offline-Banner klappt ein (Geraetetest-Befunde) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MapOffline.downloadAround speichert zusaetzlich /api/osm/pois je Typ fuer die Region-Bbox in IndexedDB (Key-Praefix p/, Merge per id — zweite Region loescht die erste nicht); MapOffline.pois(type,bbox) filtert fuer den Ausschnitt - map.js Phase-1-Fallback: Fetch fehlgeschlagen (offline) -> gespeicherte Region-POIs statt leerer Karte; Download-Toast zeigt Marker-Anzahl - Offline-Banner: nach 5s auf schmale Icon-Leiste eingeklappt (verdeckte die Karten-Legende); Inline-Styles nach components.css konsolidiert - Bump v1223 --- VERSION | 2 +- backend/static/css/components.css | 19 ++++++++-- backend/static/index.html | 33 +++++++--------- backend/static/js/app.js | 2 +- backend/static/js/boot.js | 8 ++++ backend/static/js/map-offline.js | 63 +++++++++++++++++++++++++++---- backend/static/js/pages/map.js | 12 +++++- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 9 files changed, 106 insertions(+), 37 deletions(-) diff --git a/VERSION b/VERSION index 904b8f9..de697b5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1222 \ No newline at end of file +1223 \ No newline at end of file diff --git a/backend/static/css/components.css b/backend/static/css/components.css index 87dea9c..5b2a7dd 100644 --- a/backend/static/css/components.css +++ b/backend/static/css/components.css @@ -7294,14 +7294,25 @@ svg.empty-state-icon { left: 0; right: 0; z-index: 9999; - background: var(--c-text-secondary, #6b7280); - color: #fff; - font-size: var(--text-sm); + background: #1f2937; + color: #f3f4f6; + font-size: 0.78rem; + font-weight: 500; text-align: center; - padding: var(--space-2) var(--space-4); + padding: calc(env(safe-area-inset-top, 0px) + 7px) 16px 7px; + align-items: center; + justify-content: center; + gap: 8px; + box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none; letter-spacing: 0.01em; } +/* Eingeklappt (5s nach Offline-Gang, boot.js): schmale Icon-Leiste statt 2-Zeilen-Banner — + das volle Banner verdeckte die Karten-Steuerung oben (Gerätetest iOS 2026-06-06). */ +#offline-banner.collapsed { + padding: calc(env(safe-area-inset-top, 0px) + 2px) 16px 2px; +} +#offline-banner.collapsed #offline-banner-text { display: none; } /* ------------------------------------------------------------ STREAK-WIDGET (Welcome-Seite) diff --git a/backend/static/index.html b/backend/static/index.html index 579e5c6..1663fcf 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,24 +86,19 @@ Ban Yaro - + - - - - - + + + + + - -