diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index 2542cce778..46342fd633 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -487,7 +487,7 @@ function applyEnvOverrides(config: Source) { } } - function _step2name(step: string|number): string { + function _step2name(step: string | number): string { return step.toString().replaceAll(/[^a-z0-9]+/gi, '').toUpperCase(); } diff --git a/packages/backend/src/core/DownloadService.ts b/packages/backend/src/core/DownloadService.ts index a1a6914130..26e60e00b3 100644 --- a/packages/backend/src/core/DownloadService.ts +++ b/packages/backend/src/core/DownloadService.ts @@ -34,7 +34,7 @@ export class DownloadService { } @bindThis - public async downloadUrl(url: string, path: string, options: { timeout?: number, operationTimeout?: number, maxSize?: number} = {} ): Promise<{ + public async downloadUrl(url: string, path: string, options: { timeout?: number, operationTimeout?: number, maxSize?: number } = {} ): Promise<{ filename: string; }> { this.logger.info(`Downloading ${chalk.cyan(url)} to ${chalk.cyanBright(path)} ...`); diff --git a/packages/backend/src/core/activitypub/type.ts b/packages/backend/src/core/activitypub/type.ts index e7459a57d2..281733d484 100644 --- a/packages/backend/src/core/activitypub/type.ts +++ b/packages/backend/src/core/activitypub/type.ts @@ -112,7 +112,7 @@ export interface IActivity extends IObject { actor: IObject | string; // ActivityPub spec allows for arrays: https://www.w3.org/TR/activitystreams-vocabulary/#properties // Misskey can only handle one value, so we use a tuple for that case. - object: IObject | string | [IObject | string] ; + object: IObject | string | [IObject | string]; target?: IObject | string; /** LD-Signature */ signature?: { diff --git a/packages/backend/src/misc/is-renote.ts b/packages/backend/src/misc/is-renote.ts index d6872de46a..fcaafaf95a 100644 --- a/packages/backend/src/misc/is-renote.ts +++ b/packages/backend/src/misc/is-renote.ts @@ -77,7 +77,7 @@ type PackedPureRenote = PackedRenote & { replyId: NonNullable['replyId']>; poll: NonNullable['poll']>; fileIds: NonNullable['fileIds']>; -} +}; export function isRenotePacked(note: Packed<'Note'>): note is PackedRenote { return note.renoteId != null; diff --git a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts index ee9819b29f..5e660e8081 100644 --- a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts +++ b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts @@ -83,7 +83,7 @@ export class ImportNotesProcessorService { } @bindThis - private downloadUrl(url: string, path:string): Promise<{filename: string}> { + private downloadUrl(url: string, path:string): Promise<{ filename: string }> { return this.downloadService.downloadUrl(url, path, { operationTimeout: this.config.import?.downloadTimeout, maxSize: this.config.import?.maxFileSize }); } diff --git a/packages/backend/src/queue/types.ts b/packages/backend/src/queue/types.ts index 7d4d609f46..1bd9f7a0ab 100644 --- a/packages/backend/src/queue/types.ts +++ b/packages/backend/src/queue/types.ts @@ -161,4 +161,4 @@ export type ThinUser = { export type ScheduleNotePostJobData = { scheduleNoteId: MiNote['id']; -} +}; diff --git a/packages/backend/src/server/api/endpoints/notes/schedule/list.ts b/packages/backend/src/server/api/endpoints/notes/schedule/list.ts index 4dd3d7a81a..3665348b97 100644 --- a/packages/backend/src/server/api/endpoints/notes/schedule/list.ts +++ b/packages/backend/src/server/api/endpoints/notes/schedule/list.ts @@ -100,7 +100,7 @@ export default class extends Endpoint { // eslint- id: string; note: { text?: string; - cw?: string|null; + cw?: string | null; fileIds: string[]; visibility: typeof noteVisibilities[number]; visibleUsers: Packed<'UserLite'>[]; diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index b289ad7135..59ab3b71aa 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -192,7 +192,7 @@ export class MastodonApiServerService { reply.send(response); }); - fastify.post<{ Body: { description?: string; focus?: string }}>('/v2/media', { preHandler: upload.single('file') }, async (_request, reply) => { + fastify.post<{ Body: { description?: string; focus?: string } }>('/v2/media', { preHandler: upload.single('file') }, async (_request, reply) => { const multipartData = await _request.file(); if (!multipartData) { reply.code(401).send({ error: 'No image' }); @@ -284,7 +284,7 @@ export class MastodonApiServerService { reply.send(response); }); - fastify.get<{ Querystring: { limit?: string }}>('/v1/follow_requests', async (_request, reply) => { + fastify.get<{ Querystring: { limit?: string } }>('/v1/follow_requests', async (_request, reply) => { const client = this.clientService.getClient(_request); const limit = _request.query.limit ? parseInt(_request.query.limit) : 20; diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index efb26ca53e..8bc3c14c15 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -142,7 +142,7 @@ export class ApiAccountMastodon { reply.send(response); }); - fastify.get<{ Querystring: { acct?: string }}>('/v1/accounts/lookup', async (_request, reply) => { + fastify.get<{ Querystring: { acct?: string } }>('/v1/accounts/lookup', async (_request, reply) => { if (!_request.query.acct) return reply.code(400).send({ error: 'BAD_REQUEST', error_description: 'Missing required property "acct"' }); const client = this.clientService.getClient(_request); @@ -154,7 +154,7 @@ export class ApiAccountMastodon { reply.send(response); }); - fastify.get('/v1/accounts/relationships', async (_request, reply) => { + fastify.get('/v1/accounts/relationships', async (_request, reply) => { if (!_request.query.id) return reply.code(400).send({ error: 'BAD_REQUEST', error_description: 'Missing required property "id"' }); const client = this.clientService.getClient(_request); diff --git a/packages/backend/test/e2e/streaming.ts b/packages/backend/test/e2e/streaming.ts index 72f26a38e0..af905b4c91 100644 --- a/packages/backend/test/e2e/streaming.ts +++ b/packages/backend/test/e2e/streaming.ts @@ -148,7 +148,7 @@ describe('Streaming', () => { test('フォローしているユーザーの投稿が流れる', async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { text: 'foo' }, kyoko), // kyoko posts msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); @@ -158,7 +158,7 @@ describe('Streaming', () => { test('フォローしているユーザーの visibility: followers な投稿が流れる', async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko), // kyoko posts msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); @@ -170,7 +170,7 @@ describe('Streaming', () => { const note = await post(kyoko, { text: 'foo', visibility: 'followers' }); const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { text: 'bar', visibility: 'followers', replyId: note.id }, kyoko), // kyoko posts msg => msg.type === 'note' && msg.body.userId === kyoko.id && msg.body.reply.text === 'foo', ); @@ -182,7 +182,7 @@ describe('Streaming', () => { const chitoseNote = await post(chitose, { text: 'followers-only post', visibility: 'followers' }); const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { text: 'reply to chitose\'s followers-only post', replyId: chitoseNote.id }, kyoko), // kyoko's reply to chitose's followers-only post msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); @@ -195,7 +195,7 @@ describe('Streaming', () => { const kyokoReply = await post(kyoko, { text: 'reply to followers-only post', replyId: chitoseNote.id }); const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { renoteId: kyokoReply.id }, kyoko), // kyoko's renote of kyoko's reply to chitose's followers-only post msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); @@ -205,7 +205,7 @@ describe('Streaming', () => { test('フォローしていないユーザーの投稿は流れない', async () => { const fired = await waitFire( - kyoko, 'homeTimeline', // kyoko:home + kyoko, 'homeTimeline', // kyoko:home () => api('notes/create', { text: 'foo' }, ayano), // ayano posts msg => msg.type === 'note' && msg.body.userId === ayano.id, // wait ayano ); @@ -215,7 +215,7 @@ describe('Streaming', () => { test('フォローしているユーザーのダイレクト投稿が流れる', async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko dm => ayano msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); @@ -225,7 +225,7 @@ describe('Streaming', () => { test('フォローしているユーザーでも自分が指定されていないダイレクト投稿は流れない', async () => { const fired = await waitFire( - ayano, 'homeTimeline', // ayano:home + ayano, 'homeTimeline', // ayano:home () => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id] }, kyoko), // kyoko dm => chitose msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); @@ -574,7 +574,7 @@ describe('Streaming', () => { test('withReplies = falseでフォローしてる人によるリプライが流れてくる', async () => { const fired = await waitFire( - ayano, 'globalTimeline', // ayano:Global + ayano, 'globalTimeline', // ayano:Global () => api('notes/create', { text: 'foo', replyId: kanakoNote.id }, kyoko), // kyoko posts msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko ); diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index ed1dadd181..4b3ec856f1 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -312,7 +312,9 @@ describe('ユーザー', () => { assert.strictEqual(response.name, null); assert.strictEqual(response.username, 'zoe'); assert.strictEqual(response.host, null); - response.avatarUrl && assert.match(response.avatarUrl, /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/); + if (response.avatarUrl) { + assert.match(response.avatarUrl, /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/); + } assert.strictEqual(response.avatarBlurhash, null); assert.deepStrictEqual(response.avatarDecorations, []); assert.strictEqual(response.isBot, false); diff --git a/packages/backend/test/unit/SigninWithPasskeyApiService.ts b/packages/backend/test/unit/SigninWithPasskeyApiService.ts index efed905e02..2b7afb02f9 100644 --- a/packages/backend/test/unit/SigninWithPasskeyApiService.ts +++ b/packages/backend/test/unit/SigninWithPasskeyApiService.ts @@ -54,7 +54,7 @@ class DummyFastifyReply { } class DummyFastifyRequest { public ip: string; - public body: {credential: any, context: string}; + public body: { credential: any, context: string }; public headers: IncomingHttpHeaders = { 'accept': 'application/json' }; constructor(body?: any) { this.ip = '0.0.0.0'; diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 8306208477..7b69cb04f4 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -661,7 +661,9 @@ export async function captureWebhook(postAction: () => let timeoutHandle: NodeJS.Timeout | null = null; const result = await new Promise(async (resolve, reject) => { fastify.all('/', async (req, res) => { - timeoutHandle && clearTimeout(timeoutHandle); + if (timeoutHandle) { + clearTimeout(timeoutHandle); + } const body = JSON.stringify(req.body); res.status(200).send('ok');