From 0548d7a699fad359791a5a11342025909d5063ee Mon Sep 17 00:00:00 2001 From: Aden Lindsay Date: Wed, 4 Nov 2026 14:12:12 +1030 Subject: [PATCH] fix: fix theme manager custom image name handling --- src/plugins/built-in/themes/theme-manager.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/built-in/themes/theme-manager.ts b/src/plugins/built-in/themes/theme-manager.ts index 0345ab29..cdc4472e 100644 --- a/src/plugins/built-in/themes/theme-manager.ts +++ b/src/plugins/built-in/themes/theme-manager.ts @@ -4,6 +4,7 @@ import { type CustomTheme, getForcedDarkMode, type LoadedCustomTheme, + type ThemeCreatorMeta, shouldForceThemeAppearance, } from "@/types/customThemes"; import { BSPLUS_PENDING_THEME_ENSURE_AFTER_CLOUD_KEY } from "@/seqta/utils/cloudSettingsSync"; @@ -35,6 +36,12 @@ import { validateThemeScript, } from "./theme-runtime"; import { base64ToBlob, blobToBase64Data, stripBase64Prefix } from "@/seqta/utils/base64"; +import { mergeThemeWithCreatorMeta } from "@/interface/utils/themeCreatorMeta"; + +function resolveThemeCustomCss(theme: LoadedCustomTheme): string { + if (!theme.creatorMeta) return theme.CustomCSS || ""; + return mergeThemeWithCreatorMeta(theme, theme.creatorMeta).CustomCSS; +} type ThemeContent = { id: string; @@ -49,6 +56,7 @@ type ThemeContent = { forceDark?: boolean; adaptiveCssVariables?: string[]; images?: { id: string; variableName: string; data: string }[]; // data: base64 + creatorMeta?: ThemeCreatorMeta; themeScript?: ThemeScriptSpec; themeDom?: ThemeDomSpec; }; @@ -335,7 +343,7 @@ export class ThemeManager { // Custom CSS + images must be applied in page context (Firefox). verboseDebug("[BetterSEQTA+] ThemeManager: Applying theme styles in page context"); await syncThemeToPage({ - customCss: theme.CustomCSS || "", + customCss: resolveThemeCustomCss(theme as LoadedCustomTheme), images: theme.CustomImages ?? [], }); if (theme.CustomImages?.length) { @@ -801,6 +809,7 @@ export class ThemeManager { adaptiveCssVariables: themeData.adaptiveCssVariables, themeScript: themeData.themeScript, themeDom: themeData.themeDom, + creatorMeta: themeData.creatorMeta, }; await this.saveTheme(theme); @@ -961,7 +970,7 @@ export class ThemeManager { public async previewTheme(theme: LoadedCustomTheme): Promise { verboseDebug("[BetterSEQTA+] ThemeManager: Previewing theme:", theme.name); try { - const { CustomCSS, CustomImages, defaultColour } = theme; + const { CustomImages, defaultColour } = theme; // Store original settings only if this is a new theme if (!theme.webURL) { @@ -976,7 +985,7 @@ export class ThemeManager { // Apply custom CSS + images in page context (preview stylesheet) await syncThemeToPage({ - previewCss: CustomCSS, + previewCss: resolveThemeCustomCss(theme), images: CustomImages, }); this.lastSyncedImageKey = this.imageSyncKey(CustomImages);