diff --git a/backend/main.py b/backend/main.py index 6c172d0..6dc2e56 100644 --- a/backend/main.py +++ b/backend/main.py @@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "934" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "935" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/js/api.js b/backend/static/js/api.js index f75b2cf..8621935 100644 --- a/backend/static/js/api.js +++ b/backend/static/js/api.js @@ -800,9 +800,17 @@ const API = (() => { get(`/osm/pois?type=${type}&south=${south}&west=${west}&north=${north}&east=${east}&fast=true`), }; + // SW-Cache-Einträge für eine URL löschen (z.B. nach Foto-Upload) + async function swCacheDelete(path) { + try { + const c = await caches.open('ban-yaro-api-v1'); + await c.delete(new Request(path)); + } catch {} + } + // Öffentliche API return { - get, post, put, patch, del, upload, + get, post, put, patch, del, upload, swCacheDelete, auth, dogs, diary, health, tieraerzte, healthDocs, poison, places, routes, walks, events, sitting, forum, lost, knigge, weather, push, friends, chat, webcal, importData, sharing, widget, notifications, services, ratings, sittingAccess, training, notes, diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 64c0adb..fff0a5e 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 = '934'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '935'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; // Cache-Bust-Parameter nach Update-Reload sofort entfernen diff --git a/backend/static/js/pages/dog-profile.js b/backend/static/js/pages/dog-profile.js index 2d4c843..13fbe76 100644 --- a/backend/static/js/pages/dog-profile.js +++ b/backend/static/js/pages/dog-profile.js @@ -769,9 +769,10 @@ window.Page_dog_profile = (() => { await API.dogs.updatePhotoPosition(dog.id, 1.0, 0.0, 0.0); _appState.activeDog = { ..._appState.activeDog, foto_url: result.foto_url, foto_zoom: 1, foto_offset_x: 0, foto_offset_y: 0 }; _appState.dogs = _appState.dogs.map(d => d.id === dog.id ? _appState.activeDog : d); - // Hintergrund-Cache invalidieren + // localStorage + SW-Cache invalidieren const userId2 = _appState.user?.id || 'anon'; localStorage.removeItem(`w3_bg3_${userId2}_` + new Date().toISOString().slice(0, 10)); + API.swCacheDelete(`/api/dogs/${dog.id}/welcome-dashboard`); UI.modal.close(); App.renderDogSwitcher?.(); window.Worlds?.refresh(_appState); @@ -1386,10 +1387,10 @@ window.Page_dog_profile = (() => { saved.foto_url = result.foto_url; _appState.activeDog = { ...saved }; _appState.dogs = _appState.dogs.map(d => d.id === saved.id ? _appState.activeDog : d); - // Hintergrund-Cache invalidieren damit Welten das neue Foto zeigen + // localStorage + SW-Cache invalidieren damit Welten das neue Foto zeigen const userId = _appState.user?.id || 'anon'; - const todayKey = `w3_bg3_${userId}_` + new Date().toISOString().slice(0, 10); - localStorage.removeItem(todayKey); + localStorage.removeItem(`w3_bg3_${userId}_` + new Date().toISOString().slice(0, 10)); + API.swCacheDelete(`/api/dogs/${saved.id}/welcome-dashboard`); } catch { UI.toast.warning('Profil gespeichert, Foto konnte nicht hochgeladen werden.'); } diff --git a/backend/static/sw.js b/backend/static/sw.js index a2733ff..82082f6 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v934'; +const CACHE_VERSION = 'by-v935'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache