fix: target localStorage cleanup to kantine_ prefix to prevent host session loss (v1.4.31)

This commit is contained in:
Kantine Wrapper
2026-02-26 10:35:28 +01:00
parent 6ed0831f5d
commit ae54d97d96
3 changed files with 10 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
## v1.4.31
- 🐛 **Bugfix**: Der "Lokalen Cache leeren"-Button löscht nun gezielt nur noch Kantine-spezifische Daten (`kantine_` Präfix). Bisher wurde die gesamte `localStorage` geleert, was dazu führte, dass man auch aus der zugrundeliegenden bessa.app-Sitzung ausgeloggt wurde.
## v1.4.30
- 🐛 **Bugfix**: Login-Sitzung (`authToken` etc.) wird nun in der `localStorage` statt `sessionStorage` gespeichert, wodurch die Anmeldung beim Öffnen von Bookmarklets in neuen Tabs/Fenstern erhalten bleibt.
- 🐛 **Bugfix**: Bestell-Erinnerungscountdown und Alarm-Notifications erscheinen nun nur noch für angemeldete Nutzer.

View File

@@ -344,7 +344,12 @@
if (btnClearCache) {
btnClearCache.addEventListener('click', () => {
if (confirm('Möchtest du wirklich alle lokalen Daten (inkl. Login-Session, Cache und Einstellungen) löschen? Die Seite wird danach neu geladen.')) {
localStorage.clear();
// Only clear our own keys so we don't destroy the host app's (Bessa's) session
Object.keys(localStorage).forEach(key => {
if (key.startsWith('kantine_')) {
localStorage.removeItem(key);
}
});
window.location.reload();
}
});

View File

@@ -1 +1 @@
v1.4.30
v1.4.31