diff --git a/backend/main.py b/backend/main.py index 92aa68c..ecfa6cf 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 = "909" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "910" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/routes/breeder.py b/backend/routes/breeder.py index 849388d..9109162 100644 --- a/backend/routes/breeder.py +++ b/backend/routes/breeder.py @@ -58,11 +58,21 @@ async def breeder_status(user=Depends(get_current_user)): "FROM breeder_profiles WHERE user_id=?", (user["id"],) ).fetchone() - return { + if profile: + logo = conn.execute( + """SELECT file_path FROM breeder_photos + WHERE breeder_id=? AND entity_type='breeder' + ORDER BY is_primary DESC, id LIMIT 1""", + (profile["id"],) + ).fetchone() + result = { "rolle": row["rolle"], "breeder_status": row["breeder_status"], "profile": dict(profile) if profile else None, } + if profile: + result["profile"]["logo_url"] = f"/api/media/{logo['file_path']}" if logo else None + return result # ------------------------------------------------------------------ diff --git a/backend/static/index.html b/backend/static/index.html index 99b347f..348833f 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -591,10 +591,10 @@ - - - - + + + + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index cde78e5..e40d8e0 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 = '909'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '910'; // ← 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/laeufi.js b/backend/static/js/pages/laeufi.js index 755b54a..6a734b2 100644 --- a/backend/static/js/pages/laeufi.js +++ b/backend/static/js/pages/laeufi.js @@ -2,8 +2,9 @@ window.Page_laeufi = (() => { let _container, _appState; - let _hunde = []; // alle weiblichen Zuchthunde + let _hunde = []; let _openHundId = null; + let _breederInfo = null; // ---------------------------------------------------------- // Init / Refresh @@ -16,6 +17,11 @@ window.Page_laeufi = (() => {

Nur für verifizierte Züchter.

`; return; } + API.breeder.status().then(s => { + _breederInfo = s?.profile ? { zwingername: s.profile.zwingername, logo_url: s.profile.logo_url } : null; + const headerEl = _container.querySelector('#breeder-private-header'); + if (headerEl) headerEl.outerHTML = _privateHeader(); + }).catch(() => {}); _render(); await _loadHunde(); } @@ -27,23 +33,35 @@ window.Page_laeufi = (() => { // Grundstruktur // ---------------------------------------------------------- function _privateHeader() { + const zwinger = _breederInfo?.zwingername || ''; + const logoUrl = _breederInfo?.logo_url || null; + const logoHtml = logoUrl + ? `Logo` + : `
+ + + +
`; return ` -
-
- - - - - Privater Bereich - -
-
- Nur du siehst das — nicht öffentlich + ${logoHtml} +
+ ${zwinger ? `
${UI.esc(zwinger)}
` : ''} +
+ + + + Privater Bereich · Nur du siehst das +
`; } diff --git a/backend/static/js/pages/litters.js b/backend/static/js/pages/litters.js index 56d0624..6cf7320 100644 --- a/backend/static/js/pages/litters.js +++ b/backend/static/js/pages/litters.js @@ -5,11 +5,12 @@ window.Page_litters = (() => { - let _container = null; - let _appState = null; - let _litters = []; // geladene Würfe - let _openId = null; // aufgeklappter Wurf - let _filterStatus = null; // aktiver Status-Filter + let _container = null; + let _appState = null; + let _litters = []; + let _openId = null; + let _filterStatus = null; + let _breederInfo = null; // { zwingername, logo_url } // ---------------------------------------------------------- // Hilfsfunktionen @@ -76,6 +77,12 @@ window.Page_litters = (() => { } _render(); + API.breeder.status().then(s => { + _breederInfo = s?.profile ? { zwingername: s.profile.zwingername, logo_url: s.profile.logo_url } : null; + // Header nach Laden der Info neu rendern + const headerEl = _container.querySelector('#breeder-private-header'); + if (headerEl) headerEl.outerHTML = _privateHeader(); + }).catch(() => {}); await _loadLitters(); } @@ -90,26 +97,35 @@ window.Page_litters = (() => { // ---------------------------------------------------------- // Grundstruktur rendern // ---------------------------------------------------------- - function _privateHeader(icon, title) { - const zwinger = _appState?.user?.name || ''; + function _privateHeader() { + const zwinger = _breederInfo?.zwingername || ''; + const logoUrl = _breederInfo?.logo_url || null; + const logoHtml = logoUrl + ? `Logo` + : `
+ + + +
`; return ` -
-
- - - - - Privater Bereich - -
-
-
- Nur du siehst das — nicht öffentlich + ${logoHtml} +
+ ${zwinger ? `
${_esc(zwinger)}
` : ''} +
+ + + + Privater Bereich · Nur du siehst das
`; diff --git a/backend/static/js/pages/zuchthunde.js b/backend/static/js/pages/zuchthunde.js index b4730c1..5fcb2e9 100644 --- a/backend/static/js/pages/zuchthunde.js +++ b/backend/static/js/pages/zuchthunde.js @@ -11,7 +11,8 @@ window.Page_zuchthunde = (() => { let _hunde = []; // geladene Hunde let _query = ''; // Suchtext let _openSections = {}; // { : 'health'|'genetic'|'titles'|null } - let _breederId = null; // ID des Züchter-Profils + let _breederId = null; // ID des Züchter-Profils + let _breederInfo = null; // { zwingername, logo_url } // ---------------------------------------------------------- // Hilfsfunktionen @@ -99,23 +100,35 @@ window.Page_zuchthunde = (() => { // Grundstruktur // ---------------------------------------------------------- function _privateHeader() { + const zwinger = _breederInfo?.zwingername || ''; + const logoUrl = _breederInfo?.logo_url || null; + const logoHtml = logoUrl + ? `Logo` + : `
+ + + +
`; return `
-
- - - - - Privater Bereich - -
-
- Nur du siehst das — nicht öffentlich + ${logoHtml} +
+ ${zwinger ? `
${_esc(zwinger)}
` : ''} +
+ + + + Privater Bereich · Nur du siehst das +
`; } @@ -182,7 +195,10 @@ window.Page_zuchthunde = (() => { try { [_hunde] = await Promise.all([ API.zuchthunde.list(), - API.breeder.status().then(s => { _breederId = s?.profile?.id || null; }).catch(() => {}), + API.breeder.status().then(s => { + _breederId = s?.profile?.id || null; + _breederInfo = s?.profile ? { zwingername: s.profile.zwingername, logo_url: s.profile.logo_url } : null; + }).catch(() => {}), ]); _renderList(); } catch (err) { diff --git a/backend/static/sw.js b/backend/static/sw.js index 06a5842..c532543 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-v909'; +const CACHE_VERSION = 'by-v910'; 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