public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
Fix theme localStorage collision with rspamd UI
293b885a
data/web/js/site/index.js | 7 ++++---
data/web/templates/base.twig | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
Diff
diff --git a/data/web/js/site/index.js b/data/web/js/site/index.js
index 4c812a37..29b72f0d 100644
--- a/data/web/js/site/index.js
+++ b/data/web/js/site/index.js
@@ -1,5 +1,6 @@
$(document).ready(function() {
- var theme = localStorage.getItem("theme");
- localStorage.clear();
- localStorage.setItem("theme", theme);
+ var theme = localStorage.getItem("mailcow_theme");
+ if (theme !== null) {
+ localStorage.setItem("mailcow_theme", theme);
+ }
});
diff --git a/data/web/templates/base.twig b/data/web/templates/base.twig
index 4290edae..e1708950 100644
--- a/data/web/templates/base.twig
+++ b/data/web/templates/base.twig
@@ -11,8 +11,8 @@
<link rel="stylesheet" href="{{ css_path }}">
<script>
// check if darkmode is preferred by OS or set by localStorage
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && localStorage.getItem("theme") !== "light" ||
- localStorage.getItem("theme") === "dark") {
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && localStorage.getItem("mailcow_theme") !== "light" ||
+ localStorage.getItem("mailcow_theme") === "dark") {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.id = 'dark-mode-theme';