From f962cf2f4d3909efa6480f54645dd121715e5332 Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 15 May 2026 19:08:34 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Chip-Sichtbarkeit=20ger=C3=A4te=C3=BCber?= =?UTF-8?q?greifend=20konsistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: _mergeDefaults() interpretierte fehlende Chips als 'neu' und fügte sie wieder ein — auch bewusst ausgeblendete. Fix: - _saveConfig(): berechnet cfg.hidden = alle Default-Chips die keiner Welt zugewiesen sind; wird mit der Config auf dem Server gespeichert - _mergeDefaults(): prüft hidden-Set und allAssigned-Set; fügt nur echte Neu-Chips ein (nicht in hidden, nicht bereits anderer Welt zugewiesen) - Verhindert auch Doppelzuweisung wenn ein Chip zwischen Welten verschoben SW by-v1001, APP_VER 1001 --- backend/main.py | 2 +- backend/static/js/app.js | 2 +- backend/static/js/worlds.js | 19 ++++++++++++++++--- backend/static/sw.js | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/backend/main.py b/backend/main.py index 4c973dc..6a1aec1 100644 --- a/backend/main.py +++ b/backend/main.py @@ -410,7 +410,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "1000" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "1001" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/js/app.js b/backend/static/js/app.js index d7eaab5..15d5876 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 = '1000'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1001'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← 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/worlds.js b/backend/static/js/worlds.js index 35cb433..aad758e 100644 --- a/backend/static/js/worlds.js +++ b/backend/static/js/worlds.js @@ -598,13 +598,21 @@ window.Worlds = (() => { 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)); + const result = JSON.parse(JSON.stringify(cfg)); + const hidden = new Set(result.hidden || []); + // Chips die bereits einer Welt zugewiesen sind, nicht nochmal einfügen + const allAssigned = new Set([ + ...(result.jetzt || []), ...(result.hund || []), ...(result.welt || []), + ]); 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); + // Nur echte Neu-Chips anhängen: nicht zugewiesen UND nicht bewusst ausgeblendet + if (!allAssigned.has(page) && !hidden.has(page)) { + saved.push(page); + allAssigned.add(page); + } } result[world] = saved; } @@ -637,6 +645,11 @@ window.Worlds = (() => { } function _saveConfig(cfg) { + // Bewusst ausgeblendete Chips tracken: Default-Chips die keiner Welt zugewiesen sind + const allAssigned = new Set([...(cfg.jetzt||[]), ...(cfg.hund||[]), ...(cfg.welt||[])]); + const allDefault = [..._DEFAULT_CONFIG.jetzt, ..._DEFAULT_CONFIG.hund, ..._DEFAULT_CONFIG.welt]; + cfg.hidden = allDefault.filter(p => !allAssigned.has(p)); + _cfgCache = cfg; try { localStorage.setItem('world_chips', JSON.stringify(cfg)); } catch {} if (_state?.user) { diff --git a/backend/static/sw.js b/backend/static/sw.js index 84e2787..9c8a92f 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-v1000'; +const CACHE_VERSION = 'by-v1001'; 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