From ce6e3ca37fa5c72d0eb18d1d9f5322e0a1eb035b Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 18 Jul 2023 17:31:36 +0200 Subject: [PATCH] Fix loading screen colors after switching theme #1144 --- www/common/sframe-boot2.js | 7 +++++++ www/settings/inner.js | 1 + 2 files changed, 8 insertions(+) diff --git a/www/common/sframe-boot2.js b/www/common/sframe-boot2.js index 912677b0e..d5c5e99ad 100644 --- a/www/common/sframe-boot2.js +++ b/www/common/sframe-boot2.js @@ -13,6 +13,13 @@ define([ }; } + var ls = window.localStorage; + window.CryptPad_flushCacheInner = function () { + Object.keys(ls).forEach(function (k) { + if (k.indexOf('CRYPTPAD_CACHE|') !== 0 && k.indexOf('LESS_CACHE') !== 0) { return; } + delete ls[k]; + }); + }; var mkFakeStore = function () { var fakeStorage = { getItem: function (k) { return fakeStorage[k]; }, diff --git a/www/settings/inner.js b/www/settings/inner.js index 44c1e1a51..ec8b55142 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -471,6 +471,7 @@ define([ // browsers try to load iframes from cache if they have the same id as was previously seen // this seems to help? window.location.hash = ''; + if (flush && window.CryptPad_flushCacheInner) { window.CryptPad_flushCacheInner(); } sframeChan.query('Q_COLORTHEME_CHANGE', { theme: val, flush: flush