🎉 feat: update Dockerfile and scripts for improved functionality

This commit is contained in:
2025-05-01 16:05:52 +02:00
parent 631619ccb4
commit 4982cddeef
4 changed files with 42 additions and 14 deletions

View File

@@ -191,6 +191,17 @@
showSettingsModal: false,
init() {
this.initDarkMode();
},
initDarkMode() {
// Lade zuerst den Wert aus dem localStorage (client-seitig)
const storedMode = localStorage.getItem('colorMode');
if (storedMode) {
this.darkMode = storedMode === 'dark';
}
// Dann hole die Server-Einstellung, die Vorrang hat
this.fetchDarkModeFromSession();
},
@@ -200,8 +211,7 @@
.then(data => {
if (data.success) {
this.darkMode = data.darkMode === 'true';
document.querySelector('html').classList.toggle('dark', this.darkMode);
document.querySelector('body').classList.toggle('dark', this.darkMode);
this.applyDarkMode();
}
})
.catch(error => {
@@ -209,10 +219,15 @@
});
},
toggleDarkMode() {
this.darkMode = !this.darkMode;
applyDarkMode() {
document.querySelector('html').classList.toggle('dark', this.darkMode);
document.querySelector('body').classList.toggle('dark', this.darkMode);
localStorage.setItem('colorMode', this.darkMode ? 'dark' : 'light');
},
toggleDarkMode() {
this.darkMode = !this.darkMode;
this.applyDarkMode();
fetch('/api/set_dark_mode', {
method: 'POST',
@@ -224,7 +239,6 @@
.then(response => response.json())
.then(data => {
if (data.success) {
localStorage.setItem('darkMode', this.darkMode ? 'dark' : 'light');
document.dispatchEvent(new CustomEvent('darkModeToggled', {
detail: { isDark: this.darkMode }
}));