diff --git a/locales/en-US.yml b/locales/en-US.yml index 80e45c42d..e22b92e2f 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -688,6 +688,7 @@ channel: "Channels" create: "Create" notificationSetting: "Notification settings" notificationSettingDesc: "Select the types of notification to display." +enableFaviconNotificationDot: "Enable favicon notification dot" useGlobalSetting: "Use global settings" useGlobalSettingDesc: "If turned on, your account's notification settings will be used. If turned off, individual configurations can be made." other: "Other" diff --git a/locales/index.d.ts b/locales/index.d.ts index e407d2119..422f1c842 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -2764,6 +2764,10 @@ export interface Locale extends ILocale { * 表示する通知の種別を選択してください。 */ "notificationSettingDesc": string; + /** + * ファビコン通知ドットを有効にする + */ + "enableFaviconNotificationDot": string; /** * グローバル設定を使う */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 57f52c64b..e20907e6b 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -687,6 +687,7 @@ channel: "チャンネル" create: "作成" notificationSetting: "通知設定" notificationSettingDesc: "表示する通知の種別を選択してください。" +enableFaviconNotificationDot: "ファビコン通知ドットを有効にする" useGlobalSetting: "グローバル設定を使う" useGlobalSettingDesc: "オンにすると、アカウントの通知設定が使用されます。オフにすると、個別に設定できるようになります。" other: "その他" diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 1e4e815d5..b216622c3 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -180,6 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
+ {{ i18n.ts.enableFaviconNotificationDot }} {{ i18n.ts.warnForMissingAltText }} {{ i18n.ts.openImageInNewTab }} {{ i18n.ts.useReactionPickerForContextMenu }} @@ -337,6 +338,7 @@ const oneko = computed(defaultStore.makeGetterSetter('oneko')); const loadRawImages = computed(defaultStore.makeGetterSetter('loadRawImages')); const highlightSensitiveMedia = computed(defaultStore.makeGetterSetter('highlightSensitiveMedia')); const imageNewTab = computed(defaultStore.makeGetterSetter('imageNewTab')); +const enableFaviconNotificationDot = computed(defaultStore.makeGetterSetter('enableFaviconNotificationDot')); const warnMissingAltText = computed(defaultStore.makeGetterSetter('warnMissingAltText')); const nsfw = computed(defaultStore.makeGetterSetter('nsfw')); const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm')); diff --git a/packages/frontend/src/pages/settings/preferences-backups.vue b/packages/frontend/src/pages/settings/preferences-backups.vue index f180e0b72..86b8debe3 100644 --- a/packages/frontend/src/pages/settings/preferences-backups.vue +++ b/packages/frontend/src/pages/settings/preferences-backups.vue @@ -72,6 +72,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [ 'advancedMfm', 'loadRawImages', 'warnMissingAltText', + 'enableFaviconNotificationDot', 'imageNewTab', 'dataSaver', 'disableShowingAnimatedImages', diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 2cf17b27c..7f6377613 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -268,6 +268,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: true, }, + enableFaviconNotificationDot: { + where: 'device', + default: true, + }, imageNewTab: { where: 'device', default: false, diff --git a/packages/frontend/src/ui/_common_/common.vue b/packages/frontend/src/ui/_common_/common.vue index 70097d89a..77148835f 100644 --- a/packages/frontend/src/ui/_common_/common.vue +++ b/packages/frontend/src/ui/_common_/common.vue @@ -80,8 +80,6 @@ class NotificationFavIconDot { constructor() { this.canvas = document.createElement('canvas'); - if (this.faviconEL == null) return; - this.src = this.faviconEL.getAttribute('href'); this.ctx = this.canvas.getContext('2d'); @@ -162,11 +160,11 @@ function onNotification(notification: Misskey.entities.Notification, isClient = if ($i) { const connection = useStream().useChannel('main', null, 'UI'); connection.on('notification', onNotification); - - watch(() => $i?.hasUnreadNotification, (hasAny) => notificationDot.setVisible(hasAny ?? false)); - - if ($i.hasUnreadNotification) notificationDot.setVisible(true); + watch(() => $i?.hasUnreadNotification, (hasAny) => notificationDot.setVisible((defaultStore.state.enableFaviconNotificationDot ? hasAny : false) ?? false)); + + if ($i.hasUnreadNotification && defaultStore.state.enableFaviconNotificationDot) notificationDot.setVisible(true); + globalEvents.on('clientNotification', notification => onNotification(notification, true)); //#region Listen message from SW