mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
perf: インスタンスデフォルトテーマを予めjson5 -> jsonに変換しておくことでjson5を初期バンドルに含めずに済むように
Co-authored-by: Syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
parent
decdb6490c
commit
c0dd5aa964
@ -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
|
||||
? []
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user