diff --git a/packages/backend/src/server/api/stream/channels/admin.ts b/packages/backend/src/server/api/stream/channels/admin.ts index b8f369ce84..a37ecd1754 100644 --- a/packages/backend/src/server/api/stream/channels/admin.ts +++ b/packages/backend/src/server/api/stream/channels/admin.ts @@ -9,9 +9,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class AdminChannel extends Channel { public readonly chName = 'admin'; - public static shouldShare = true; - public static requireCredential = true as const; - public static kind = 'read:admin:stream'; + public static readonly shouldShare = true; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:admin:stream'; @bindThis public async init(params: any) { diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts index a20e74bfb2..ec76acd8b5 100644 --- a/packages/backend/src/server/api/stream/channels/antenna.ts +++ b/packages/backend/src/server/api/stream/channels/antenna.ts @@ -12,9 +12,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class AntennaChannel extends Channel { public readonly chName = 'antenna'; - public static shouldShare = false; - public static requireCredential = true as const; - public static kind = 'read:account'; + public static readonly shouldShare = false; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:account'; private antennaId: string; constructor( diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 9d6feb0d1e..16e9cd80e2 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -12,8 +12,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class ChannelChannel extends Channel { public readonly chName = 'channel'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private channelId: string; constructor( diff --git a/packages/backend/src/server/api/stream/channels/drive.ts b/packages/backend/src/server/api/stream/channels/drive.ts index 4bf34a72c9..a1ca097a79 100644 --- a/packages/backend/src/server/api/stream/channels/drive.ts +++ b/packages/backend/src/server/api/stream/channels/drive.ts @@ -9,9 +9,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class DriveChannel extends Channel { public readonly chName = 'drive'; - public static shouldShare = true; - public static requireCredential = true as const; - public static kind = 'read:account'; + public static readonly shouldShare = true; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:account'; @bindThis public async init(params: any) { diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index fb43be412a..8de4abcf1f 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -16,8 +16,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class GlobalTimelineChannel extends Channel { public readonly chName = 'globalTimeline'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private withRenotes: boolean; private withFiles: boolean; diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts index 8fdb9c7808..d1a083f3a9 100644 --- a/packages/backend/src/server/api/stream/channels/hashtag.ts +++ b/packages/backend/src/server/api/stream/channels/hashtag.ts @@ -13,8 +13,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class HashtagChannel extends Channel { public readonly chName = 'hashtag'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private q: string[][]; constructor( diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index e489a30665..116821420d 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -14,9 +14,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class HomeTimelineChannel extends Channel { public readonly chName = 'homeTimeline'; - public static shouldShare = false; - public static requireCredential = true as const; - public static kind = 'read:account'; + public static readonly shouldShare = false; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:account'; private withRenotes: boolean; private withFiles: boolean; diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 7229297231..c6a03ff3c5 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -16,9 +16,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class HybridTimelineChannel extends Channel { public readonly chName = 'hybridTimeline'; - public static shouldShare = false; - public static requireCredential = true as const; - public static kind = 'read:account'; + public static readonly shouldShare = false; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:account'; private withRenotes: boolean; private withReplies: boolean; private withFiles: boolean; diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 6400ff5fc9..8abb3834a2 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -15,8 +15,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class LocalTimelineChannel extends Channel { public readonly chName = 'localTimeline'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private withRenotes: boolean; private withReplies: boolean; private withFiles: boolean; diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts index ab605e3ec5..393f3db140 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -11,9 +11,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class MainChannel extends Channel { public readonly chName = 'main'; - public static shouldShare = true; - public static requireCredential = true as const; - public static kind = 'read:account'; + public static readonly shouldShare = true; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:account'; constructor( private noteEntityService: NoteEntityService, diff --git a/packages/backend/src/server/api/stream/channels/queue-stats.ts b/packages/backend/src/server/api/stream/channels/queue-stats.ts index 5ceb2c3bbc..d6e4bfc2d8 100644 --- a/packages/backend/src/server/api/stream/channels/queue-stats.ts +++ b/packages/backend/src/server/api/stream/channels/queue-stats.ts @@ -12,8 +12,8 @@ const ev = new Xev(); class QueueStatsChannel extends Channel { public readonly chName = 'queueStats'; - public static shouldShare = true; - public static requireCredential = false as const; + public static readonly shouldShare = true; + public static readonly requireCredential = false as const; constructor(id: string, connection: Channel['connection']) { super(id, connection); diff --git a/packages/backend/src/server/api/stream/channels/reversi-game.ts b/packages/backend/src/server/api/stream/channels/reversi-game.ts index fb24a29b75..3a86197c86 100644 --- a/packages/backend/src/server/api/stream/channels/reversi-game.ts +++ b/packages/backend/src/server/api/stream/channels/reversi-game.ts @@ -13,8 +13,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class ReversiGameChannel extends Channel { public readonly chName = 'reversiGame'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private gameId: MiReversiGame['id'] | null = null; constructor( diff --git a/packages/backend/src/server/api/stream/channels/reversi.ts b/packages/backend/src/server/api/stream/channels/reversi.ts index 4ea9784ba5..103c6f12ef 100644 --- a/packages/backend/src/server/api/stream/channels/reversi.ts +++ b/packages/backend/src/server/api/stream/channels/reversi.ts @@ -9,9 +9,9 @@ import Channel, { type MiChannelService } from '../channel.js'; class ReversiChannel extends Channel { public readonly chName = 'reversi'; - public static shouldShare = true; - public static requireCredential = true as const; - public static kind = 'read:account'; + public static readonly shouldShare = true; + public static readonly requireCredential = true as const; + public static readonly kind = 'read:account'; @bindThis public async init(params: any) { diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts index be762c5a3f..143c8c0592 100644 --- a/packages/backend/src/server/api/stream/channels/role-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts @@ -14,8 +14,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class RoleTimelineChannel extends Channel { public readonly chName = 'roleTimeline'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private roleId: string; constructor( diff --git a/packages/backend/src/server/api/stream/channels/server-stats.ts b/packages/backend/src/server/api/stream/channels/server-stats.ts index 615b6946cc..e0422ef018 100644 --- a/packages/backend/src/server/api/stream/channels/server-stats.ts +++ b/packages/backend/src/server/api/stream/channels/server-stats.ts @@ -12,8 +12,8 @@ const ev = new Xev(); class ServerStatsChannel extends Channel { public readonly chName = 'serverStats'; - public static shouldShare = true; - public static requireCredential = false as const; + public static readonly shouldShare = true; + public static readonly requireCredential = false as const; constructor(id: string, connection: Channel['connection']) { super(id, connection); diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index d59ef5500c..d41e1abac6 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -15,8 +15,8 @@ import Channel, { type MiChannelService } from '../channel.js'; class UserListChannel extends Channel { public readonly chName = 'userList'; - public static shouldShare = false; - public static requireCredential = false as const; + public static readonly shouldShare = false; + public static readonly requireCredential = false as const; private listId: string; private membershipsMap: Record | undefined> = {}; private listUsersClock: NodeJS.Timeout; diff --git a/packages/frontend/src/components/MkContextMenu.vue b/packages/frontend/src/components/MkContextMenu.vue index d330d66b28..d887ae2bbe 100644 --- a/packages/frontend/src/components/MkContextMenu.vue +++ b/packages/frontend/src/components/MkContextMenu.vue @@ -47,12 +47,12 @@ onMounted(() => { const width = rootEl.value!.offsetWidth; const height = rootEl.value!.offsetHeight; - if (left + width - window.pageXOffset >= (window.innerWidth - SCROLLBAR_THICKNESS)) { - left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.pageXOffset; + if (left + width - window.scrollX >= (window.innerWidth - SCROLLBAR_THICKNESS)) { + left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.scrollX; } - if (top + height - window.pageYOffset >= (window.innerHeight - SCROLLBAR_THICKNESS)) { - top = (window.innerHeight - SCROLLBAR_THICKNESS) - height + window.pageYOffset; + if (top + height - window.scrollY >= (window.innerHeight - SCROLLBAR_THICKNESS)) { + top = (window.innerHeight - SCROLLBAR_THICKNESS) - height + window.scrollY; } if (top < 0) { diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 39d071de87..8b8f38a84f 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -212,14 +212,15 @@ const note = ref(deepClone(props.note)); // plugin if (noteViewInterruptors.length > 0) { onMounted(async () => { - let result: Misskey.entities.Note | null = deepClone(note.value); + let result = deepClone(note.value); for (const interruptor of noteViewInterruptors) { try { - result = await interruptor.handler(result!) as Misskey.entities.Note | null; - if (result === null) { + const r = await interruptor.handler(result) as Misskey.entities.Note | null; + if (r === null) { isDeleted.value = true; return; } + result = r; } catch (err) { console.error(err); } diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index dd956b21ad..b5da6be632 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -240,14 +240,15 @@ const note = ref(deepClone(props.note)); // plugin if (noteViewInterruptors.length > 0) { onMounted(async () => { - let result: Misskey.entities.Note | null = deepClone(note.value); + let result = deepClone(note.value); for (const interruptor of noteViewInterruptors) { try { - result = await interruptor.handler(result!) as Misskey.entities.Note | null; - if (result === null) { + const r = await interruptor.handler(result) as Misskey.entities.Note | null; + if (r === null) { isDeleted.value = true; return; } + result = r; } catch (err) { console.error(err); } diff --git a/packages/frontend/src/components/MkPollEditor.vue b/packages/frontend/src/components/MkPollEditor.vue index 50a66c8437..2e2a5e9ff5 100644 --- a/packages/frontend/src/components/MkPollEditor.vue +++ b/packages/frontend/src/components/MkPollEditor.vue @@ -72,9 +72,7 @@ export type PollEditorModelValue = { const props = defineProps<{ modelValue: PollEditorModelValue; }>(); -const emit = defineEmits<{ - (ev: 'update:modelValue', v: PollEditorModelValue): void; -}>(); +const emit = defineEmits<(ev: 'update:modelValue', v: PollEditorModelValue) => void>(); const choices = ref(props.modelValue.choices); const multiple = ref(props.modelValue.multiple); diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index f8f458b3c4..a76408189a 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -352,7 +352,7 @@ if (props.specified) { } // keep cw when reply -if (defaultStore.state.keepCw && props.reply && props.reply.cw) { +if (defaultStore.state.keepCw && props.reply?.cw) { useCw.value = true; cw.value = props.reply.cw; } @@ -603,7 +603,7 @@ async function onPaste(ev: ClipboardEvent) { return; } - quoteId.value = paste.substring(url.length).match(/^\/notes\/(.+?)\/?$/)?.[1] ?? null; + quoteId.value = RegExp(/^\/notes\/(.+?)\/?$/).exec(paste.substring(url.length))?.[1] ?? null; }); } } diff --git a/packages/frontend/src/components/MkPushNotificationAllowButton.vue b/packages/frontend/src/components/MkPushNotificationAllowButton.vue index de9f752c34..c91aa225ff 100644 --- a/packages/frontend/src/components/MkPushNotificationAllowButton.vue +++ b/packages/frontend/src/components/MkPushNotificationAllowButton.vue @@ -156,7 +156,7 @@ if (navigator.serviceWorker == null) { pushSubscription.value = await registration.value.pushManager.getSubscription(); - if (instance.swPublickey && ('PushManager' in window) && $i && $i.token) { + if (instance.swPublickey && ('PushManager' in window) && $i?.token) { supported.value = true; if (pushSubscription.value) { diff --git a/packages/frontend/src/components/MkSignin.vue b/packages/frontend/src/components/MkSignin.vue index 79dd8d87d5..597f82c414 100644 --- a/packages/frontend/src/components/MkSignin.vue +++ b/packages/frontend/src/components/MkSignin.vue @@ -142,7 +142,7 @@ async function queryKey(): Promise { function onSubmit(): void { signing.value = true; - if (!totpLogin.value && user.value && user.value.twoFactorEnabled) { + if (!totpLogin.value && user.value?.twoFactorEnabled) { if (webAuthnSupported() && user.value.securityKeys) { misskeyApi('signin', { username: username.value, diff --git a/packages/frontend/src/components/MkUserSelectDialog.vue b/packages/frontend/src/components/MkUserSelectDialog.vue index 1846361108..4ca2ba4e21 100644 --- a/packages/frontend/src/components/MkUserSelectDialog.vue +++ b/packages/frontend/src/components/MkUserSelectDialog.vue @@ -70,7 +70,7 @@ import { misskeyApi } from '@/scripts/misskey-api.js'; import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import { $i } from '@/account.js'; -import { host as currentHost, hostname } from '@/config.js'; +import { hostname } from '@/config.js'; const emit = defineEmits<{ (ev: 'ok', selected: Misskey.entities.UserDetailed): void; @@ -138,8 +138,8 @@ onMounted(() => { return true; } }); - if (props.includeSelf && _users.find(x => $i ? x.id === $i.id : true) == null) { - recentUsers.value = [$i!, ..._users]; + if (props.includeSelf && $i && !_users.find(x => $i ? x.id === $i.id : true)) { + recentUsers.value = [$i, ..._users]; } else { recentUsers.value = _users; } diff --git a/packages/frontend/src/components/MkVisitorDashboard.ActiveUsersChart.vue b/packages/frontend/src/components/MkVisitorDashboard.ActiveUsersChart.vue index 46d75da839..a4e3d1ffa9 100644 --- a/packages/frontend/src/components/MkVisitorDashboard.ActiveUsersChart.vue +++ b/packages/frontend/src/components/MkVisitorDashboard.ActiveUsersChart.vue @@ -15,7 +15,6 @@ SPDX-License-Identifier: AGPL-3.0-only