perf: インスタンスデフォルトテーマを予めjson5 -> jsonに変換しておくことでjson5を初期バンドルに含めずに済むように
Co-authored-by: Syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
parent
c1f699789b
commit
6956522694
2 changed files with 10 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import * as JSON5 from "json5";
|
||||||
import { IsNull, MoreThan } from "typeorm";
|
import { IsNull, MoreThan } from "typeorm";
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
import { fetchMeta } from "@/misc/fetch-meta.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, // 後方互換性のため
|
maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, // 後方互換性のため
|
||||||
maxCaptionTextLength: MAX_CAPTION_TEXT_LENGTH,
|
maxCaptionTextLength: MAX_CAPTION_TEXT_LENGTH,
|
||||||
emojis: instance.privateMode && !me ? [] : await Emojis.packMany(emojis),
|
emojis: instance.privateMode && !me ? [] : await Emojis.packMany(emojis),
|
||||||
defaultLightTheme: instance.defaultLightTheme,
|
// クライアントの手間を減らすためあらかじめJSONに変換しておく
|
||||||
defaultDarkTheme: instance.defaultDarkTheme,
|
defaultLightTheme: instance.defaultLightTheme
|
||||||
|
? JSON.stringify(JSON5.parse(instance.defaultLightTheme))
|
||||||
|
: null,
|
||||||
|
defaultDarkTheme: instance.defaultDarkTheme
|
||||||
|
? JSON.stringify(JSON5.parse(instance.defaultDarkTheme))
|
||||||
|
: null,
|
||||||
ads:
|
ads:
|
||||||
instance.privateMode && !me
|
instance.privateMode && !me
|
||||||
? []
|
? []
|
||||||
|
|
|
@ -27,7 +27,6 @@ import {
|
||||||
defineAsyncComponent,
|
defineAsyncComponent,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { compareVersions } from "compare-versions";
|
import { compareVersions } from "compare-versions";
|
||||||
import JSON5 from "json5";
|
|
||||||
|
|
||||||
import widgets from "@/widgets";
|
import widgets from "@/widgets";
|
||||||
import directives from "@/directives";
|
import directives from "@/directives";
|
||||||
|
@ -312,12 +311,12 @@ import { getAccountFromId } from "@/scripts/get-account-from-id";
|
||||||
if (instance.defaultLightTheme != null)
|
if (instance.defaultLightTheme != null)
|
||||||
ColdDeviceStorage.set(
|
ColdDeviceStorage.set(
|
||||||
"lightTheme",
|
"lightTheme",
|
||||||
JSON5.parse(instance.defaultLightTheme),
|
JSON.parse(instance.defaultLightTheme),
|
||||||
);
|
);
|
||||||
if (instance.defaultDarkTheme != null)
|
if (instance.defaultDarkTheme != null)
|
||||||
ColdDeviceStorage.set(
|
ColdDeviceStorage.set(
|
||||||
"darkTheme",
|
"darkTheme",
|
||||||
JSON5.parse(instance.defaultDarkTheme),
|
JSON.parse(instance.defaultDarkTheme),
|
||||||
);
|
);
|
||||||
defaultStore.set("themeInitial", false);
|
defaultStore.set("themeInitial", false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue