From ec8381522789a7fc4329a627770d80a0cd7774a4 Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Thu, 27 Feb 2025 09:32:39 +0900
Subject: [PATCH 1/6] =?UTF-8?q?fix(frontend):=20MkSelect=E3=81=AE=E5=88=9D?=
=?UTF-8?q?=E6=9C=9F=E5=80=A4=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?=
=?UTF-8?q?=E3=81=AA=E3=81=84=E5=A0=B4=E5=90=88=E3=81=8C=E3=81=82=E3=82=8B?=
=?UTF-8?q?=20(#15559)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* fix
* Update CHANGELOG.md
---
CHANGELOG.md | 1 +
packages/frontend/src/components/MkSelect.vue | 130 ++++++++++++++----
.../frontend/src/pages/settings/theme.vue | 83 ++++++++---
3 files changed, 168 insertions(+), 46 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0461fc8322..426727104d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@
- Fix: カスタム絵文字管理画面(beta)にてisSensitive/localOnlyの絞り込みが上手くいかない問題の修正 ( #15445 )
- Fix: ユーザのサジェスト中に@を入力してもサジェスト結果が消えないように `#14385`
- Fix: CWの注釈が100文字を超えている場合、ノート投稿ボタンを非アクティブに
+- Fix: テーマ選択で現在のテーマが初期表示されていない問題を修正
- 翻訳の更新
### Server
diff --git a/packages/frontend/src/components/MkSelect.vue b/packages/frontend/src/components/MkSelect.vue
index 83a79d0c9f..15717802ec 100644
--- a/packages/frontend/src/components/MkSelect.vue
+++ b/packages/frontend/src/components/MkSelect.vue
@@ -41,11 +41,28 @@ SPDX-License-Identifier: AGPL-3.0-only
diff --git a/packages/frontend/src/pages/search.user.vue b/packages/frontend/src/pages/search.user.vue
index e8bc4cd6d3..2b8faf5465 100644
--- a/packages/frontend/src/pages/search.user.vue
+++ b/packages/frontend/src/pages/search.user.vue
@@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.searchResult }}
-
+
@@ -49,14 +49,16 @@ const props = withDefaults(defineProps<{
const router = useRouter();
-const key = ref('');
+const key = ref(0);
+const userPagination = ref>();
+
const searchQuery = ref(toRef(props, 'query').value);
const searchOrigin = ref(toRef(props, 'origin').value);
-const userPagination = ref();
async function search() {
const query = searchQuery.value.toString().trim();
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (query == null || query === '') return;
//#region AP lookup
@@ -76,6 +78,7 @@ async function search() {
if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`);
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
} else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`);
}
@@ -118,6 +121,6 @@ async function search() {
},
};
- key.value = query;
+ key.value++;
}
diff --git a/packages/frontend/src/scripts/gen-search-query.ts b/packages/frontend/src/scripts/gen-search-query.ts
deleted file mode 100644
index a85ee01e26..0000000000
--- a/packages/frontend/src/scripts/gen-search-query.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SPDX-FileCopyrightText: syuilo and misskey-project
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-
-import * as Misskey from 'misskey-js';
-import { host as localHost } from '@@/js/config.js';
-
-export async function genSearchQuery(v: any, q: string) {
- let host: string;
- let userId: string;
- if (q.split(' ').some(x => x.startsWith('@'))) {
- for (const at of q.split(' ').filter(x => x.startsWith('@')).map(x => x.substring(1))) {
- if (at.includes('.')) {
- if (at === localHost || at === '.') {
- host = null;
- } else {
- host = at;
- }
- } else {
- const user = await v.api('users/show', Misskey.acct.parse(at)).catch(x => null);
- if (user) {
- userId = user.id;
- } else {
- // todo: show error
- }
- }
- }
- }
- return {
- query: q.split(' ').filter(x => !x.startsWith('/') && !x.startsWith('@')).join(' '),
- host: host,
- userId: userId,
- };
-}
From cc09de7b27bcc3ce1145171086e65e4dcf7cacbf Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Thu, 27 Feb 2025 16:13:37 +0900
Subject: [PATCH 3/6] New Crowdin updates (#15560)
* New translations ja-jp.yml (Russian)
* New translations ja-jp.yml (Catalan)
* New translations ja-jp.yml (Korean)
* New translations ja-jp.yml (Portuguese)
* New translations ja-jp.yml (Turkish)
* New translations ja-jp.yml (Chinese Traditional)
* New translations ja-jp.yml (English)
* New translations ja-jp.yml (Japanese, Kansai)
* New translations ja-jp.yml (Romanian)
* New translations ja-jp.yml (French)
* New translations ja-jp.yml (Spanish)
* New translations ja-jp.yml (Arabic)
* New translations ja-jp.yml (Czech)
* New translations ja-jp.yml (German)
* New translations ja-jp.yml (Greek)
* New translations ja-jp.yml (Italian)
* New translations ja-jp.yml (Dutch)
* New translations ja-jp.yml (Norwegian)
* New translations ja-jp.yml (Polish)
* New translations ja-jp.yml (Slovak)
* New translations ja-jp.yml (Swedish)
* New translations ja-jp.yml (Ukrainian)
* New translations ja-jp.yml (Chinese Simplified)
* New translations ja-jp.yml (Vietnamese)
* New translations ja-jp.yml (Indonesian)
* New translations ja-jp.yml (Bengali)
* New translations ja-jp.yml (Thai)
* New translations ja-jp.yml (Uzbek)
* New translations ja-jp.yml (Lao)
* New translations ja-jp.yml (Korean (Gyeongsang))
* New translations ja-jp.yml (Catalan)
---
locales/ar-SA.yml | 4 ++++
locales/bn-BD.yml | 3 +++
locales/ca-ES.yml | 8 ++++++++
locales/cs-CZ.yml | 4 ++++
locales/de-DE.yml | 4 ++++
locales/el-GR.yml | 2 ++
locales/en-US.yml | 4 ++++
locales/es-ES.yml | 4 ++++
locales/fr-FR.yml | 4 ++++
locales/id-ID.yml | 4 ++++
locales/it-IT.yml | 4 ++++
locales/ja-KS.yml | 4 ++++
locales/ko-GS.yml | 3 +++
locales/ko-KR.yml | 4 ++++
locales/lo-LA.yml | 2 ++
locales/nl-NL.yml | 2 ++
locales/no-NO.yml | 2 ++
locales/pl-PL.yml | 3 +++
locales/pt-PT.yml | 4 ++++
locales/ro-RO.yml | 2 ++
locales/ru-RU.yml | 4 ++++
locales/sk-SK.yml | 3 +++
locales/sv-SE.yml | 2 ++
locales/th-TH.yml | 4 ++++
locales/tr-TR.yml | 2 ++
locales/uk-UA.yml | 3 +++
locales/uz-UZ.yml | 3 +++
locales/vi-VN.yml | 4 ++++
locales/zh-CN.yml | 4 ++++
locales/zh-TW.yml | 4 ++++
30 files changed, 104 insertions(+)
diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml
index 91c90ce75a..1a3eeaead3 100644
--- a/locales/ar-SA.yml
+++ b/locales/ar-SA.yml
@@ -1584,3 +1584,7 @@ _offlineScreen:
_remoteLookupErrors:
_noSuchObject:
title: "غير موجود"
+_search:
+ searchScopeAll: "الكل"
+ searchScopeLocal: "المحلي"
+ searchScopeUser: "مستخدم محدد"
diff --git a/locales/bn-BD.yml b/locales/bn-BD.yml
index 709874ac20..d9a58ce824 100644
--- a/locales/bn-BD.yml
+++ b/locales/bn-BD.yml
@@ -1348,3 +1348,6 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "পাওয়া যায়নি"
+_search:
+ searchScopeAll: "সবগুলো"
+ searchScopeLocal: "স্থানীয়"
diff --git a/locales/ca-ES.yml b/locales/ca-ES.yml
index d12da0676f..a42ebb0a5a 100644
--- a/locales/ca-ES.yml
+++ b/locales/ca-ES.yml
@@ -2854,3 +2854,11 @@ _bootErrors:
otherOption1: "Esborrar la configuració i la memòria cau del client"
otherOption2: "Iniciar client senzill"
otherOption3: "Iniciar l'eina de reparació "
+_search:
+ searchScopeAll: "Tot"
+ searchScopeLocal: "Local"
+ searchScopeServer: "Instància "
+ searchScopeUser: "Especificar usuari"
+ pleaseEnterServerHost: "Introdueix l'adreça de la instància "
+ pleaseSelectUser: "Selecciona un usuari"
+ serverHostPlaceholder: "Ex: misskey.example.com"
diff --git a/locales/cs-CZ.yml b/locales/cs-CZ.yml
index afa3047c1d..fea8902ab8 100644
--- a/locales/cs-CZ.yml
+++ b/locales/cs-CZ.yml
@@ -2024,3 +2024,7 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Nenalezeno"
+_search:
+ searchScopeAll: "Vše"
+ searchScopeLocal: "Místní"
+ searchScopeUser: "Upřesnit uživatele"
diff --git a/locales/de-DE.yml b/locales/de-DE.yml
index d9072683cb..30f8574594 100644
--- a/locales/de-DE.yml
+++ b/locales/de-DE.yml
@@ -2614,3 +2614,7 @@ _remoteLookupErrors:
_noSuchObject:
title: "Nicht gefunden"
description: "Die angeforderte Ressource konnte nicht gefunden werden, bitte überprüfe die URI erneut."
+_search:
+ searchScopeAll: "Alle"
+ searchScopeLocal: "Lokal"
+ searchScopeUser: "Spezifischer Benutzer"
diff --git a/locales/el-GR.yml b/locales/el-GR.yml
index 4657842ca5..272ec07d89 100644
--- a/locales/el-GR.yml
+++ b/locales/el-GR.yml
@@ -397,3 +397,5 @@ _moderationLogTypes:
suspend: "Αποβολή"
_reversi:
total: "Σύνολο"
+_search:
+ searchScopeLocal: "Τοπικό"
diff --git a/locales/en-US.yml b/locales/en-US.yml
index fe4bbef391..04ddd2966a 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -2854,3 +2854,7 @@ _bootErrors:
otherOption1: "Delete client settings and cache"
otherOption2: "Start the simple client"
otherOption3: "Launch the repair tool"
+_search:
+ searchScopeAll: "All"
+ searchScopeLocal: "Local"
+ searchScopeUser: "Specific user"
diff --git a/locales/es-ES.yml b/locales/es-ES.yml
index 05d5e8c4c7..070bc397cb 100644
--- a/locales/es-ES.yml
+++ b/locales/es-ES.yml
@@ -2589,3 +2589,7 @@ _followRequest:
_remoteLookupErrors:
_noSuchObject:
title: "No se encuentra"
+_search:
+ searchScopeAll: "Todo"
+ searchScopeLocal: "Local"
+ searchScopeUser: "Especificar usuario"
diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml
index ccfd462a76..09a4d4bc84 100644
--- a/locales/fr-FR.yml
+++ b/locales/fr-FR.yml
@@ -2364,3 +2364,7 @@ _embedCodeGen:
_remoteLookupErrors:
_noSuchObject:
title: "Non trouvé"
+_search:
+ searchScopeAll: "Tous"
+ searchScopeLocal: "Local"
+ searchScopeUser: "Spécifier l'utilisateur·rice"
diff --git a/locales/id-ID.yml b/locales/id-ID.yml
index 7be56b1494..75e420aac7 100644
--- a/locales/id-ID.yml
+++ b/locales/id-ID.yml
@@ -2610,3 +2610,7 @@ _mediaControls:
_remoteLookupErrors:
_noSuchObject:
title: "Tidak dapat ditemukan"
+_search:
+ searchScopeAll: "Semua"
+ searchScopeLocal: "Lokal"
+ searchScopeUser: "Pengguna spesifik"
diff --git a/locales/it-IT.yml b/locales/it-IT.yml
index 66cdd5af76..eaf9e81b0e 100644
--- a/locales/it-IT.yml
+++ b/locales/it-IT.yml
@@ -2854,3 +2854,7 @@ _bootErrors:
otherOption1: "Nelle impostazioni, cancellare le impostazioni del client e svuotare la cache"
otherOption2: "Avviare il client predefinito"
otherOption3: "Avviare lo strumento di riparazione"
+_search:
+ searchScopeAll: "Tutte"
+ searchScopeLocal: "Locale"
+ searchScopeUser: "Profilo specifico"
diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml
index e5d0f153a6..f00eb6a6e3 100644
--- a/locales/ja-KS.yml
+++ b/locales/ja-KS.yml
@@ -2854,3 +2854,7 @@ _bootErrors:
otherOption1: "クライアント設定とキャッシュをほかす"
otherOption2: "簡易クライアントを起動"
otherOption3: "修復ツールを起動"
+_search:
+ searchScopeAll: "みんな"
+ searchScopeLocal: "ローカル"
+ searchScopeUser: "ユーザー指定"
diff --git a/locales/ko-GS.yml b/locales/ko-GS.yml
index 4b9650b636..ce83ef0e07 100644
--- a/locales/ko-GS.yml
+++ b/locales/ko-GS.yml
@@ -843,3 +843,6 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "몬 찾앗십니다"
+_search:
+ searchScopeAll: "말캉"
+ searchScopeUser: "사용자 지정"
diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml
index d956b37934..82b42ec2be 100644
--- a/locales/ko-KR.yml
+++ b/locales/ko-KR.yml
@@ -2841,3 +2841,7 @@ _captcha:
_bootErrors:
title: "로딩이 실패함"
solution4: "(Tor Browser) dom.webaudio.enabled를 true로 설정하세요"
+_search:
+ searchScopeAll: "전체"
+ searchScopeLocal: "로컬"
+ searchScopeUser: "사용자 지정"
diff --git a/locales/lo-LA.yml b/locales/lo-LA.yml
index 2d55c289aa..06acda44be 100644
--- a/locales/lo-LA.yml
+++ b/locales/lo-LA.yml
@@ -477,3 +477,5 @@ _moderationLogTypes:
_remoteLookupErrors:
_noSuchObject:
title: "ບໍ່ພົບ"
+_search:
+ searchScopeAll: "ທັງໝົດ"
diff --git a/locales/nl-NL.yml b/locales/nl-NL.yml
index 685094b4a5..320b9d62ba 100644
--- a/locales/nl-NL.yml
+++ b/locales/nl-NL.yml
@@ -540,3 +540,5 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Niet gevonden"
+_search:
+ searchScopeAll: "Alle"
diff --git a/locales/no-NO.yml b/locales/no-NO.yml
index 474e05ba67..c1b145cab4 100644
--- a/locales/no-NO.yml
+++ b/locales/no-NO.yml
@@ -730,3 +730,5 @@ _moderationLogTypes:
_remoteLookupErrors:
_noSuchObject:
title: "Ikke funnet"
+_search:
+ searchScopeAll: "Alle"
diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml
index 9bd585de86..13f3b118fe 100644
--- a/locales/pl-PL.yml
+++ b/locales/pl-PL.yml
@@ -1583,3 +1583,6 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Nie znaleziono"
+_search:
+ searchScopeAll: "Wszystkie"
+ searchScopeLocal: "Lokalne"
diff --git a/locales/pt-PT.yml b/locales/pt-PT.yml
index cc05e33703..8892e6574f 100644
--- a/locales/pt-PT.yml
+++ b/locales/pt-PT.yml
@@ -2757,3 +2757,7 @@ _remoteLookupErrors:
_noSuchObject:
title: "Não encontrado"
description: "O recurso solicitado não foi encontrado, confira o endereço."
+_search:
+ searchScopeAll: "Todos"
+ searchScopeLocal: "Local"
+ searchScopeUser: "Usuário específico"
diff --git a/locales/ro-RO.yml b/locales/ro-RO.yml
index 07f4c98d96..0d43e174a7 100644
--- a/locales/ro-RO.yml
+++ b/locales/ro-RO.yml
@@ -736,3 +736,5 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Nu a fost găsit"
+_search:
+ searchScopeAll: "Tot"
diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml
index 7ed41a9c47..5ba3bc8e87 100644
--- a/locales/ru-RU.yml
+++ b/locales/ru-RU.yml
@@ -2147,3 +2147,7 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Не найдено"
+_search:
+ searchScopeAll: "Все"
+ searchScopeLocal: "Местная"
+ searchScopeUser: "Указанный пользователь"
diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml
index 521d172671..91de8a3352 100644
--- a/locales/sk-SK.yml
+++ b/locales/sk-SK.yml
@@ -1449,3 +1449,6 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Nenájdené"
+_search:
+ searchScopeAll: "Všetko"
+ searchScopeLocal: "Lokálne"
diff --git a/locales/sv-SE.yml b/locales/sv-SE.yml
index 5961605645..91413e3bc7 100644
--- a/locales/sv-SE.yml
+++ b/locales/sv-SE.yml
@@ -707,3 +707,5 @@ _reversi:
white: "Vit"
_selfXssPrevention:
warning: "VARNING"
+_search:
+ searchScopeAll: "Allt"
diff --git a/locales/th-TH.yml b/locales/th-TH.yml
index ec83ba888c..b76c088b3f 100644
--- a/locales/th-TH.yml
+++ b/locales/th-TH.yml
@@ -2709,3 +2709,7 @@ _embedCodeGen:
_remoteLookupErrors:
_noSuchObject:
title: "ไม่พบหน้าที่ต้องการ"
+_search:
+ searchScopeAll: "ทั้งหมด"
+ searchScopeLocal: "ท้องถิ่น"
+ searchScopeUser: "ผู้ใช้เฉพาะ"
diff --git a/locales/tr-TR.yml b/locales/tr-TR.yml
index 2c63f15aa2..e99aa64254 100644
--- a/locales/tr-TR.yml
+++ b/locales/tr-TR.yml
@@ -460,3 +460,5 @@ _deck:
_moderationLogTypes:
suspend: "askıya al"
resetPassword: "Şifre sıfırlama"
+_search:
+ searchScopeAll: "Tümü"
diff --git a/locales/uk-UA.yml b/locales/uk-UA.yml
index a83ad80683..4f7e6430e9 100644
--- a/locales/uk-UA.yml
+++ b/locales/uk-UA.yml
@@ -1624,3 +1624,6 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Не знайдено"
+_search:
+ searchScopeAll: "Всі"
+ searchScopeLocal: "Локальна"
diff --git a/locales/uz-UZ.yml b/locales/uz-UZ.yml
index 6015492b92..c70802e417 100644
--- a/locales/uz-UZ.yml
+++ b/locales/uz-UZ.yml
@@ -1094,3 +1094,6 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Topilmadi"
+_search:
+ searchScopeAll: "Barcha"
+ searchScopeLocal: "Mahalliy"
diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml
index e6a9418126..628bd513fe 100644
--- a/locales/vi-VN.yml
+++ b/locales/vi-VN.yml
@@ -1930,3 +1930,7 @@ _reversi:
_remoteLookupErrors:
_noSuchObject:
title: "Không tìm thấy"
+_search:
+ searchScopeAll: "Tất cả"
+ searchScopeLocal: "Máy chủ này"
+ searchScopeUser: "Người dùng chỉ định"
diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml
index 5fec7353dc..1599db5854 100644
--- a/locales/zh-CN.yml
+++ b/locales/zh-CN.yml
@@ -2854,3 +2854,7 @@ _bootErrors:
otherOption1: "清除客户端设定与缓存"
otherOption2: "使用简易客户端"
otherOption3: "启动修复工具"
+_search:
+ searchScopeAll: "全部"
+ searchScopeLocal: "本地"
+ searchScopeUser: "用户指定"
diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml
index 23b55d8da4..10079f2bee 100644
--- a/locales/zh-TW.yml
+++ b/locales/zh-TW.yml
@@ -2854,3 +2854,7 @@ _bootErrors:
otherOption1: "刪除用戶端設定和快取"
otherOption2: "啟動簡易用戶端"
otherOption3: "啟動修復工具"
+_search:
+ searchScopeAll: "全部"
+ searchScopeLocal: "本地"
+ searchScopeUser: "指定使用者"
From 94a3e37ba86374b2a0c7d174a5eb67c971002f1e Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
Date: Thu, 27 Feb 2025 08:58:40 +0000
Subject: [PATCH 4/6] Release: 2025.2.1
---
package.json | 2 +-
packages/misskey-js/package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 43d4a01fb7..201b30ec36 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "misskey",
- "version": "2025.2.1-beta.2",
+ "version": "2025.2.1",
"codename": "nasubi",
"repository": {
"type": "git",
diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json
index 06ea1c78ac..f9a61fd0b1 100644
--- a/packages/misskey-js/package.json
+++ b/packages/misskey-js/package.json
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "misskey-js",
- "version": "2025.2.1-beta.2",
+ "version": "2025.2.1",
"description": "Misskey SDK for JavaScript",
"license": "MIT",
"main": "./built/index.js",
From a3bba23b7d6e0d3fde4943b95cc42afa3dcb35d4 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
Date: Thu, 27 Feb 2025 08:58:46 +0000
Subject: [PATCH 5/6] [skip ci] Update CHANGELOG.md (prepend template)
---
CHANGELOG.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53cf1b0cca..f765ea48e2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+## Unreleased
+
+### General
+-
+
+### Client
+-
+
+### Server
+-
+
+
## 2025.2.1
### General
From c63c3462dd00e7de3f40b15ad43993a26734263f Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Fri, 28 Feb 2025 09:34:21 +0900
Subject: [PATCH 6/6] refactor
---
packages/backend/src/core/CreateSystemUserService.ts | 2 +-
packages/backend/src/core/SignupService.ts | 4 ++--
packages/backend/src/misc/is-native-token.ts | 7 -------
.../src/misc/{generate-native-user-token.ts => token.ts} | 5 +++--
packages/backend/src/server/api/AuthenticateService.ts | 4 ++--
.../backend/src/server/api/endpoints/i/regenerate-token.ts | 4 ++--
6 files changed, 10 insertions(+), 16 deletions(-)
delete mode 100644 packages/backend/src/misc/is-native-token.ts
rename packages/backend/src/misc/{generate-native-user-token.ts => token.ts} (54%)
diff --git a/packages/backend/src/core/CreateSystemUserService.ts b/packages/backend/src/core/CreateSystemUserService.ts
index 6c5b0f6a36..7ef75edb3c 100644
--- a/packages/backend/src/core/CreateSystemUserService.ts
+++ b/packages/backend/src/core/CreateSystemUserService.ts
@@ -14,7 +14,7 @@ import { IdService } from '@/core/IdService.js';
import { MiUserKeypair } from '@/models/UserKeypair.js';
import { MiUsedUsername } from '@/models/UsedUsername.js';
import { DI } from '@/di-symbols.js';
-import generateNativeUserToken from '@/misc/generate-native-user-token.js';
+import { generateNativeUserToken } from '@/misc/token.js';
import { bindThis } from '@/decorators.js';
@Injectable()
diff --git a/packages/backend/src/core/SignupService.ts b/packages/backend/src/core/SignupService.ts
index 3865392b7f..d2f09ea15d 100644
--- a/packages/backend/src/core/SignupService.ts
+++ b/packages/backend/src/core/SignupService.ts
@@ -14,7 +14,7 @@ import { MiUserProfile } from '@/models/UserProfile.js';
import { IdService } from '@/core/IdService.js';
import { MiUserKeypair } from '@/models/UserKeypair.js';
import { MiUsedUsername } from '@/models/UsedUsername.js';
-import generateUserToken from '@/misc/generate-native-user-token.js';
+import { generateNativeUserToken } from '@/misc/token.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { InstanceActorService } from '@/core/InstanceActorService.js';
import { bindThis } from '@/decorators.js';
@@ -74,7 +74,7 @@ export class SignupService {
}
// Generate secret
- const secret = generateUserToken();
+ const secret = generateNativeUserToken();
// Check username duplication
if (await this.usersRepository.exists({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) {
diff --git a/packages/backend/src/misc/is-native-token.ts b/packages/backend/src/misc/is-native-token.ts
deleted file mode 100644
index 300c4c05b3..0000000000
--- a/packages/backend/src/misc/is-native-token.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * SPDX-FileCopyrightText: syuilo and misskey-project
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-
-// eslint-disable-next-line import/no-default-export
-export default (token: string) => token.length === 16;
diff --git a/packages/backend/src/misc/generate-native-user-token.ts b/packages/backend/src/misc/token.ts
similarity index 54%
rename from packages/backend/src/misc/generate-native-user-token.ts
rename to packages/backend/src/misc/token.ts
index 85fb383ba2..5d37cba26d 100644
--- a/packages/backend/src/misc/generate-native-user-token.ts
+++ b/packages/backend/src/misc/token.ts
@@ -5,5 +5,6 @@
import { secureRndstr } from '@/misc/secure-rndstr.js';
-// eslint-disable-next-line import/no-default-export
-export default () => secureRndstr(16);
+export const generateNativeUserToken = () => secureRndstr(16);
+
+export const isNativeUserToken = (token: string) => token.length === 16;
diff --git a/packages/backend/src/server/api/AuthenticateService.ts b/packages/backend/src/server/api/AuthenticateService.ts
index 690ff2e022..601618553e 100644
--- a/packages/backend/src/server/api/AuthenticateService.ts
+++ b/packages/backend/src/server/api/AuthenticateService.ts
@@ -11,7 +11,7 @@ import type { MiAccessToken } from '@/models/AccessToken.js';
import { MemoryKVCache } from '@/misc/cache.js';
import type { MiApp } from '@/models/App.js';
import { CacheService } from '@/core/CacheService.js';
-import isNativeToken from '@/misc/is-native-token.js';
+import { isNativeUserToken } from '@/misc/token.js';
import { bindThis } from '@/decorators.js';
export class AuthenticationError extends Error {
@@ -46,7 +46,7 @@ export class AuthenticateService implements OnApplicationShutdown {
return [null, null];
}
- if (isNativeToken(token)) {
+ if (isNativeUserToken(token)) {
const user = await this.cacheService.localUserByNativeTokenCache.fetch(token,
() => this.usersRepository.findOneBy({ token }) as Promise);
diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts
index 78f3cce9ad..d25d5d5e0e 100644
--- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts
+++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts
@@ -7,7 +7,7 @@ import bcrypt from 'bcryptjs';
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { UsersRepository, UserProfilesRepository } from '@/models/_.js';
-import generateUserToken from '@/misc/generate-native-user-token.js';
+import { generateNativeUserToken } from '@/misc/token.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { DI } from '@/di-symbols.js';
@@ -49,7 +49,7 @@ export default class extends Endpoint { // eslint-
throw new Error('incorrect password');
}
- const newToken = generateUserToken();
+ const newToken = generateNativeUserToken();
await this.usersRepository.update(me.id, {
token: newToken,