From 4cfce1051f97246e461093139f7e2b67322b44bc Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 30 May 2026 18:10:57 +0200 Subject: [PATCH 1/2] Pro-Badge im Profil: zeigt jetzt korrekten Tier statt veraltetem is_premium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - settings.js Header-Badge unter dem Namen leitet jetzt aus subscription_tier ab (analog _tierCard / has_pro_access): Admin/ Moderator, Züchter, Pro, sonst 'Kostenlos'. Vorher las nur das alte is_premium-Flag, was beim Admin-Upgrade nicht mitgezogen wurde. - admin.py fulfill_upgrade_request setzt jetzt is_premium synchron mit subscription_tier (1 für pro/breeder, sonst 0). Hält Login-Response, /auth/me und Reports konsistent. --- VERSION | 2 +- backend/routes/admin.py | 8 ++++++-- backend/static/index.html | 24 +++++++++++----------- backend/static/js/app.js | 2 +- backend/static/js/pages/settings.js | 32 ++++++++++++++++++++++++----- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 7 files changed, 49 insertions(+), 23 deletions(-) diff --git a/VERSION b/VERSION index e74e6cd..14ffac1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1137 \ No newline at end of file +1138 \ No newline at end of file diff --git a/backend/routes/admin.py b/backend/routes/admin.py index c28813d..e709b53 100644 --- a/backend/routes/admin.py +++ b/backend/routes/admin.py @@ -1216,10 +1216,14 @@ async def fulfill_upgrade_request(req_id: int, user=Depends(require_admin)): raise HTTPException(400, "Ungültiger Tier.") from datetime import timedelta expires_at = (datetime.now(_TZ) + timedelta(days=365)).strftime('%Y-%m-%dT%H:%M:%SZ') + # is_premium-Flag synchron halten: 1 für pro/breeder, sonst 0. + # Sonst zeigt das Frontend „Kostenlos"-Badge obwohl Tier upgraded + # ist (Settings-Header las is_premium statt subscription_tier). + _is_prem = 1 if req["tier"] in ("pro", "breeder") else 0 conn.execute( """UPDATE users SET subscription_tier=?, subscription_expires_at=?, - subscription_cancelled_at=NULL WHERE id=?""", - (req["tier"], expires_at, req["user_id"]) + subscription_cancelled_at=NULL, is_premium=? WHERE id=?""", + (req["tier"], expires_at, _is_prem, req["user_id"]) ) conn.execute( "UPDATE upgrade_requests SET fulfilled_at=strftime('%Y-%m-%dT%H:%M:%fZ','now'), fulfilled_by=? WHERE id=?", diff --git a/backend/static/index.html b/backend/static/index.html index 10be67b..6b4255f 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 3b23e54..4559a01 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 = '1137'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1138'; // ← 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/js/pages/settings.js b/backend/static/js/pages/settings.js index ced3e39..1cfbe70 100644 --- a/backend/static/js/pages/settings.js +++ b/backend/static/js/pages/settings.js @@ -558,11 +558,33 @@ window.Page_settings = (() => { title="E-Mail noch nicht bestätigt">Nicht bestätigt`}
- ${u.is_premium - ? ` - Ban Yaro Plus - ` - : `Kostenlos`} + ${(() => { + // Tier-Source-of-Truth ist subscription_tier (was auch + // _tierCard und has_pro_access nutzen). Das alte is_premium- + // Flag wird bei Admin-Upgrade nicht immer mitgezogen — daher + // hier den Tier nehmen. + const _tier = u.subscription_tier || 'standard'; + const _rolle = u.rolle || 'user'; + const _isAdminLike = _rolle === 'admin' || _rolle === 'moderator'; + const _isBreeder = _tier === 'breeder' || _tier === 'breeder_test' || _rolle === 'breeder'; + const _isPro = _tier === 'pro' || _tier === 'pro_test'; + if (_isAdminLike) { + return ` + Admin + `; + } + if (_isBreeder) { + return ` + Züchter + `; + } + if (_isPro) { + return ` + Ban Yaro Pro + `; + } + return `Kostenlos`; + })()} ${u.is_founder ? ` diff --git a/backend/static/landing.html b/backend/static/landing.html index fad26ff..77781cb 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 9395c59..7139244 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 = '1137'; +const VER = '1138'; 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 f934560a1270b42db1734ad7040f9bd26c9e5d03 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 30 May 2026 18:16:46 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Routen=C3=BCbersicht:=20immer=20Karten-Prev?= =?UTF-8?q?iew=20statt=20erstem=20Foto,=20Kamera-Badge=20bei=20Routen=20mi?= =?UTF-8?q?t=20Bildern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bisher: wenn eine Route Fotos hatte, zeigte die Karten-Übersicht das erste Foto statt der Mini-Map → kein Vergleich der Tracks auf einen Blick möglich. Jetzt: die Mini-Map ist immer da, ein kleiner Kamera-Badge oben rechts zeigt die Anzahl Fotos an (analog zum Tagebuch). Die Fotos sind weiter unverändert in der Route-Detail-Ansicht zu sehen. CSS: .rk-card-preview bekommt position:relative für das Badge. --- VERSION | 2 +- backend/static/css/components.css | 1 + backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 2 +- backend/static/js/pages/routes.js | 29 +++++++++++++++++++++++------ backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 7 files changed, 40 insertions(+), 22 deletions(-) diff --git a/VERSION b/VERSION index 14ffac1..6a565cf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1138 \ No newline at end of file +1139 \ No newline at end of file diff --git a/backend/static/css/components.css b/backend/static/css/components.css index ebeb6d2..1f724ec 100644 --- a/backend/static/css/components.css +++ b/backend/static/css/components.css @@ -2838,6 +2838,7 @@ html.modal-open { overflow: hidden; background: #e8f0e8; flex-shrink: 0; + position: relative; } .rk-preview-empty { display: flex; diff --git a/backend/static/index.html b/backend/static/index.html index 6b4255f..6f4b310 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 4559a01..61463a3 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 = '1138'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1139'; // ← 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/js/pages/routes.js b/backend/static/js/pages/routes.js index 0c2295e..0f4e1af 100644 --- a/backend/static/js/pages/routes.js +++ b/backend/static/js/pages/routes.js @@ -1411,12 +1411,29 @@ window.Page_routes = (() => { const paws = HUNDE_LABEL[r.hunde_tauglichkeit] || ''; const dist = r.distanz_km ? `${r.distanz_km.toFixed(1)} km` : ''; const dur = r.dauer_min ? _fmtDur(r.dauer_min) : ''; - const firstPhoto = (r.foto_urls || [])[0]; - const previewContent = firstPhoto - ? `` - : `
`; + // Immer die Karte zeigen — Fotos erst beim Öffnen der Route. + // Bei Routen mit Fotos einen kleinen Kamera-Marker oben rechts + // einblenden (analog zum Tagebuch). + const photoCount = (r.foto_urls || []).length; + const photoBadge = photoCount > 0 + ? `
+ + ${photoCount} +
` + : ''; + const previewContent = ` + ${photoBadge} +
`; const authorLine = isDiscover ? `
${UI.icon('user')} ${UI.escape(r.user_name||'Anonym')}
` diff --git a/backend/static/landing.html b/backend/static/landing.html index 77781cb..be3033b 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 7139244..ef97c13 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 = '1138'; +const VER = '1139'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten