From 3f0e09e5d2bf5a6eac90d331e06a3bd69fcf913d Mon Sep 17 00:00:00 2001 From: rene Date: Thu, 14 May 2026 12:42:20 +0200 Subject: [PATCH] Perf: Wiki Breed-Fotos nutzen _preview.webp + breeds/ in generate-previews (SW by-v938) --- backend/main.py | 2 +- backend/routes/admin.py | 2 +- backend/static/js/app.js | 2 +- backend/static/js/pages/wiki.js | 11 +++++++++-- backend/static/sw.js | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/backend/main.py b/backend/main.py index 2496738..4d66590 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 = "937" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "938" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/routes/admin.py b/backend/routes/admin.py index 19e93eb..b48720c 100644 --- a/backend/routes/admin.py +++ b/backend/routes/admin.py @@ -1067,7 +1067,7 @@ async def generate_media_previews(user=Depends(require_admin)): skipped = 0 errors = 0 - for subdir in ("diary", "forum"): + for subdir in ("diary", "forum", "breeds", "breeds/gallery", "breeds/submissions"): folder = os.path.join(MEDIA_DIR, subdir) if not os.path.isdir(folder): continue diff --git a/backend/static/js/app.js b/backend/static/js/app.js index cd0ced3..f7dde7c 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 = '937'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '938'; // ← 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/wiki.js b/backend/static/js/pages/wiki.js index b0c101d..86bb8d9 100644 --- a/backend/static/js/pages/wiki.js +++ b/backend/static/js/pages/wiki.js @@ -384,8 +384,13 @@ window.Page_wiki = (() => { function _breedCardHtml(r) { const fotoUrl = r.foto_url || r.user_foto || ''; + // Für lokale Bilder: _preview.webp zuerst, bei Fehler Original nachladen + const srcUrl = fotoUrl.startsWith('/media/') + ? fotoUrl.replace(/\.(jpe?g|png|gif|webp)$/i, '_preview.webp') + : fotoUrl; const photoHtml = fotoUrl - ? `${_esc(r.name)}` + ? `${_esc(r.name)}` : ''; const fallbackHtml = `
${_DOG_SILHOUETTE}
`; @@ -746,7 +751,9 @@ window.Page_wiki = (() => { ${allFotos.map((f, i) => ` `).join('')} ` : ''} diff --git a/backend/static/sw.js b/backend/static/sw.js index ce2b895..5be62bd 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-v937'; +const CACHE_VERSION = 'by-v938'; 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