logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: 211a45b6887c7923089b0f331e4a6e1657bcd44b
parent b172f99835f33904cae14bacfeaf54262cc6ccbd
Author: Henry Jameson <me@hjkos.com>
Date:   Sun, 22 Dec 2024 15:07:20 +0200

improve robustness of appearance tab

Diffstat:

Msrc/components/settings_modal/tabs/appearance_tab.js11++++++++++-
Msrc/components/settings_modal/tabs/theme_tab/theme_tab.js2+-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js @@ -119,7 +119,16 @@ const AppearanceTab = { updateIndex('theme').then(themes => { themes.forEach(([key, themePromise]) => themePromise.then(data => { - this.availableThemesV2.push({ key, data, name: data.name, version: 'v2' }) + console.log('DEBUG', data) + if (!data) { + console.warn(`Theme with key ${key} is empty or malformed`) + } else if (Array.isArray(data)) { + console.warn(`Theme with key ${key} is a v1 theme and should be moved to static/palettes/index.json`) + } else if (!data.source && !data.theme) { + console.warn(`Theme with key ${key} is malformed`) + } else { + this.availableThemesV2.push({ key, data, name: data.name, version: 'v2' }) + } })) }) diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js @@ -133,7 +133,7 @@ export default { Object .values(themesIndex) .forEach(themeFunc => { - themeFunc().then(themeData => this.availableStyles.push(themeData)) + themeFunc().then(themeData => themeData && this.availableStyles.push(themeData)) }) }) },