Perf: Wiki Breed-Fotos nutzen _preview.webp + breeds/ in generate-previews (SW by-v938)
This commit is contained in:
parent
e397b9dff5
commit
3f0e09e5d2
5 changed files with 13 additions and 6 deletions
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
? `<img class="wiki-breed-photo" src="${_esc(fotoUrl)}" loading="lazy" alt="${_esc(r.name)}" onerror="this.style.display='none';this.nextElementSibling.style.display='flex'">`
|
||||
? `<img class="wiki-breed-photo" src="${_esc(srcUrl)}" loading="lazy" alt="${_esc(r.name)}"
|
||||
onerror="if(this.src.includes('_preview')){this.src='${_esc(fotoUrl)}'}else{this.style.display='none';this.nextElementSibling.style.display='flex'}">`
|
||||
: '';
|
||||
const fallbackHtml = `<div class="wiki-breed-photo-fallback" style="${fotoUrl ? 'display:none' : ''}">${_DOG_SILHOUETTE}</div>`;
|
||||
|
||||
|
|
@ -746,7 +751,9 @@ window.Page_wiki = (() => {
|
|||
${allFotos.map((f, i) => `
|
||||
<button class="wiki-gallery-thumb${i === 0 ? ' active' : ''}" data-idx="${i}"
|
||||
aria-label="Foto ${i + 1}">
|
||||
<img src="${_esc(f.foto_url)}" alt="" loading="lazy">
|
||||
<img src="${_esc(f.foto_url.startsWith('/media/') ? f.foto_url.replace(/\.(jpe?g|png|gif|webp)$/i,'_preview.webp') : f.foto_url)}"
|
||||
alt="" loading="lazy"
|
||||
onerror="if(this.src.includes('_preview')){this.src='${_esc(f.foto_url)}'}else{this.style.display='none'}">
|
||||
${f.user_name ? `<span class="wiki-gallery-thumb-label">von ${_esc(f.user_name)}</span>` : ''}
|
||||
</button>`).join('')}
|
||||
</div>` : ''}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue