aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2024-07-17 22:25:14 +0300
committerHenry Jameson <me@hjkos.com>2024-07-17 22:25:14 +0300
commit9d5514de9ce8ab7874af685b7ac01ef10092dea4 (patch)
tree694e0510b7f5bf515676ca7042c8ac0269bdcbc8 /src/modules
parentd2683a672859cb0fb46037540f62f4fdb07407c1 (diff)
fix themes v2 editor for anon users and people who never touched themes
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/instance.js1
-rw-r--r--src/modules/interface.js23
2 files changed, 16 insertions, 8 deletions
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 49ef391a..99b8b5d5 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -42,6 +42,7 @@ const defaultState = {
registrationOpen: true,
server: 'http://localhost:4040/',
textlimit: 5000,
+ themeData: undefined, // used for theme editor v2
vapidPublicKey: undefined,
// Stuff from static/config.json
diff --git a/src/modules/interface.js b/src/modules/interface.js
index b56b60ec..92f3e9ac 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -230,13 +230,6 @@ const interfaceMod = {
const forceRecompile = forceThemeRecompilation || recompile
- // If we're not not forced to recompile try using
- // cache (tryLoadCache return true if load successful)
- if (!forceRecompile && !themeDebug && tryLoadCache()) {
- commit('setThemeApplied')
- return
- }
-
let promise = null
if (themeData) {
@@ -250,11 +243,25 @@ const interfaceMod = {
promise = Promise.resolve(normalizeThemeData(userThemeSnapshot))
}
} else if (actualThemeName && actualThemeName !== 'custom') {
- promise = getPreset(actualThemeName).then(themeData => normalizeThemeData(themeData))
+ promise = getPreset(actualThemeName).then(themeData => {
+ const realThemeData = normalizeThemeData(themeData)
+ if (actualThemeName === instanceThemeName) {
+ // This sole line is the reason why this whole block is above the recompilation check
+ commit('setInstanceOption', { name: 'themeData', value: { theme: realThemeData } })
+ }
+ return realThemeData
+ })
} else {
throw new Error('Cannot load any theme!')
}
+ // If we're not not forced to recompile try using
+ // cache (tryLoadCache return true if load successful)
+ if (!forceRecompile && !themeDebug && tryLoadCache()) {
+ commit('setThemeApplied')
+ return
+ }
+
promise
.then(realThemeData => {
const theme2ruleset = convertTheme2To3(realThemeData)