Fix: Update-Loop entfernt (navigate kein Reload mehr), API-Header triggert Banner statt Redirect (SW by-v800)
This commit is contained in:
parent
e20e691c4d
commit
2a545377c1
4 changed files with 8 additions and 11 deletions
|
|
@ -341,7 +341,7 @@ MEDIA_DIR = os.getenv("MEDIA_DIR", "/data/media")
|
||||||
os.makedirs(MEDIA_DIR, exist_ok=True)
|
os.makedirs(MEDIA_DIR, exist_ok=True)
|
||||||
app.mount("/media", StaticFiles(directory=MEDIA_DIR), name="media")
|
app.mount("/media", StaticFiles(directory=MEDIA_DIR), name="media")
|
||||||
|
|
||||||
APP_VER = "799" # muss mit APP_VER in app.js übereinstimmen
|
APP_VER = "800" # muss mit APP_VER in app.js übereinstimmen
|
||||||
|
|
||||||
@app.get("/.well-known/assetlinks.json")
|
@app.get("/.well-known/assetlinks.json")
|
||||||
async def assetlinks():
|
async def assetlinks():
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,12 @@ const API = (() => {
|
||||||
throw new APIError(msg, 0, 'network');
|
throw new APIError(msg, 0, 'network');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Versions-Check: Server meldet neue Version → beim nächsten Seitenwechsel neu laden
|
// Versions-Check: Server meldet neue Version → Banner anzeigen (einmalig)
|
||||||
const serverVer = response.headers.get('x-app-version');
|
const serverVer = response.headers.get('x-app-version');
|
||||||
if (serverVer && serverVer !== APP_VER && !window._byUpdatePending) {
|
if (serverVer && serverVer !== APP_VER && !window._byUpdatePending) {
|
||||||
window._byUpdatePending = true;
|
window._byUpdatePending = true;
|
||||||
|
// App._showUpdateBanner wird aufgerufen sobald App initialisiert ist
|
||||||
|
setTimeout(() => window.App?._triggerUpdateBanner?.(serverVer), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.status === 204) return null;
|
if (response.status === 204) return null;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '799'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '800'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.5.0'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.5.0'; // ← semantische Version, wird bei make release gesetzt
|
||||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||||
|
|
@ -119,12 +119,6 @@ const App = (() => {
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
function navigate(pageId, pushHistory = true, params = {}) {
|
function navigate(pageId, pushHistory = true, params = {}) {
|
||||||
if (!pages[pageId]) return;
|
if (!pages[pageId]) return;
|
||||||
// Neue Version vom Server erkannt → jetzt sicher neu laden (kein aktiver Speichervorgang)
|
|
||||||
if (window._byUpdatePending) {
|
|
||||||
window._byUpdatePending = false;
|
|
||||||
location.replace('/?_t=' + Date.now());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (window.Worlds?._visible) window.Worlds.hide();
|
if (window.Worlds?._visible) window.Worlds.hide();
|
||||||
|
|
||||||
// Aktive Seite ausblenden
|
// Aktive Seite ausblenden
|
||||||
|
|
@ -1102,7 +1096,8 @@ const App = (() => {
|
||||||
showOnboarding: _showOnboardingModal,
|
showOnboarding: _showOnboardingModal,
|
||||||
updateNotifBadge: _updateNotifBadge,
|
updateNotifBadge: _updateNotifBadge,
|
||||||
checkNearbyAlerts: _checkNearbyAlerts,
|
checkNearbyAlerts: _checkNearbyAlerts,
|
||||||
loadScript: _loadScript };
|
loadScript: _loadScript,
|
||||||
|
_triggerUpdateBanner: _showUpdateBanner };
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v799';
|
const CACHE_VERSION = 'by-v800';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue