Fix: Welten-Config auto-merge neuer Default-Chips — Läufigkeit erscheint automatisch (SW by-v918)
This commit is contained in:
parent
85864d8ef2
commit
3a3002aff3
5 changed files with 25 additions and 11 deletions
|
|
@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request):
|
||||||
raise _HE(404, "Nicht gefunden.")
|
raise _HE(404, "Nicht gefunden.")
|
||||||
return _media_response(filepath)
|
return _media_response(filepath)
|
||||||
|
|
||||||
APP_VER = "917" # muss mit APP_VER in app.js übereinstimmen
|
APP_VER = "918" # 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():
|
||||||
|
|
|
||||||
|
|
@ -599,10 +599,10 @@
|
||||||
<div id="modal-container"></div>
|
<div id="modal-container"></div>
|
||||||
|
|
||||||
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
||||||
<script src="/js/api.js?v=917"></script>
|
<script src="/js/api.js?v=918"></script>
|
||||||
<script src="/js/ui.js?v=917"></script>
|
<script src="/js/ui.js?v=918"></script>
|
||||||
<script src="/js/app.js?v=917"></script>
|
<script src="/js/app.js?v=918"></script>
|
||||||
<script src="/js/worlds.js?v=917"></script>
|
<script src="/js/worlds.js?v=918"></script>
|
||||||
|
|
||||||
<!-- Feature-Seiten werden lazy geladen -->
|
<!-- Feature-Seiten werden lazy geladen -->
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '917'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '918'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.5.1'; // ← 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
|
||||||
|
|
|
||||||
|
|
@ -569,24 +569,38 @@ window.Worlds = (() => {
|
||||||
// _cfgCache: wird beim Init aus DB geladen, Fallback localStorage → Default
|
// _cfgCache: wird beim Init aus DB geladen, Fallback localStorage → Default
|
||||||
let _cfgCache = null;
|
let _cfgCache = null;
|
||||||
|
|
||||||
|
function _mergeDefaults(cfg) {
|
||||||
|
// Neue Default-Chips die noch nicht in der gespeicherten Config sind → anhängen
|
||||||
|
const result = JSON.parse(JSON.stringify(cfg));
|
||||||
|
for (const world of ['jetzt', 'hund', 'welt']) {
|
||||||
|
const def = _DEFAULT_CONFIG[world] || [];
|
||||||
|
const saved = result[world] || [];
|
||||||
|
for (const page of def) {
|
||||||
|
if (!saved.includes(page)) saved.push(page);
|
||||||
|
}
|
||||||
|
result[world] = saved;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
async function _loadConfigFromServer() {
|
async function _loadConfigFromServer() {
|
||||||
try {
|
try {
|
||||||
const res = await API.get('/profile/world-config');
|
const res = await API.get('/profile/world-config');
|
||||||
if (res?.config) {
|
if (res?.config) {
|
||||||
_cfgCache = res.config;
|
_cfgCache = _mergeDefaults(res.config);
|
||||||
try { localStorage.setItem('world_chips', JSON.stringify(_cfgCache)); } catch {}
|
try { localStorage.setItem('world_chips', JSON.stringify(_cfgCache)); } catch {}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Noch nichts in DB: lokale Config hochladen (einmalige Migration)
|
// Noch nichts in DB: lokale Config hochladen (einmalige Migration)
|
||||||
const local = (() => { try { return JSON.parse(localStorage.getItem('world_chips') || 'null'); } catch { return null; } })();
|
const local = (() => { try { return JSON.parse(localStorage.getItem('world_chips') || 'null'); } catch { return null; } })();
|
||||||
if (local) {
|
if (local) {
|
||||||
_cfgCache = local;
|
_cfgCache = _mergeDefaults(local);
|
||||||
API.put('/profile/world-config', { config: local }).catch(() => {});
|
API.put('/profile/world-config', { config: _cfgCache }).catch(() => {});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
// Fallback: localStorage → Default
|
// Fallback: localStorage → Default
|
||||||
try { _cfgCache = JSON.parse(localStorage.getItem('world_chips') || 'null') || _DEFAULT_CONFIG; }
|
try { _cfgCache = _mergeDefaults(JSON.parse(localStorage.getItem('world_chips') || 'null') || _DEFAULT_CONFIG); }
|
||||||
catch { _cfgCache = _DEFAULT_CONFIG; }
|
catch { _cfgCache = _DEFAULT_CONFIG; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v917';
|
const CACHE_VERSION = 'by-v918';
|
||||||
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