From d9d124cbf0e0dc93496796076a0c89f7607200ec Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Thu, 5 Jan 2023 04:06:48 +0000 Subject: [PATCH] Admin set default reactions (#9404) Co-authored-by: ThatOneCalculator Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9404 --- CALCKEY.md | 2 ++ locales/ar-SA.yml | 1 - locales/bn-BD.yml | 1 - locales/de-DE.yml | 1 - locales/en-US.yml | 2 +- locales/es-ES.yml | 1 - locales/fr-FR.yml | 3 +- locales/id-ID.yml | 1 - locales/it-IT.yml | 1 - locales/ja-JP.yml | 1 - locales/ja-KS.yml | 1 - locales/ko-KR.yml | 1 - locales/pl-PL.yml | 1 - locales/ro-RO.yml | 1 - locales/ru-RU.yml | 1 - locales/sk-SK.yml | 1 - locales/th-TH.yml | 1 - locales/uk-UA.yml | 1 - locales/vi-VN.yml | 1 - locales/zh-CN.yml | 1 - locales/zh-TW.yml | 1 - .../1672882664294-DefaultReaction.js | 12 ++++++++ packages/backend/src/misc/reaction-lib.ts | 2 +- packages/backend/src/models/entities/meta.ts | 6 ++-- .../src/remote/activitypub/renderer/like.ts | 4 ++- .../src/server/api/endpoints/admin/meta.ts | 10 +++---- .../server/api/endpoints/admin/update-meta.ts | 6 ++-- .../backend/src/server/api/endpoints/meta.ts | 6 ++++ .../src/services/fetch-instance-metadata.ts | 13 +++++---- .../client/src/components/MkStarButton.vue | 9 ++++-- packages/client/src/instance.ts | 4 +-- packages/client/src/pages/admin/settings.vue | 29 ++++++++++++++++++- packages/client/src/pages/instance-info.vue | 3 +- 33 files changed, 81 insertions(+), 48 deletions(-) create mode 100644 packages/backend/migration/1672882664294-DefaultReaction.js diff --git a/CALCKEY.md b/CALCKEY.md index 379915f41..6a6faed2f 100644 --- a/CALCKEY.md +++ b/CALCKEY.md @@ -104,6 +104,8 @@ - Improve blocking instances - Release notes - New post style +- Admins set default reaction emoji + - Allows custom emoji - MissV: [fix Misskey Forkbomb](https://code.vtopia.live/Vtopia/MissV/commit/40b23c070bd4adbb3188c73546c6c625138fb3c1) - [Make showing ads optional](https://github.com/misskey-dev/misskey/pull/8996) - [Tapping avatar in mobile opens account modal](https://github.com/misskey-dev/misskey/pull/9056) diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml index da4361ef7..fc29623dd 100644 --- a/locales/ar-SA.yml +++ b/locales/ar-SA.yml @@ -556,7 +556,6 @@ tokenRequested: "منح حق الوصول إلى الحساب" pluginTokenRequestedDescription: "ستتمكن الإضافة من استخدام هذه الأذونات." notificationType: "أنواع الإشعارات" edit: "التعديل" -useStarForReactionFallback: "استخدم ★ كبديل إذا كان التفاعل مجهولًا" emailServer: "خادم البريد الإلكتروني" emailConfigInfo: "يستخدم لتأكيد عنوان بريدك الإلكتروني ولإعادة تعيين كلمة المرور إن نسيتها." email: "البريد الإلكتروني " diff --git a/locales/bn-BD.yml b/locales/bn-BD.yml index 58e03e4ba..3ed6e53aa 100644 --- a/locales/bn-BD.yml +++ b/locales/bn-BD.yml @@ -577,7 +577,6 @@ tokenRequested: "অ্যাকাউন্টে অ্যাক্সেস pluginTokenRequestedDescription: "এই প্লাগইনটি এখানে দেওয়া অনুমুতিসমূহ ব্যাবহার করবে" notificationType: "বিজ্ঞপ্তির ধরন" edit: "সম্পাদনা" -useStarForReactionFallback: "রিঅ্যাকশনের ইমোজি না জানলে ★ ব্যবহার করুন" emailServer: "ইমেইল সার্ভার" enableEmail: "ইমেইল বিতরণ চালু করুন" emailConfigInfo: "আপনার ইমেল ঠিকানা নিশ্চিত করতে এবং আপনার পাসওয়ার্ড পুনরায় সেট করতে ব্যবহৃত হয়" diff --git a/locales/de-DE.yml b/locales/de-DE.yml index cf9cc7d83..da470c294 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -581,7 +581,6 @@ tokenRequested: "Zugriff zum Benutzerkonto gewähren" pluginTokenRequestedDescription: "Dieses Plugin wird die hier konfigurierten Berechtigungen verwenden können." notificationType: "Art der Benachrichtigung" edit: "Bearbeiten" -useStarForReactionFallback: "Verwende ★ falls das Reaktions-Emoji unbekannt ist" emailServer: "Email-Server" enableEmail: "Email-Versand aktivieren" emailConfigInfo: "Zur Email-Bestätigung bei Registrierung oder zum Zurücksetzen des Passworts verwendet" diff --git a/locales/en-US.yml b/locales/en-US.yml index b6118ec29..ba39a1b29 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -583,7 +583,6 @@ tokenRequested: "Grant access to account" pluginTokenRequestedDescription: "This plugin will be able to use the permissions set here." notificationType: "Notification type" edit: "Edit" -useStarForReactionFallback: "Use ★ as fallback if the reaction emoji is unknown" emailServer: "Email server" enableEmail: "Enable email distribution" emailConfigInfo: "Used to confirm your email during sign-up or if you forget your password" @@ -930,6 +929,7 @@ moveFrom: "Move to this account from an older account" moveFromLabel: "Account you're moving from:" moveFromDescription: "This will set an alias of your old account so that you can move from that account to this current one. Do this BEFORE moving from your older account. Please enter the tag of the account formatted like @person@instance.com" migrationConfirm: "Are you absolutely sure you want to migrate your acccount to {account}? Once you do this, you won't be able to reverse it, and you won't be able to use your account normally again.\nAlso, please ensure that you've set this current account as the account you're moving from." +defaultReaction: "Default emoji reaction for outgoing and incoming posts" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing NSFW media via Machine Learning. This will slightly increase the load on the server." diff --git a/locales/es-ES.yml b/locales/es-ES.yml index 92e305d92..1d35c878c 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -580,7 +580,6 @@ tokenRequested: "Permiso de acceso a la cuenta" pluginTokenRequestedDescription: "Este plugin podrá usar los permisos descritos aquí" notificationType: "Tipo de notificación" edit: "Editar" -useStarForReactionFallback: "En caso de que los emojis de reacciones no sean claros, usar en su lugar una estrella" emailServer: "Servidor de correo" enableEmail: "Activar el envío de correos electrónicos" emailConfigInfo: "Usar en caso de validación de correo electrónico y pedido de contraseña" diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index 5c5e7089f..9f7028d3b 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -567,14 +567,13 @@ large: "Grand" medium: "Moyen" small: "Petit" generateAccessToken: "Générer un jeton d'accès" -permission: "Autorisations " +permission: "Autorisations" enableAll: "Tout activer" disableAll: "Tout désactiver" tokenRequested: "Autoriser l'accès au compte" pluginTokenRequestedDescription: "Ce plugin pourra utiliser les autorisations définies ici." notificationType: "Type de notifications" edit: "Editer" -useStarForReactionFallback: "Utiliser ★ comme alternative si l’émoji de réaction est inconnu" emailServer: "Serveur mail" enableEmail: "Activer la distribution de courriel" emailConfigInfo: "Utilisé pour confirmer votre adresse de courriel et la réinitialisation de votre mot de passe en cas d’oubli." diff --git a/locales/id-ID.yml b/locales/id-ID.yml index b83a70bc1..bb3904e2e 100644 --- a/locales/id-ID.yml +++ b/locales/id-ID.yml @@ -577,7 +577,6 @@ tokenRequested: "Berikan ijin akses ke akun" pluginTokenRequestedDescription: "Plugin ini dapat menggunakan setelan ijin disini." notificationType: "Jenis pemberitahuan" edit: "Sunting" -useStarForReactionFallback: "Gunakan ★ sebagai fallback jika reaksi emoji tidak diketahui" emailServer: "Peladen surel" enableEmail: "Nyalakan distribusi surel" emailConfigInfo: "Digunakan untuk mengonfirmasi surel kamu disaat mendaftar dan lupa kata sandi" diff --git a/locales/it-IT.yml b/locales/it-IT.yml index 9e188ae08..185d12d5a 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -573,7 +573,6 @@ tokenRequested: "Autorizza accesso all'account" pluginTokenRequestedDescription: "Il plugin potrà utilizzare le autorizzazioni impostate qui." notificationType: "Tipo di notifiche" edit: "Modifica" -useStarForReactionFallback: "Se è sconosciuto l'emoji di reazione, usare la ★ come alternativa." emailServer: "Server email" enableEmail: "Abilita consegna email" emailConfigInfo: "Utilizzato per verificare il tuo indirizzo di posta elettronica e per reimpostare la tua password" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index ba29131a5..867331cc9 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -583,7 +583,6 @@ tokenRequested: "アカウントへのアクセス許可" pluginTokenRequestedDescription: "このプラグインはここで設定した権限を行使できるようになります。" notificationType: "通知の種類" edit: "編集" -useStarForReactionFallback: "リアクション絵文字が不明な場合、代わりに★を使う" emailServer: "メールサーバー" enableEmail: "メール配信機能を有効化する" emailConfigInfo: "メールアドレスの確認やパスワードリセットの際に使います" diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml index 02d9e87bb..d5c48276f 100644 --- a/locales/ja-KS.yml +++ b/locales/ja-KS.yml @@ -579,7 +579,6 @@ tokenRequested: "アカウントへのアクセス許可" pluginTokenRequestedDescription: "このプラグインはここで設定した権限を使えるようになるで。" notificationType: "通知の種類" edit: "編集" -useStarForReactionFallback: "リアクションがようわからん場合、★を使う" emailServer: "メールサーバー" enableEmail: "メール配信を受け取る" emailConfigInfo: "メールアドレスの確認とかパスワードリセットの時に使うで" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index 8b2730a94..b87a4b06c 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -580,7 +580,6 @@ tokenRequested: "계정 접근 허용" pluginTokenRequestedDescription: "이 플러그인은 여기서 설정한 권한을 사용할 수 있게 됩니다." notificationType: "알림 유형" edit: "편집" -useStarForReactionFallback: "알 수 없는 리액션 이모지 대신 ★ 사용" emailServer: "메일 서버" enableEmail: "이메일 송신 기능 활성화" emailConfigInfo: "가입 시 메일 주소 확인이나 비밀번호 초기화 시에 사용합니다." diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml index ce24665e8..a7cbec5b6 100644 --- a/locales/pl-PL.yml +++ b/locales/pl-PL.yml @@ -572,7 +572,6 @@ tokenRequested: "Przydziel dostęp do konta" pluginTokenRequestedDescription: "Ta wtyczka będzie mogła korzystać z ustawionych tu uprawnień." notificationType: "Rodzaj powiadomień" edit: "Edytuj" -useStarForReactionFallback: "Użyj ★ jako zapasowego emoji, gdy emoji reakcji jest nieznane" emailServer: "Serwer poczty e-mail" enableEmail: "Włącz dostarczanie wiadomości e-mail" emailConfigInfo: "Wykorzystywany do potwierdzenia adresu e-mail w trakcie rejestracji, lub gdy zapomnisz hasła" diff --git a/locales/ro-RO.yml b/locales/ro-RO.yml index 1ccddd145..8408d4c77 100644 --- a/locales/ro-RO.yml +++ b/locales/ro-RO.yml @@ -576,7 +576,6 @@ tokenRequested: "Acordă acces la cont" pluginTokenRequestedDescription: "Acest plugin va putea să folosească permisiunile setate aici." notificationType: "Tipul notificării" edit: "Editează" -useStarForReactionFallback: "Folosește ★ ca fallback dacă emoji-ul este necunoscut" emailServer: "Server email" enableEmail: "Activează distribuția de emailuri" emailConfigInfo: "Folosit pentru a confirma emailul tău în timpul logări dacă îți uiți parola" diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index 6f985a5f6..9d76dc623 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -580,7 +580,6 @@ tokenRequested: "Открыть доступ к учётной записи" pluginTokenRequestedDescription: "Это расширение сможет пользоваться разрешениями, установленными здесь." notificationType: "Тип уведомления" edit: "Изменить" -useStarForReactionFallback: "Ставить ★ в качестве реакции вместо неизвестного эмодзи" emailServer: "Сервер электронной почты" enableEmail: "Включить обмен электронной почтой" emailConfigInfo: "Используется для подтверждения адреса электронной почты и сброса пароля." diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml index 38ded0c8f..ced0d67b7 100644 --- a/locales/sk-SK.yml +++ b/locales/sk-SK.yml @@ -579,7 +579,6 @@ tokenRequested: "Povoliť prístup k účtu" pluginTokenRequestedDescription: "Tento plugin bude môcť používať oprávnenia nastavené tu." notificationType: "Typ oznámenia" edit: "Upraviť" -useStarForReactionFallback: "Použiť ★ keď emoji reakcie nie je známe" emailServer: "Email server" enableEmail: "Zapnúť email" emailConfigInfo: "Používa sa na overenie emaily pri registrácii alebo pri zabudnutí hesla" diff --git a/locales/th-TH.yml b/locales/th-TH.yml index 6f0a28b08..173548e90 100644 --- a/locales/th-TH.yml +++ b/locales/th-TH.yml @@ -580,7 +580,6 @@ tokenRequested: "ให้สิทธิ์การเข้าถึงบั pluginTokenRequestedDescription: "ปลั๊กอินนี้จะสามารถใช้การอนุญาตที่ตั้งค่าไว้ที่นี่นะ" notificationType: "ประเภทการแจ้งเตือน" edit: "แก้ไข" -useStarForReactionFallback: "ใช้ ★ เป็นทางเลือกแทนถ้าหากไม่ทราบอิโมจิ" emailServer: "อีเมล์เซิร์ฟเวอร์" enableEmail: "เปิดใช้งานการกระจายอีเมล" emailConfigInfo: "ใช้เพื่อยืนยันอีเมลของคุณระหว่างการสมัครหรือถ้าหากคุณลืมรหัสผ่าน" diff --git a/locales/uk-UA.yml b/locales/uk-UA.yml index 053827fa1..63caf22c1 100644 --- a/locales/uk-UA.yml +++ b/locales/uk-UA.yml @@ -577,7 +577,6 @@ tokenRequested: "Надати доступ до акаунту" pluginTokenRequestedDescription: "Цей плагін зможе використовувати дозволи які тут вказані." notificationType: "Тип сповіщення" edit: "Редагувати" -useStarForReactionFallback: "Використовувати ★ як запасний варіант, якщо емодзі реакції невідомий" emailServer: "Сервер електронної пошти" enableEmail: "Увімкнути функцію доставки пошти" emailConfigInfo: "Використовується для підтвердження електронної пошти підчас реєстрації, а також для відновлення паролю." diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml index bd0ab3e45..4f38b80c8 100644 --- a/locales/vi-VN.yml +++ b/locales/vi-VN.yml @@ -580,7 +580,6 @@ tokenRequested: "Cấp quyền truy cập vào tài khoản" pluginTokenRequestedDescription: "Plugin này sẽ có thể sử dụng các quyền được đặt ở đây." notificationType: "Loại thông báo" edit: "Sửa" -useStarForReactionFallback: "Dùng ★ nếu emoji biểu cảm không có" emailServer: "Email máy chủ" enableEmail: "Bật phân phối email" emailConfigInfo: "Được dùng để xác minh email của bạn lúc đăng ký hoặc nếu bạn quên mật khẩu của mình" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index e4782914a..310121c5a 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -580,7 +580,6 @@ tokenRequested: "允许访问账户" pluginTokenRequestedDescription: "此插件将能够拥有此处设置的权限" notificationType: "通知类型" edit: "编辑" -useStarForReactionFallback: "如果回应的是未知表情符号,则使用★作为代替" emailServer: "邮件服务器" enableEmail: "启用发送邮件功能" emailConfigInfo: "用于确认电子邮件和密码重置" diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index 892cdbcf1..e7528f9a2 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -580,7 +580,6 @@ tokenRequested: "允許存取帳戶" pluginTokenRequestedDescription: "此外掛將擁有在此設定的權限。" notificationType: "通知形式" edit: "編輯" -useStarForReactionFallback: "以★代替未知的表情符號" emailServer: "電郵伺服器" enableEmail: "啟用發送電郵功能" emailConfigInfo: "用於確認電郵地址及密碼重置" diff --git a/packages/backend/migration/1672882664294-DefaultReaction.js b/packages/backend/migration/1672882664294-DefaultReaction.js new file mode 100644 index 000000000..498a1810d --- /dev/null +++ b/packages/backend/migration/1672882664294-DefaultReaction.js @@ -0,0 +1,12 @@ +export class DefaultReaction1672882664294 { + name = 'DefaultReaction1672882664294' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "defaultReaction" character varying(256) NOT NULL DEFAULT '⭐'`); + await queryRunner.query(`COMMENT ON COLUMN "meta"."defaultReaction" IS 'The fallback reaction for emoji reacts'`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "defaultReaction"`); + } +} diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index fefc2781f..5799fd57d 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -21,7 +21,7 @@ const legacies: Record = { export async function getFallbackReaction(): Promise { const meta = await fetchMeta(); - return meta.useStarForReactionFallback ? '⭐' : '👍'; + return meta.defaultReaction; } export function convertLegacyReactions(reactions: Record) { diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index c24936c03..46cde0505 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -57,10 +57,10 @@ export class Meta { }) public disableGlobalTimeline: boolean; - @Column('boolean', { - default: false, + @Column('varchar', { + length: 256, default: '⭐', }) - public useStarForReactionFallback: boolean; + public defaultReaction: string; @Column('varchar', { length: 64, array: true, default: '{}', diff --git a/packages/backend/src/remote/activitypub/renderer/like.ts b/packages/backend/src/remote/activitypub/renderer/like.ts index 12477d637..a54095139 100644 --- a/packages/backend/src/remote/activitypub/renderer/like.ts +++ b/packages/backend/src/remote/activitypub/renderer/like.ts @@ -4,16 +4,18 @@ import { NoteReaction } from '@/models/entities/note-reaction.js'; import { Note } from '@/models/entities/note.js'; import { Emojis } from '@/models/index.js'; import renderEmoji from './emoji.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export const renderLike = async (noteReaction: NoteReaction, note: Note) => { const reaction = noteReaction.reaction; + const meta = await fetchMeta(); const object = { type: 'Like', id: `${config.url}/likes/${noteReaction.id}`, actor: `${config.url}/users/${noteReaction.userId}`, object: note.uri ? note.uri : `${config.url}/notes/${noteReaction.noteId}`, - ... (!['\u2b50', '\u1f44d'].includes(reaction) ? { + ... (!meta.defaultReaction.includes(reaction) ? { content: reaction, _misskey_reaction: reaction, } : {}), diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 71a217d93..c6b6a3cd9 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -159,10 +159,6 @@ export const meta = { type: 'string', optional: false, nullable: true, }, - userStarForReactionFallback: { - type: 'boolean', - optional: true, nullable: false, - }, recommendedInstances: { type: 'array', optional: true, nullable: false, @@ -368,6 +364,10 @@ export const meta = { type: 'boolean', optional: true, nullable: false, }, + defaultReaction: { + type: 'string', + optional: false, nullable: false, + }, }, }, } as const; @@ -425,7 +425,7 @@ export default define(meta, paramDef, async (ps, me) => { pinnedPages: instance.pinnedPages, pinnedClipId: instance.pinnedClipId, cacheRemoteFiles: instance.cacheRemoteFiles, - useStarForReactionFallback: instance.useStarForReactionFallback, + defaultReaction: instance.defaultReaction, recommendedInstances: instance.recommendedInstances, pinnedUsers: instance.pinnedUsers, customMOTD: instance.customMOTD, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 61a1338f2..3efacdf50 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -18,7 +18,7 @@ export const paramDef = { disableLocalTimeline: { type: 'boolean', nullable: true }, disableRecommendedTimeline: { type: 'boolean', nullable: true }, disableGlobalTimeline: { type: 'boolean', nullable: true }, - useStarForReactionFallback: { type: 'boolean', nullable: true }, + defaultReaction: { type: 'string', nullable: true }, recommendedInstances: { type: 'array', nullable: true, items: { type: 'string', } }, @@ -141,8 +141,8 @@ export default define(meta, paramDef, async (ps, me) => { set.disableGlobalTimeline = ps.disableGlobalTimeline; } - if (typeof ps.useStarForReactionFallback === 'boolean') { - set.useStarForReactionFallback = ps.useStarForReactionFallback; + if (typeof ps.defaultReaction === 'string') { + set.defaultReaction = ps.defaultReaction; } if (Array.isArray(ps.pinnedUsers)) { diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index f61236fa0..3e3288d6d 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -309,6 +309,11 @@ export const meta = { optional: true, nullable: false, default: false, }, + defaultReaction: { + type: 'string', + optional: 'false', nullable: false, + default: '⭐', + }, }, }, } as const; @@ -401,6 +406,7 @@ export default define(meta, paramDef, async (ps, me) => { enableServiceWorker: instance.enableServiceWorker, translatorAvailable: instance.deeplAuthKey != null, + defaultReaction: instance.defaultReaction, ...(ps.detail ? { pinnedPages: instance.privateMode && !me ? [] : instance.pinnedPages, diff --git a/packages/backend/src/services/fetch-instance-metadata.ts b/packages/backend/src/services/fetch-instance-metadata.ts index 4bf101bb4..d3f674d6f 100644 --- a/packages/backend/src/services/fetch-instance-metadata.ts +++ b/packages/backend/src/services/fetch-instance-metadata.ts @@ -1,12 +1,13 @@ -import { DOMWindow, JSDOM } from 'jsdom'; +import { URL } from 'node:url'; +import { JSDOM } from 'jsdom'; import fetch from 'node-fetch'; import tinycolor from 'tinycolor2'; import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch.js'; -import { Instance } from '@/models/entities/instance.js'; +import type { Instance } from '@/models/entities/instance.js'; import { Instances } from '@/models/index.js'; import { getFetchInstanceMetadataLock } from '@/misc/app-lock.js'; import Logger from './logger.js'; -import { URL } from 'node:url'; +import type { DOMWindow } from 'jsdom'; const logger = new Logger('metadata', 'cyan'); @@ -198,7 +199,7 @@ async function fetchIconUrl(instance: Instance, doc: DOMWindow['document'] | nul links.find(link => link.relList.contains('apple-touch-icon'))?.href, links.find(link => link.relList.contains('icon'))?.href, ] - .find(href => href); + .find(href => href); if (href) { return (new URL(href, url)).href; @@ -235,7 +236,7 @@ async function getSiteName(info: NodeInfo | null, doc: DOMWindow['document'] | n } if (manifest) { - return manifest?.name || manifest?.short_name; + return manifest.name || manifest.short_name; } return null; @@ -261,7 +262,7 @@ async function getDescription(info: NodeInfo | null, doc: DOMWindow['document'] } if (manifest) { - return manifest?.name || manifest?.short_name; + return manifest.name || manifest.short_name; } return null; diff --git a/packages/client/src/components/MkStarButton.vue b/packages/client/src/components/MkStarButton.vue index 5d4778751..9a0cca414 100644 --- a/packages/client/src/components/MkStarButton.vue +++ b/packages/client/src/components/MkStarButton.vue @@ -1,12 +1,14 @@ @@ -17,6 +19,7 @@ import { pleaseLogin } from '@/scripts/please-login'; import * as os from '@/os'; import { defaultStore } from '@/store'; import { i18n } from '@/i18n'; +import { instance } from '@/instance'; const props = defineProps<{ note: Note; @@ -26,7 +29,7 @@ function star(ev?: MouseEvent): void { pleaseLogin(); os.api('notes/reactions/create', { noteId: props.note.id, - reaction: defaultStore.state.woozyMode === true ? '🥴' : '⭐', + reaction: defaultStore.state.woozyMode === true ? '🥴' : instance.defaultReaction, }); const el = ev && (ev.currentTarget ?? ev.target) as HTMLElement | null | undefined; if (el) { diff --git a/packages/client/src/instance.ts b/packages/client/src/instance.ts index dfa088d11..e9f5122e9 100644 --- a/packages/client/src/instance.ts +++ b/packages/client/src/instance.ts @@ -1,6 +1,6 @@ import { computed, reactive } from 'vue'; -import * as Misskey from 'calckey-js'; import { api } from './os'; +import type * as Misskey from 'calckey-js'; // TODO: 他のタブと永続化されたstateを同期 @@ -14,7 +14,7 @@ export const instance: Misskey.entities.InstanceMetadata = reactive(instanceData export async function fetchInstance() { const meta = await api('meta', { - detail: false + detail: false, }); for (const [k, v] of Object.entries(meta)) { diff --git a/packages/client/src/pages/admin/settings.vue b/packages/client/src/pages/admin/settings.vue index 171590813..83eb12730 100644 --- a/packages/client/src/pages/admin/settings.vue +++ b/packages/client/src/pages/admin/settings.vue @@ -58,6 +58,24 @@ {{ i18n.ts.disablingTimelinesInfo }} + + + + + + + + + + @@ -175,7 +193,7 @@