From e512f8c56dbf8c32810a6b25652f57a0ae9b4baf Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 30 Oct 2023 13:38:03 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E6=A8=99=E6=BA=96=E3=83=86?= =?UTF-8?q?=E3=83=BC=E3=83=9E=E3=81=A8=E5=90=8C=E3=81=98ID=E3=82=92?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=A6=E3=82=A4=E3=83=B3=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=83=BC=E3=83=AB=E3=81=A7=E3=81=8D=E3=81=A6=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=86=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #12188 --- CHANGELOG.md | 1 + packages/frontend/src/theme-store.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 380f214bd1..6dfe43ff0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ - Fix: 一部の言語でMisskey Webがクラッシュする問題を修正 - Fix: チャンネルの作成・更新時に失敗した場合何も表示されない問題を修正 #11983 - Fix: 個人カードのemojiがバッテリーになっている問題を修正 +- Fix: 標準テーマと同じIDを使用してインストールできてしまう問題を修正 ### Server - Enhance: RedisへのTLのキャッシュをオフにできるように diff --git a/packages/frontend/src/theme-store.ts b/packages/frontend/src/theme-store.ts index 9cae68d5d3..f37c01cca1 100644 --- a/packages/frontend/src/theme-store.ts +++ b/packages/frontend/src/theme-store.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Theme } from '@/scripts/theme.js'; +import { Theme, getBuiltinThemes } from '@/scripts/theme.js'; import { miLocalStorage } from '@/local-storage.js'; import { api } from '@/os.js'; import { $i } from '@/account.js'; @@ -29,6 +29,10 @@ export async function fetchThemes(): Promise { export async function addTheme(theme: Theme): Promise { if ($i == null) return; + const builtinThemes = await getBuiltinThemes(); + if (builtinThemes.some(t => t.id === theme.id)) { + throw new Error('builtin theme'); + } await fetchThemes(); const themes = getThemes().concat(theme); await api('i/registry/set', { scope: ['client'], key: 'themes', value: themes });