diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 139afc88b..23cfe4018 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -1,3 +1,4 @@ +import * as JSON5 from "json5"; import { IsNull, MoreThan } from "typeorm"; import config from "@/config/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; @@ -462,8 +463,13 @@ export default define(meta, paramDef, async (ps, me) => { maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, // 後方互換性のため maxCaptionTextLength: MAX_CAPTION_TEXT_LENGTH, emojis: instance.privateMode && !me ? [] : await Emojis.packMany(emojis), - defaultLightTheme: instance.defaultLightTheme, - defaultDarkTheme: instance.defaultDarkTheme, + // クライアントの手間を減らすためあらかじめJSONに変換しておく + defaultLightTheme: instance.defaultLightTheme + ? JSON.stringify(JSON5.parse(instance.defaultLightTheme)) + : null, + defaultDarkTheme: instance.defaultDarkTheme + ? JSON.stringify(JSON5.parse(instance.defaultDarkTheme)) + : null, ads: instance.privateMode && !me ? [] diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index 7a004688d..5d9ae12f3 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -27,7 +27,6 @@ import { defineAsyncComponent, } from "vue"; import { compareVersions } from "compare-versions"; -import JSON5 from "json5"; import widgets from "@/widgets"; import directives from "@/directives"; @@ -312,12 +311,12 @@ import { getAccountFromId } from "@/scripts/get-account-from-id"; if (instance.defaultLightTheme != null) ColdDeviceStorage.set( "lightTheme", - JSON5.parse(instance.defaultLightTheme), + JSON.parse(instance.defaultLightTheme), ); if (instance.defaultDarkTheme != null) ColdDeviceStorage.set( "darkTheme", - JSON5.parse(instance.defaultDarkTheme), + JSON.parse(instance.defaultDarkTheme), ); defaultStore.set("themeInitial", false); }