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