chore: don't use CDN if useEmojiCdn is disabled

This commit is contained in:
naskya 2024-01-25 05:48:21 +09:00
parent a4f958d8c4
commit c777931168
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
4 changed files with 9 additions and 2 deletions

View file

@ -1174,6 +1174,8 @@ pullDownToReload: "Pull down to reload"
enableTimelineStreaming: "Update timelines automatically"
useEmojiCdn: "Get Twemoji from CDN"
useEmojiCdnDescription: "Use Twemoji from the JSDelivr CDN instead of the server's assets."
useCdn: "Get assets from CDN"
useCdnDescription: "Load some static assets like Twemoji from the JSDelivr CDN instead of this Firefish server."
suggested: "Suggested"
noLanguage: "No language"

View file

@ -1008,6 +1008,8 @@ emphasizeFollowed: "フォロワーのアカウントに表示される「フォ
iconSet: "アイコンのスタイル"
useEmojiCdn: "CDNのTwemojiを利用する"
useEmojiCdnDescription: "サーバー上に保存されているTwemojiのアセットの代わりに、JSDelivr CDNから配信されたものを用います。"
useCdn: "CDNのアセットを利用する"
useCdnDescription: "このFirefishサーバーからではなくJSDelivr CDNからTwiemojiなどのアセットを読み込みます。"
_sensitiveMediaDetection:
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。"

View file

@ -309,9 +309,9 @@
}}</span></FormSwitch
>
<FormSwitch v-model="useEmojiCdn" class="_formBlock"
>{{ i18n.ts.useEmojiCdn
>{{ i18n.ts.useCdn
}}<template #caption>{{
i18n.ts.useEmojiCdnDescription
i18n.ts.useCdnDescription
}}</template></FormSwitch
>
<FormSwitch

View file

@ -1,5 +1,6 @@
import Prism from "prismjs";
import "prismjs/plugins/autoloader/prism-autoloader.js";
import { defaultStore } from "@/store";
// TODO
Prism.plugins.autoloader.languages_path =
@ -8,6 +9,8 @@ Prism.plugins.autoloader.languages_path =
const nonExistingLanguagesCache = new Set<string>();
export const loadLanguage = (lang: string) =>
new Promise<void>((resolve, reject) => {
// for now
if (!defaultStore.state.useEmojiCdn) return reject();
// cached non-existing language
if (nonExistingLanguagesCache.has(lang)) return reject();
// load language with autoloader