From a02146df1770e064af793a05bf21b33a35c614b7 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 5 Nov 2024 02:58:21 +0200 Subject: [PATCH] server: Fix loading of code block theme on server builds --- src/services/code_block_theme.ts | 7 +++---- src/services/utils.ts | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/code_block_theme.ts b/src/services/code_block_theme.ts index 9aeb23651..037df7be5 100644 --- a/src/services/code_block_theme.ts +++ b/src/services/code_block_theme.ts @@ -8,8 +8,7 @@ import fs from "fs"; import themeNames from "./code_block_theme_names.json" with { type: "json" } import { t } from "i18next"; import { join } from "path"; -import { getResourceDir } from "./utils.js"; -import env from "./env.js"; +import utils from "./utils.js"; /** * Represents a color scheme for the code block syntax highlight. @@ -31,8 +30,8 @@ interface ColorTheme { * @returns the supported themes, grouped. */ export function listSyntaxHighlightingThemes() { - const stylesDir = (env.isDev() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles"); - const path = join(getResourceDir(), stylesDir); + const stylesDir = (!utils.isElectron() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles"); + const path = join(utils.getResourceDir(), stylesDir); const systemThemes = readThemesFromFileSystem(path); return { diff --git a/src/services/utils.ts b/src/services/utils.ts index 6e2cdab66..1d93d724c 100644 --- a/src/services/utils.ts +++ b/src/services/utils.ts @@ -364,5 +364,6 @@ export default { normalize, hashedBlobId, toMap, - isString + isString, + getResourceDir };