diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-12-09 23:58:30 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-12-09 23:58:30 +0900 |
| commit | c69b72e1999578cba15e34677ebd366482cba734 (patch) | |
| tree | 624ac6500e36e3a7024a5ea19ae891ef86781d04 /packages/backend/src/server/api | |
| parent | Update instance-mute.vue (diff) | |
| download | sharkey-c69b72e1999578cba15e34677ebd366482cba734.tar.gz sharkey-c69b72e1999578cba15e34677ebd366482cba734.tar.bz2 sharkey-c69b72e1999578cba15e34677ebd366482cba734.zip | |
fix lint
Diffstat (limited to 'packages/backend/src/server/api')
328 files changed, 1968 insertions, 1968 deletions
diff --git a/packages/backend/src/server/api/2fa.ts b/packages/backend/src/server/api/2fa.ts index 2c8c842a11..2a69e49c83 100644 --- a/packages/backend/src/server/api/2fa.ts +++ b/packages/backend/src/server/api/2fa.ts @@ -112,7 +112,7 @@ export function verifyLogin({ clientDataJSON, clientData, signature, - challenge + challenge, }: { publicKey: Buffer, authenticatorData: Buffer, diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index cbace8917e..faa35d12d4 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -19,8 +19,8 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { code: y!.code, id: y!.id, kind: y!.kind, - ...(y!.info ? { info: y!.info } : {}) - } + ...(y!.info ? { info: y!.info } : {}), + }, }; } else { // 文字列を返す場合は、JSON.stringify通さないとJSONと認識されない @@ -42,7 +42,7 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { reply(403, new ApiError({ message: 'Authentication failed. Please ensure your token is correct.', code: 'AUTHENTICATION_FAILED', - id: 'b0a7f5f8-dc2f-4171-b91f-de88ad238e14' + id: 'b0a7f5f8-dc2f-4171-b91f-de88ad238e14', })); } else { reply(500, new ApiError()); diff --git a/packages/backend/src/server/api/authenticate.ts b/packages/backend/src/server/api/authenticate.ts index b8e216edc4..d33e9e3753 100644 --- a/packages/backend/src/server/api/authenticate.ts +++ b/packages/backend/src/server/api/authenticate.ts @@ -28,9 +28,9 @@ export default async (token: string): Promise<[User | null | undefined, App | nu } else { const accessToken = await AccessTokens.findOne({ where: [{ - hash: token.toLowerCase() // app + hash: token.toLowerCase(), // app }, { - token: token // miauth + token: token, // miauth }], }); @@ -44,7 +44,7 @@ export default async (token: string): Promise<[User | null | undefined, App | nu const user = await Users .findOne({ - id: accessToken.userId // findOne(accessToken.userId) のように書かないのは後方互換性のため + id: accessToken.userId, // findOne(accessToken.userId) のように書かないのは後方互換性のため }); if (accessToken.appId) { @@ -53,7 +53,7 @@ export default async (token: string): Promise<[User | null | undefined, App | nu return [user, { id: accessToken.id, - permission: app.permission + permission: app.permission, } as AccessToken]; } else { return [user, accessToken]; diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index bd86ffdc35..36aadb532b 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -9,7 +9,7 @@ import { AccessToken } from '@/models/entities/access-token'; const accessDenied = { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '56f35758-7dd5-468b-8439-5d6fb8ec9b8e' + id: '56f35758-7dd5-468b-8439-5d6fb8ec9b8e', }; export default async (endpoint: string, user: User | null | undefined, token: AccessToken | null | undefined, data: any, file?: any) => { @@ -22,7 +22,7 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac message: 'No such endpoint.', code: 'NO_SUCH_ENDPOINT', id: 'f8080b67-5f9c-4eb7-8c18-7f1eeae8f709', - httpStatusCode: 404 + httpStatusCode: 404, }); } @@ -35,7 +35,7 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac message: 'Credential required.', code: 'CREDENTIAL_REQUIRED', id: '1384574d-a912-4b81-8601-c7b1c4085df1', - httpStatusCode: 401 + httpStatusCode: 401, }); } @@ -44,7 +44,7 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac message: 'Your account has been suspended.', code: 'YOUR_ACCOUNT_SUSPENDED', id: 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370', - httpStatusCode: 403 + httpStatusCode: 403, }); } @@ -71,7 +71,7 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac message: 'Rate limit exceeded. Please try again later.', code: 'RATE_LIMIT_EXCEEDED', id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef', - httpStatusCode: 429 + httpStatusCode: 429, }); }); } @@ -88,15 +88,15 @@ export default async (endpoint: string, user: User | null | undefined, token: Ac e: { message: e?.message, code: e?.name, - stack: e?.stack - } + stack: e?.stack, + }, }); throw new ApiError(null, { e: { message: e?.message, code: e?.name, - stack: e?.stack - } + stack: e?.stack, + }, }); } }).finally(() => { diff --git a/packages/backend/src/server/api/common/inject-promo.ts b/packages/backend/src/server/api/common/inject-promo.ts index 87767a65bf..06a3841995 100644 --- a/packages/backend/src/server/api/common/inject-promo.ts +++ b/packages/backend/src/server/api/common/inject-promo.ts @@ -9,7 +9,7 @@ export async function injectPromo(timeline: Note[], user?: User | null) { // TODO: readやexpireフィルタはクエリ側でやる const reads = user ? await PromoReads.find({ - userId: user.id + userId: user.id, }) : []; let promos = await PromoNotes.find(); diff --git a/packages/backend/src/server/api/common/read-messaging-message.ts b/packages/backend/src/server/api/common/read-messaging-message.ts index 33f41b2770..928333e59c 100644 --- a/packages/backend/src/server/api/common/read-messaging-message.ts +++ b/packages/backend/src/server/api/common/read-messaging-message.ts @@ -24,7 +24,7 @@ export async function readUserMessagingMessage( if (messageIds.length === 0) return; const messages = await MessagingMessages.find({ - id: In(messageIds) + id: In(messageIds), }); for (const message of messages) { @@ -38,9 +38,9 @@ export async function readUserMessagingMessage( id: In(messageIds), userId: otherpartyId, recipientId: userId, - isRead: false + isRead: false, }, { - isRead: true + isRead: true, }); // Publish event @@ -66,7 +66,7 @@ export async function readGroupMessagingMessage( // check joined const joining = await UserGroupJoinings.findOne({ userId: userId, - userGroupId: groupId + userGroupId: groupId, }); if (joining == null) { @@ -74,7 +74,7 @@ export async function readGroupMessagingMessage( } const messages = await MessagingMessages.find({ - id: In(messageIds) + id: In(messageIds), }); const reads: MessagingMessage['id'][] = []; @@ -86,7 +86,7 @@ export async function readGroupMessagingMessage( // Update document await MessagingMessages.createQueryBuilder().update() .set({ - reads: (() => `array_append("reads", '${joining.userId}')`) as any + reads: (() => `array_append("reads", '${joining.userId}')`) as any, }) .where('id = :id', { id: message.id }) .execute(); @@ -97,7 +97,7 @@ export async function readGroupMessagingMessage( // Publish event publishGroupMessagingStream(groupId, 'read', { ids: reads, - userId: userId + userId: userId, }); publishMessagingIndexStream(userId, 'read', reads); diff --git a/packages/backend/src/server/api/common/read-notification.ts b/packages/backend/src/server/api/common/read-notification.ts index a4406c9eeb..049a7feed6 100644 --- a/packages/backend/src/server/api/common/read-notification.ts +++ b/packages/backend/src/server/api/common/read-notification.ts @@ -11,9 +11,9 @@ export async function readNotification( // Update documents await Notifications.update({ id: In(notificationIds), - isRead: false + isRead: false, }, { - isRead: true + isRead: true, }); post(userId); @@ -27,9 +27,9 @@ export async function readNotificationByQuery( await Notifications.update({ ...query, notifieeId: userId, - isRead: false + isRead: false, }, { - isRead: true + isRead: true, }); post(userId); diff --git a/packages/backend/src/server/api/common/signin.ts b/packages/backend/src/server/api/common/signin.ts index 4c7aacf1cd..b713260ac6 100644 --- a/packages/backend/src/server/api/common/signin.ts +++ b/packages/backend/src/server/api/common/signin.ts @@ -14,7 +14,7 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { // SEE: https://github.com/koajs/koa/issues/974 // When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header secure: config.url.startsWith('https'), - httpOnly: false + httpOnly: false, }); //#endregion @@ -22,7 +22,7 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { } else { ctx.body = { id: user.id, - i: user.token + i: user.token, }; ctx.status = 200; } @@ -35,7 +35,7 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { userId: user.id, ip: ctx.ip, headers: ctx.headers, - success: true + success: true, }); // Publish signin event diff --git a/packages/backend/src/server/api/common/signup.ts b/packages/backend/src/server/api/common/signup.ts index 2ba0d8e479..f8db7e374e 100644 --- a/packages/backend/src/server/api/common/signup.ts +++ b/packages/backend/src/server/api/common/signup.ts @@ -54,14 +54,14 @@ export async function signup(opts: { modulusLength: 4096, publicKeyEncoding: { type: 'spki', - format: 'pem' + format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: undefined, - passphrase: undefined - } + passphrase: undefined, + }, } as any, (err, publicKey, privateKey) => err ? rej(err) : res([publicKey, privateKey]) )); @@ -72,7 +72,7 @@ export async function signup(opts: { await getConnection().transaction(async transactionalEntityManager => { const exist = await transactionalEntityManager.findOne(User, { usernameLower: username.toLowerCase(), - host: null + host: null, }); if (exist) throw new Error(' the username is already used'); @@ -92,7 +92,7 @@ export async function signup(opts: { await transactionalEntityManager.save(new UserKeypair({ publicKey: keyPair[0], privateKey: keyPair[1], - userId: account.id + userId: account.id, })); await transactionalEntityManager.save(new UserProfile({ diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 48253e78e0..71e5fadde0 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -70,7 +70,7 @@ function getParams<T extends IEndpointMeta>(defs: T, params: any): [Params<T>, A id: '3d81ceae-475f-4600-b2a8-2bc116157532', }, { param: k, - reason: e.message + reason: e.message, }); return true; } else { diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 6d9d2b0782..a61b3f564c 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -108,7 +108,7 @@ export interface IEndpoint { } const files = glob.sync('**/*.js', { - cwd: path.resolve(_dirname + '/endpoints/') + cwd: path.resolve(_dirname + '/endpoints/'), }); const endpoints: IEndpoint[] = files.map(f => { @@ -117,7 +117,7 @@ const endpoints: IEndpoint[] = files.map(f => { return { name: f.replace('.js', ''), exec: ep.default, - meta: ep.meta || {} + meta: ep.meta || {}, }; }); diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index 403eb24191..774506bf0d 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -13,7 +13,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -35,7 +35,7 @@ export const meta = { 'local', 'remote', ]), - default: 'combined' + default: 'combined', }, targetUserOrigin: { @@ -44,7 +44,7 @@ export const meta = { 'local', 'remote', ]), - default: 'combined' + default: 'combined', }, }, @@ -73,7 +73,7 @@ export const meta = { resolved: { type: 'boolean' as const, nullable: false as const, optional: false as const, - example: false + example: false, }, reporterId: { type: 'string' as const, @@ -93,21 +93,21 @@ export const meta = { reporter: { type: 'object' as const, nullable: false as const, optional: false as const, - ref: 'User' + ref: 'User', }, targetUser: { type: 'object' as const, nullable: false as const, optional: false as const, - ref: 'User' + ref: 'User', }, assignee: { type: 'object' as const, nullable: true as const, optional: true as const, - ref: 'User' - } - } - } - } + ref: 'User', + }, + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index fa15e84f77..b1cdb29a56 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -12,7 +12,7 @@ export const meta = { password: { validator: Users.validatePassword, - } + }, }, res: { @@ -23,9 +23,9 @@ export const meta = { token: { type: 'string' as const, optional: false as const, nullable: false as const, - } - } - } + }, + }, + }, }; export default define(meta, async (ps, _me) => { @@ -42,7 +42,7 @@ export default define(meta, async (ps, _me) => { const res = await Users.pack(account, account, { detail: true, - includeSecrets: true + includeSecrets: true, }); (res as any).token = secret; diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index 4e8a559805..3881e02bba 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -16,7 +16,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { @@ -39,11 +39,11 @@ export default define(meta, async (ps, me) => { await doPostSuspend(user).catch(e => {}); createDeleteAccountJob(user, { - soft: false + soft: false, }); } else { createDeleteAccountJob(user, { - soft: true // リモートユーザーの削除は、完全にDBから物理削除してしまうと再度連合してきてアカウントが復活する可能性があるため、soft指定する + soft: true, // リモートユーザーの削除は、完全にDBから物理削除してしまうと再度連合してきてアカウントが復活する可能性があるため、soft指定する }); } diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index 27c7b5d318..e41d015646 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -11,26 +11,26 @@ export const meta = { params: { url: { - validator: $.str.min(1) + validator: $.str.min(1), }, memo: { - validator: $.str + validator: $.str, }, place: { - validator: $.str + validator: $.str, }, priority: { - validator: $.str + validator: $.str, }, ratio: { - validator: $.num.int().min(0) + validator: $.num.int().min(0), }, expiresAt: { - validator: $.num.int() + validator: $.num.int(), }, imageUrl: { - validator: $.str.min(1) - } + validator: $.str.min(1), + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts index 91934e1aab..ab5cd96d0f 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts @@ -12,17 +12,17 @@ export const meta = { params: { id: { - validator: $.type(ID) - } + validator: $.type(ID), + }, }, errors: { noSuchAd: { message: 'No such ad.', code: 'NO_SUCH_AD', - id: 'ccac9863-3a03-416e-b899-8a64041118b1' - } - } + id: 'ccac9863-3a03-416e-b899-8a64041118b1', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 000aaaba9d..f22dd0e961 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -13,7 +13,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index 36c87895c2..1d91cfd162 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -12,28 +12,28 @@ export const meta = { params: { id: { - validator: $.type(ID) + validator: $.type(ID), }, memo: { - validator: $.str + validator: $.str, }, url: { - validator: $.str.min(1) + validator: $.str.min(1), }, imageUrl: { - validator: $.str.min(1) + validator: $.str.min(1), }, place: { - validator: $.str + validator: $.str, }, priority: { - validator: $.str + validator: $.str, }, ratio: { - validator: $.num.int().min(0) + validator: $.num.int().min(0), }, expiresAt: { - validator: $.num.int() + validator: $.num.int(), }, }, @@ -41,9 +41,9 @@ export const meta = { noSuchAd: { message: 'No such ad.', code: 'NO_SUCH_AD', - id: 'b7aa1727-1354-47bc-a182-3a9c3973d300' - } - } + id: 'b7aa1727-1354-47bc-a182-3a9c3973d300', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index f1c07745f9..886cacff73 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -11,14 +11,14 @@ export const meta = { params: { title: { - validator: $.str.min(1) + validator: $.str.min(1), }, text: { - validator: $.str.min(1) + validator: $.str.min(1), }, imageUrl: { - validator: $.nullable.str.min(1) - } + validator: $.nullable.str.min(1), + }, }, res: { @@ -52,9 +52,9 @@ export const meta = { imageUrl: { type: 'string' as const, optional: false as const, nullable: true as const, - } - } - } + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index 7dbc05b4c9..ade9ef581e 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -12,17 +12,17 @@ export const meta = { params: { id: { - validator: $.type(ID) - } + validator: $.type(ID), + }, }, errors: { noSuchAnnouncement: { message: 'No such announcement.', code: 'NO_SUCH_ANNOUNCEMENT', - id: 'ecad8040-a276-4e85-bda9-015a708d291e' - } - } + id: 'ecad8040-a276-4e85-bda9-015a708d291e', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index 4039bcd88f..f25b5e8efc 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -13,7 +13,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -63,10 +63,10 @@ export const meta = { reads: { type: 'number' as const, optional: false as const, nullable: false as const, - } - } - } - } + }, + }, + }, + }, }; export default define(meta, async (ps) => { @@ -76,7 +76,7 @@ export default define(meta, async (ps) => { for (const announcement of announcements) { (announcement as any).reads = await AnnouncementReads.count({ - announcementId: announcement.id + announcementId: announcement.id, }); } diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index 343f37d626..3fa8440ebd 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -12,26 +12,26 @@ export const meta = { params: { id: { - validator: $.type(ID) + validator: $.type(ID), }, title: { - validator: $.str.min(1) + validator: $.str.min(1), }, text: { - validator: $.str.min(1) + validator: $.str.min(1), }, imageUrl: { - validator: $.nullable.str.min(1) - } + validator: $.nullable.str.min(1), + }, }, errors: { noSuchAnnouncement: { message: 'No such announcement.', code: 'NO_SUCH_ANNOUNCEMENT', - id: 'd3aae5a7-6372-4cb4-b61c-f511ffc2d7cc' - } - } + id: 'd3aae5a7-6372-4cb4-b61c-f511ffc2d7cc', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 988ab29558..50979d53e8 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -14,12 +14,12 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { const files = await DriveFiles.find({ - userId: ps.userId + userId: ps.userId, }); for (const file of files) { diff --git a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts index 8497478da9..ae0e396b4f 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts @@ -12,7 +12,7 @@ export const meta = { export default define(meta, async (ps, me) => { const files = await DriveFiles.find({ - userId: IsNull() + userId: IsNull(), }); for (const file of files) { diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index fe1c799805..ee07245db7 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -13,7 +13,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -25,7 +25,7 @@ export const meta = { }, type: { - validator: $.optional.nullable.str.match(/^[a-zA-Z0-9\/\-*]+$/) + validator: $.optional.nullable.str.match(/^[a-zA-Z0-9\/\-*]+$/), }, origin: { @@ -34,12 +34,12 @@ export const meta = { 'local', 'remote', ]), - default: 'local' + default: 'local', }, hostname: { validator: $.optional.nullable.str, - default: null + default: null, }, }, @@ -49,9 +49,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'DriveFile' - } - } + ref: 'DriveFile', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts index 270b89c4fa..ab8e3d68e9 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts @@ -24,8 +24,8 @@ export const meta = { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'caf3ca38-c6e5-472e-a30c-b05377dcc240' - } + id: 'caf3ca38-c6e5-472e-a30c-b05377dcc240', + }, }, res: { @@ -51,36 +51,36 @@ export const meta = { }, userHost: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, md5: { type: 'string' as const, optional: false as const, nullable: false as const, format: 'md5', - example: '15eca7fba0480996e2245f5185bf39f2' + example: '15eca7fba0480996e2245f5185bf39f2', }, name: { type: 'string' as const, optional: false as const, nullable: false as const, - example: 'lenna.jpg' + example: 'lenna.jpg', }, type: { type: 'string' as const, optional: false as const, nullable: false as const, - example: 'image/jpeg' + example: 'image/jpeg', }, size: { type: 'number' as const, optional: false as const, nullable: false as const, - example: 51469 + example: 51469, }, comment: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, blurhash: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, properties: { type: 'object' as const, @@ -89,24 +89,24 @@ export const meta = { width: { type: 'number' as const, optional: false as const, nullable: false as const, - example: 1280 + example: 1280, }, height: { type: 'number' as const, optional: false as const, nullable: false as const, - example: 720 + example: 720, }, avgColor: { type: 'string' as const, optional: true as const, nullable: false as const, - example: 'rgb(40,65,87)' - } - } + example: 'rgb(40,65,87)', + }, + }, }, storedInternal: { type: 'boolean' as const, optional: false as const, nullable: true as const, - example: true + example: true, }, url: { type: 'string' as const, @@ -137,11 +137,11 @@ export const meta = { }, uri: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, src: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, folderId: { type: 'string' as const, @@ -155,21 +155,21 @@ export const meta = { }, isLink: { type: 'boolean' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps, me) => { const file = ps.fileId ? await DriveFiles.findOne(ps.fileId) : await DriveFiles.findOne({ where: [{ - url: ps.url + url: ps.url, }, { - thumbnailUrl: ps.url + thumbnailUrl: ps.url, }, { - webpublicUrl: ps.url - }] + webpublicUrl: ps.url, + }], }); if (file == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts index 1af81fe46d..407d9920d9 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts @@ -17,7 +17,7 @@ export const meta = { params: { fileId: { - validator: $.type(ID) + validator: $.type(ID), }, }, @@ -25,9 +25,9 @@ export const meta = { noSuchFile: { message: 'No such file.', code: 'MO_SUCH_FILE', - id: 'fc46b5a4-6b92-4c33-ac66-b806659bb5cf' - } - } + id: 'fc46b5a4-6b92-4c33-ac66-b806659bb5cf', + }, + }, }; export default define(meta, async (ps, me) => { @@ -51,14 +51,14 @@ export default define(meta, async (ps, me) => { await getConnection().queryResultCache!.remove(['meta_emojis']); publishBroadcastStream('emojiAdded', { - emoji: await Emojis.pack(emoji.id) + emoji: await Emojis.pack(emoji.id), }); insertModerationLog(me, 'addEmoji', { - emojiId: emoji.id + emojiId: emoji.id, }); return { - id: emoji.id + id: emoji.id, }; }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index 4c8ab99f7c..ae02df65e2 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -17,7 +17,7 @@ export const meta = { params: { emojiId: { - validator: $.type(ID) + validator: $.type(ID), }, }, @@ -25,8 +25,8 @@ export const meta = { noSuchEmoji: { message: 'No such emoji.', code: 'NO_SUCH_EMOJI', - id: 'e2785b66-dca3-4087-9cac-b93c541cc425' - } + id: 'e2785b66-dca3-4087-9cac-b93c541cc425', + }, }, res: { @@ -37,9 +37,9 @@ export const meta = { type: 'string' as const, optional: false as const, nullable: false as const, format: 'id', - } - } - } + }, + }, + }, }; export default define(meta, async (ps, me) => { @@ -72,10 +72,10 @@ export default define(meta, async (ps, me) => { await getConnection().queryResultCache!.remove(['meta_emojis']); publishBroadcastStream('emojiAdded', { - emoji: await Emojis.pack(copied.id) + emoji: await Emojis.pack(copied.id), }); return { - id: copied.id + id: copied.id, }; }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index 3c8ca22170..090ba2b64a 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -14,17 +14,17 @@ export const meta = { params: { query: { validator: $.optional.nullable.str, - default: null + default: null, }, host: { validator: $.optional.nullable.str, - default: null + default: null, }, limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -33,7 +33,7 @@ export const meta = { untilId: { validator: $.optional.type(ID), - } + }, }, res: { @@ -53,8 +53,8 @@ export const meta = { optional: false as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, name: { type: 'string' as const, @@ -71,10 +71,10 @@ export const meta = { url: { type: 'string' as const, optional: false as const, nullable: false as const, - } - } - } - } + }, + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index cb1e79e0fe..89cb60acaf 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -14,12 +14,12 @@ export const meta = { params: { query: { validator: $.optional.nullable.str, - default: null + default: null, }, limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -28,7 +28,7 @@ export const meta = { untilId: { validator: $.optional.type(ID), - } + }, }, res: { @@ -48,8 +48,8 @@ export const meta = { optional: false as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, name: { type: 'string' as const, @@ -66,10 +66,10 @@ export const meta = { url: { type: 'string' as const, optional: false as const, nullable: false as const, - } - } - } - } + }, + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/remove.ts b/packages/backend/src/server/api/endpoints/admin/emoji/remove.ts index 259950e362..78085470a9 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/remove.ts @@ -14,17 +14,17 @@ export const meta = { params: { id: { - validator: $.type(ID) - } + validator: $.type(ID), + }, }, errors: { noSuchEmoji: { message: 'No such emoji.', code: 'NO_SUCH_EMOJI', - id: 'be83669b-773a-44b7-b1f8-e5e5170ac3c2' - } - } + id: 'be83669b-773a-44b7-b1f8-e5e5170ac3c2', + }, + }, }; export default define(meta, async (ps, me) => { @@ -37,6 +37,6 @@ export default define(meta, async (ps, me) => { await getConnection().queryResultCache!.remove(['meta_emojis']); insertModerationLog(me, 'removeEmoji', { - emoji: emoji + emoji: emoji, }); }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts index 3fd547d7e5..c61d8cb320 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts @@ -13,29 +13,29 @@ export const meta = { params: { id: { - validator: $.type(ID) + validator: $.type(ID), }, name: { - validator: $.str + validator: $.str, }, category: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, aliases: { - validator: $.arr($.str) - } + validator: $.arr($.str), + }, }, errors: { noSuchEmoji: { message: 'No such emoji.', code: 'NO_SUCH_EMOJI', - id: '684dec9d-a8c2-4364-9aa8-456c49cb1dc8' - } - } + id: '684dec9d-a8c2-4364-9aa8-456c49cb1dc8', + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index 82540c5447..d9e003d35d 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -11,14 +11,14 @@ export const meta = { params: { host: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, me) => { const files = await DriveFiles.find({ - userHost: ps.host + userHost: ps.host, }); for (const file of files) { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index 65a6947ba0..9e7a8ec476 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -12,9 +12,9 @@ export const meta = { params: { host: { - validator: $.str + validator: $.str, }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 7935eaa631..8fc964fd2f 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -11,19 +11,19 @@ export const meta = { params: { host: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, me) => { const followings = await Followings.find({ - followerHost: ps.host + followerHost: ps.host, }); const pairs = await Promise.all(followings.map(f => Promise.all([ Users.findOneOrFail(f.followerId), - Users.findOneOrFail(f.followeeId) + Users.findOneOrFail(f.followeeId), ]))); for (const pair of pairs) { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts index 34eab27c78..4ea1275f7c 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts @@ -11,13 +11,13 @@ export const meta = { params: { host: { - validator: $.str + validator: $.str, }, isSuspended: { - validator: $.bool + validator: $.bool, }, - } + }, }; export default define(meta, async (ps, me) => { @@ -28,6 +28,6 @@ export default define(meta, async (ps, me) => { } Instances.update({ host: toPuny(ps.host) }, { - isSuspended: ps.isSuspended + isSuspended: ps.isSuspended, }); }); diff --git a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts index bce813232b..64f0292943 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-table-stats.ts @@ -16,10 +16,10 @@ export const meta = { example: { migrations: { count: 66, - size: 32768 + size: 32768, }, - } - } + }, + }, }; export default define(meta, async () => { diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index 2c69eec535..b9452c83d2 100644 --- a/packages/backend/src/server/api/endpoints/admin/invite.ts +++ b/packages/backend/src/server/api/endpoints/admin/invite.ts @@ -20,10 +20,10 @@ export const meta = { optional: false as const, nullable: false as const, example: '2ERUA5VR', maxLength: 8, - minLength: 8 - } - } - } + minLength: 8, + }, + }, + }, }; export default define(meta, async () => { diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts index 2b87fc217f..8e3419bf66 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts @@ -13,7 +13,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps) => { @@ -28,6 +28,6 @@ export default define(meta, async (ps) => { } await Users.update(user.id, { - isModerator: true + isModerator: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts index cbb0625224..5a5a91e9ce 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts @@ -13,7 +13,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps) => { @@ -24,6 +24,6 @@ export default define(meta, async (ps) => { } await Users.update(user.id, { - isModerator: false + isModerator: false, }); }); diff --git a/packages/backend/src/server/api/endpoints/admin/promo/create.ts b/packages/backend/src/server/api/endpoints/admin/promo/create.ts index 3bdaaad4d9..245780c2d1 100644 --- a/packages/backend/src/server/api/endpoints/admin/promo/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/promo/create.ts @@ -17,7 +17,7 @@ export const meta = { }, expiresAt: { - validator: $.num.int() + validator: $.num.int(), }, }, @@ -25,15 +25,15 @@ export const meta = { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'ee449fbe-af2a-453b-9cae-cf2fe7c895fc' + id: 'ee449fbe-af2a-453b-9cae-cf2fe7c895fc', }, alreadyPromoted: { message: 'The note has already promoted.', code: 'ALREADY_PROMOTED', - id: 'ae427aa2-7a41-484f-a18c-2c1104051604' + id: 'ae427aa2-7a41-484f-a18c-2c1104051604', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts index fedb7065ab..3a7ae6b4b0 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts @@ -8,7 +8,7 @@ export const meta = { requireCredential: true as const, requireModerator: true, - params: {} + params: {}, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index cd7b640983..cb2d1d0d79 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -24,15 +24,15 @@ export const meta = { }, { type: 'number' as const, - } - ] - } + }, + ], + }, }, example: [[ 'example.com', - 12 - ]] - } + 12, + ]], + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 1925906c28..d524002faf 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -24,15 +24,15 @@ export const meta = { }, { type: 'number' as const, - } - ] - } + }, + ], + }, }, example: [[ 'example.com', - 12 - ]] - } + 12, + ]], + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts b/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts index c426e5f39b..ece1d46f3f 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/jobs.ts @@ -19,7 +19,7 @@ export const meta = { limit: { validator: $.optional.num, - default: 50 + default: 50, }, }, @@ -33,27 +33,27 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, data: { type: 'object' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, attempts: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, maxAttempts: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, timestamp: { type: 'number' as const, - optional: false as const, nullable: false as const - } - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index 38f18459dd..1fc42ea0b5 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -14,19 +14,19 @@ export const meta = { optional: false as const, nullable: false as const, properties: { deliver: { - ref: 'QueueCount' + ref: 'QueueCount', }, inbox: { - ref: 'QueueCount' + ref: 'QueueCount', }, db: { - ref: 'QueueCount' + ref: 'QueueCount', }, objectStorage: { - ref: 'QueueCount' - } - } - } + ref: 'QueueCount', + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index 567035fd3a..80609aee94 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -12,7 +12,7 @@ export const meta = { params: { inbox: { - validator: $.str + validator: $.str, }, }, @@ -20,7 +20,7 @@ export const meta = { invalidUrl: { message: 'Invalid URL', code: 'INVALID_URL', - id: 'fb8c92d3-d4e5-44e7-b3d4-800d5cef8b2c' + id: 'fb8c92d3-d4e5-44e7-b3d4-800d5cef8b2c', }, }, @@ -31,12 +31,12 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, inbox: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'url' + format: 'url', }, status: { type: 'string' as const, @@ -45,11 +45,11 @@ export const meta = { enum: [ 'requesting', 'accepted', - 'rejected' - ] - } - } - } + 'rejected', + ], + }, + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/admin/relays/list.ts b/packages/backend/src/server/api/endpoints/admin/relays/list.ts index 031ebe85d0..ef103fbb31 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/list.ts @@ -20,12 +20,12 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, inbox: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'url' + format: 'url', }, status: { type: 'string' as const, @@ -34,12 +34,12 @@ export const meta = { enum: [ 'requesting', 'accepted', - 'rejected' - ] - } - } - } - } + 'rejected', + ], + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts index c1c50f5dc0..e7ddef30fc 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts @@ -10,7 +10,7 @@ export const meta = { params: { inbox: { - validator: $.str + validator: $.str, }, }, }; diff --git a/packages/backend/src/server/api/endpoints/admin/reset-password.ts b/packages/backend/src/server/api/endpoints/admin/reset-password.ts index 0fc2c6a868..bdd7ef27b8 100644 --- a/packages/backend/src/server/api/endpoints/admin/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/admin/reset-password.ts @@ -25,10 +25,10 @@ export const meta = { type: 'string' as const, optional: false as const, nullable: false as const, minLength: 8, - maxLength: 8 - } - } - } + maxLength: 8, + }, + }, + }, }; export default define(meta, async (ps) => { @@ -48,12 +48,12 @@ export default define(meta, async (ps) => { const hash = bcrypt.hashSync(passwd); await UserProfiles.update({ - userId: user.id + userId: user.id, }, { - password: hash + password: hash, }); return { - password: passwd + password: passwd, }; }); diff --git a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index 7b71f8e000..94158ecfdb 100644 --- a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -13,7 +13,7 @@ export const meta = { reportId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/send-email.ts b/packages/backend/src/server/api/endpoints/admin/send-email.ts index 6f67b78542..4797aa7a2b 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-email.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-email.ts @@ -18,7 +18,7 @@ export const meta = { text: { validator: $.str, }, - } + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/server-info.ts b/packages/backend/src/server/api/endpoints/admin/server-info.ts index bb2d35e397..4ddc39deb0 100644 --- a/packages/backend/src/server/api/endpoints/admin/server-info.ts +++ b/packages/backend/src/server/api/endpoints/admin/server-info.ts @@ -24,7 +24,7 @@ export const meta = { os: { type: 'string' as const, optional: false as const, nullable: false as const, - example: 'linux' + example: 'linux', }, node: { type: 'string' as const, @@ -45,8 +45,8 @@ export const meta = { cores: { type: 'number' as const, optional: false as const, nullable: false as const, - } - } + }, + }, }, mem: { type: 'object' as const, @@ -56,8 +56,8 @@ export const meta = { type: 'number' as const, optional: false as const, nullable: false as const, format: 'bytes', - } - } + }, + }, }, fs: { type: 'object' as const, @@ -72,8 +72,8 @@ export const meta = { type: 'number' as const, optional: false as const, nullable: false as const, format: 'bytes', - } - } + }, + }, }, net: { type: 'object' as const, @@ -82,12 +82,12 @@ export const meta = { interface: { type: 'string' as const, optional: false as const, nullable: false as const, - example: 'eth0' - } - } - } - } - } + example: 'eth0', + }, + }, + }, + }, + }, }; export default define(meta, async () => { @@ -103,17 +103,17 @@ export default define(meta, async () => { redis: redisClient.server_info.redis_version, cpu: { model: os.cpus()[0].model, - cores: os.cpus().length + cores: os.cpus().length, }, mem: { - total: memStats.total + total: memStats.total, }, fs: { total: fsStats[0].size, used: fsStats[0].used, }, net: { - interface: netInterface - } + interface: netInterface, + }, }; }); diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index e9509568d0..19d4be973f 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -13,7 +13,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -35,34 +35,34 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, createdAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, type: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, info: { type: 'object' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, userId: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, user: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } - } - } - } + ref: 'User', + }, + }, + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/admin/show-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts index 963c123255..21cc9e5abc 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts @@ -22,85 +22,85 @@ export const meta = { id: { type: 'string' as const, nullable: false as const, optional: false as const, - format: 'id' + format: 'id', }, createdAt: { type: 'string' as const, nullable: false as const, optional: false as const, - format: 'date-time' + format: 'date-time', }, updatedAt: { type: 'string' as const, nullable: true as const, optional: false as const, - format: 'date-time' + format: 'date-time', }, lastFetchedAt: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, username: { type: 'string' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, name: { type: 'string' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, folowersCount: { type: 'number' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, followingCount: { type: 'number' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, notesCount: { type: 'number' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, avatarId: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, bannerId: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, tags: { type: 'array' as const, nullable: false as const, optional: false as const, items: { type: 'string' as const, - nullable: false as const, optional: false as const - } + nullable: false as const, optional: false as const, + }, }, avatarUrl: { type: 'string' as const, nullable: true as const, optional: false as const, - format: 'url' + format: 'url', }, bannerUrl: { type: 'string' as const, nullable: true as const, optional: false as const, - format: 'url' + format: 'url', }, avatarBlurhash: { type: 'any' as const, nullable: true as const, optional: false as const, - default: null + default: null, }, bannerBlurhash: { type: 'any' as const, nullable: true as const, optional: false as const, - default: null + default: null, }, isSuspended: { type: 'boolean' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, isSilenced: { type: 'boolean' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, isLocked: { type: 'boolean' as const, @@ -108,55 +108,55 @@ export const meta = { }, isBot: { type: 'boolean' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, isCat: { type: 'boolean' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, isAdmin: { type: 'boolean' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, isModerator: { type: 'boolean' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, emojis: { type: 'array' as const, nullable: false as const, optional: false as const, items: { type: 'string' as const, - nullable: false as const, optional: false as const - } + nullable: false as const, optional: false as const, + }, }, host: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, inbox: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, sharedInbox: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, featured: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, uri: { type: 'string' as const, - nullable: true as const, optional: false as const + nullable: true as const, optional: false as const, }, token: { type: 'string' as const, nullable: false as const, optional: false as const, - default: '<MASKED>' - } - } - } + default: '<MASKED>', + }, + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index 20b63e7be6..9c57917cb2 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -11,12 +11,12 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num.min(0), - default: 0 + default: 0, }, sort: { @@ -40,7 +40,7 @@ export const meta = { 'silenced', 'suspended', ]), - default: 'all' + default: 'all', }, origin: { @@ -49,18 +49,18 @@ export const meta = { 'local', 'remote', ]), - default: 'local' + default: 'local', }, username: { validator: $.optional.str, - default: null + default: null, }, hostname: { validator: $.optional.str, - default: null - } + default: null, + }, }, res: { @@ -69,9 +69,9 @@ export const meta = { items: { type: 'object' as const, nullable: false as const, optional: false as const, - ref: 'User' - } - } + ref: 'User', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/admin/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index 9bfed2310a..9f5135b1a6 100644 --- a/packages/backend/src/server/api/endpoints/admin/silence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/silence-user.ts @@ -14,7 +14,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { @@ -29,7 +29,7 @@ export default define(meta, async (ps, me) => { } await Users.update(user.id, { - isSilenced: true + isSilenced: true, }); insertModerationLog(me, 'silence', { diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 364f258ce8..c062dcc93f 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -18,7 +18,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { @@ -37,7 +37,7 @@ export default define(meta, async (ps, me) => { } await Users.update(user.id, { - isSuspended: true + isSuspended: true, }); insertModerationLog(me, 'suspend', { @@ -58,12 +58,12 @@ export default define(meta, async (ps, me) => { async function unFollowAll(follower: User) { const followings = await Followings.find({ - followerId: follower.id + followerId: follower.id, }); for (const following of followings) { const followee = await Users.findOne({ - id: following.followeeId + id: following.followeeId, }); if (followee == null) { @@ -79,6 +79,6 @@ async function readAllNotify(notifier: User) { notifierId: notifier.id, isRead: false, }, { - isRead: true + isRead: true, }); } diff --git a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts index 9994fbf462..bc081c8487 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts @@ -14,7 +14,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { @@ -25,7 +25,7 @@ export default define(meta, async (ps, me) => { } await Users.update(user.id, { - isSilenced: false + isSilenced: false, }); insertModerationLog(me, 'unsilence', { diff --git a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts index ab4c2d3dfe..73a5bc739b 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts @@ -15,7 +15,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps, me) => { @@ -26,7 +26,7 @@ export default define(meta, async (ps, me) => { } await Users.update(user.id, { - isSuspended: false + isSuspended: false, }); insertModerationLog(me, 'unsuspend', { 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 55447098dc..e67088e0aa 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -246,57 +246,57 @@ export const meta = { }, useObjectStorage: { - validator: $.optional.bool + validator: $.optional.bool, }, objectStorageBaseUrl: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStorageBucket: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStoragePrefix: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStorageEndpoint: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStorageRegion: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStoragePort: { - validator: $.optional.nullable.num + validator: $.optional.nullable.num, }, objectStorageAccessKey: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStorageSecretKey: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, objectStorageUseSSL: { - validator: $.optional.bool + validator: $.optional.bool, }, objectStorageUseProxy: { - validator: $.optional.bool + validator: $.optional.bool, }, objectStorageSetPublicRead: { - validator: $.optional.bool + validator: $.optional.bool, }, objectStorageS3ForcePathStyle: { - validator: $.optional.bool + validator: $.optional.bool, }, - } + }, }; export default define(meta, async (ps, me) => { @@ -593,8 +593,8 @@ export default define(meta, async (ps, me) => { await getConnection().transaction(async transactionalEntityManager => { const meta = await transactionalEntityManager.findOne(Meta, { order: { - id: 'DESC' - } + id: 'DESC', + }, }); if (meta) { diff --git a/packages/backend/src/server/api/endpoints/admin/vacuum.ts b/packages/backend/src/server/api/endpoints/admin/vacuum.ts index 9a80d88c44..d08dfdd9ea 100644 --- a/packages/backend/src/server/api/endpoints/admin/vacuum.ts +++ b/packages/backend/src/server/api/endpoints/admin/vacuum.ts @@ -16,7 +16,7 @@ export const meta = { analyze: { validator: $.bool, }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index a67737b2ff..32ef49d889 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -12,12 +12,12 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, withUnreads: { validator: $.optional.boolean, - default: false + default: false, }, sinceId: { @@ -67,10 +67,10 @@ export const meta = { isRead: { type: 'boolean' as const, optional: false as const, nullable: false as const, - } - } - } - } + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { @@ -80,7 +80,7 @@ export default define(meta, async (ps, user) => { if (user) { const reads = (await AnnouncementReads.find({ - userId: user.id + userId: user.id, })).map(x => x.announcementId); for (const announcement of announcements) { diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 4bdae8cc33..83c7d3e0a5 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -15,11 +15,11 @@ export const meta = { params: { name: { - validator: $.str.range(1, 100) + validator: $.str.range(1, 100), }, src: { - validator: $.str.or(['home', 'all', 'users', 'list', 'group']) + validator: $.str.or(['home', 'all', 'users', 'list', 'group']), }, userListId: { @@ -31,53 +31,53 @@ export const meta = { }, keywords: { - validator: $.arr($.arr($.str)) + validator: $.arr($.arr($.str)), }, excludeKeywords: { - validator: $.arr($.arr($.str)) + validator: $.arr($.arr($.str)), }, users: { - validator: $.arr($.str) + validator: $.arr($.str), }, caseSensitive: { - validator: $.bool + validator: $.bool, }, withReplies: { - validator: $.bool + validator: $.bool, }, withFile: { - validator: $.bool + validator: $.bool, }, notify: { - validator: $.bool - } + validator: $.bool, + }, }, errors: { noSuchUserList: { message: 'No such user list.', code: 'NO_SUCH_USER_LIST', - id: '95063e93-a283-4b8b-9aa5-bcdb8df69a7f' + id: '95063e93-a283-4b8b-9aa5-bcdb8df69a7f', }, noSuchUserGroup: { message: 'No such user group.', code: 'NO_SUCH_USER_GROUP', - id: 'aa3c0b9a-8cae-47c0-92ac-202ce5906682' - } + id: 'aa3c0b9a-8cae-47c0-92ac-202ce5906682', + }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Antenna' - } + ref: 'Antenna', + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index 1cd136183e..721932f311 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -15,22 +15,22 @@ export const meta = { params: { antennaId: { validator: $.type(ID), - } + }, }, errors: { noSuchAntenna: { message: 'No such antenna.', code: 'NO_SUCH_ANTENNA', - id: 'b34dcf9d-348f-44bb-99d0-6c9314cfe2df' - } - } + id: 'b34dcf9d-348f-44bb-99d0-6c9314cfe2df', + }, + }, }; export default define(meta, async (ps, user) => { const antenna = await Antennas.findOne({ id: ps.antennaId, - userId: user.id + userId: user.id, }); if (antenna == null) { diff --git a/packages/backend/src/server/api/endpoints/antennas/list.ts b/packages/backend/src/server/api/endpoints/antennas/list.ts index 8baae8435b..4a9eed8563 100644 --- a/packages/backend/src/server/api/endpoints/antennas/list.ts +++ b/packages/backend/src/server/api/endpoints/antennas/list.ts @@ -14,9 +14,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Antenna' - } - } + ref: 'Antenna', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 02fec2778b..968924831c 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -23,7 +23,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -47,8 +47,8 @@ export const meta = { noSuchAntenna: { message: 'No such antenna.', code: 'NO_SUCH_ANTENNA', - id: '850926e0-fd3b-49b6-b69a-b28a5dbd82fe' - } + id: '850926e0-fd3b-49b6-b69a-b28a5dbd82fe', + }, }, res: { @@ -57,15 +57,15 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Note' - } - } + ref: 'Note', + }, + }, }; export default define(meta, async (ps, user) => { const antenna = await Antennas.findOne({ id: ps.antennaId, - userId: user.id + userId: user.id, }); if (antenna == null) { diff --git a/packages/backend/src/server/api/endpoints/antennas/show.ts b/packages/backend/src/server/api/endpoints/antennas/show.ts index 3cdf4dcb61..79e988497d 100644 --- a/packages/backend/src/server/api/endpoints/antennas/show.ts +++ b/packages/backend/src/server/api/endpoints/antennas/show.ts @@ -21,15 +21,15 @@ export const meta = { noSuchAntenna: { message: 'No such antenna.', code: 'NO_SUCH_ANTENNA', - id: 'c06569fb-b025-4f23-b22d-1fcd20d2816b' + id: 'c06569fb-b025-4f23-b22d-1fcd20d2816b', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Antenna' - } + ref: 'Antenna', + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index d69b4feee6..d5400a7926 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -18,11 +18,11 @@ export const meta = { }, name: { - validator: $.str.range(1, 100) + validator: $.str.range(1, 100), }, src: { - validator: $.str.or(['home', 'all', 'users', 'list', 'group']) + validator: $.str.or(['home', 'all', 'users', 'list', 'group']), }, userListId: { @@ -34,66 +34,66 @@ export const meta = { }, keywords: { - validator: $.arr($.arr($.str)) + validator: $.arr($.arr($.str)), }, excludeKeywords: { - validator: $.arr($.arr($.str)) + validator: $.arr($.arr($.str)), }, users: { - validator: $.arr($.str) + validator: $.arr($.str), }, caseSensitive: { - validator: $.bool + validator: $.bool, }, withReplies: { - validator: $.bool + validator: $.bool, }, withFile: { - validator: $.bool + validator: $.bool, }, notify: { - validator: $.bool - } + validator: $.bool, + }, }, errors: { noSuchAntenna: { message: 'No such antenna.', code: 'NO_SUCH_ANTENNA', - id: '10c673ac-8852-48eb-aa1f-f5b67f069290' + id: '10c673ac-8852-48eb-aa1f-f5b67f069290', }, noSuchUserList: { message: 'No such user list.', code: 'NO_SUCH_USER_LIST', - id: '1c6b35c9-943e-48c2-81e4-2844989407f7' + id: '1c6b35c9-943e-48c2-81e4-2844989407f7', }, noSuchUserGroup: { message: 'No such user group.', code: 'NO_SUCH_USER_GROUP', - id: '109ed789-b6eb-456e-b8a9-6059d567d385' - } + id: '109ed789-b6eb-456e-b8a9-6059d567d385', + }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Antenna' - } + ref: 'Antenna', + }, }; export default define(meta, async (ps, user) => { // Fetch the antenna const antenna = await Antennas.findOne({ id: ps.antennaId, - userId: user.id + userId: user.id, }); if (antenna == null) { diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index 2f97a24774..000ed2d2df 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -11,7 +11,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 30 + max: 30, }, params: { @@ -26,7 +26,7 @@ export const meta = { res: { type: 'object' as const, optional: false as const, nullable: false as const, - } + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 32685d44bd..709349262a 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -20,7 +20,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 30 + max: 30, }, params: { @@ -33,8 +33,8 @@ export const meta = { noSuchObject: { message: 'No such object.', code: 'NO_SUCH_OBJECT', - id: 'dc94d745-1262-4e63-a17d-fecaa57efc82' - } + id: 'dc94d745-1262-4e63-a17d-fecaa57efc82', + }, }, res: { @@ -44,14 +44,14 @@ export const meta = { type: { type: 'string' as const, optional: false as const, nullable: false as const, - enum: ['User', 'Note'] + enum: ['User', 'Note'], }, object: { type: 'object' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps) => { @@ -79,7 +79,7 @@ async function fetchAny(uri: string) { if (note) { return { type: 'Note', - object: await Notes.pack(note, null, { detail: true }) + object: await Notes.pack(note, null, { detail: true }), }; } } else if (type === 'users') { @@ -88,7 +88,7 @@ async function fetchAny(uri: string) { if (user) { return { type: 'User', - object: await Users.pack(user, null, { detail: true }) + object: await Users.pack(user, null, { detail: true }), }; } } @@ -102,7 +102,7 @@ async function fetchAny(uri: string) { { const [user, note] = await Promise.all([ Users.findOne({ uri: uri }), - Notes.findOne({ uri: uri }) + Notes.findOne({ uri: uri }), ]); const packed = await mergePack(user, note); @@ -127,7 +127,7 @@ async function fetchAny(uri: string) { if (note) { return { type: 'Note', - object: await Notes.pack(note, null, { detail: true }) + object: await Notes.pack(note, null, { detail: true }), }; } } else if (type === 'users') { @@ -136,7 +136,7 @@ async function fetchAny(uri: string) { if (user) { return { type: 'User', - object: await Users.pack(user, null, { detail: true }) + object: await Users.pack(user, null, { detail: true }), }; } } @@ -144,7 +144,7 @@ async function fetchAny(uri: string) { const [user, note] = await Promise.all([ Users.findOne({ uri: object.id }), - Notes.findOne({ uri: object.id }) + Notes.findOne({ uri: object.id }), ]); const packed = await mergePack(user, note); @@ -156,7 +156,7 @@ async function fetchAny(uri: string) { const user = await createPerson(getApId(object)); return { type: 'User', - object: await Users.pack(user, null, { detail: true }) + object: await Users.pack(user, null, { detail: true }), }; } @@ -164,7 +164,7 @@ async function fetchAny(uri: string) { const note = await createNote(getApId(object), undefined, true); return { type: 'Note', - object: await Notes.pack(note!, null, { detail: true }) + object: await Notes.pack(note!, null, { detail: true }), }; } @@ -175,14 +175,14 @@ async function mergePack(user: User | null | undefined, note: Note | null | unde if (user != null) { return { type: 'User', - object: await Users.pack(user, null, { detail: true }) + object: await Users.pack(user, null, { detail: true }), }; } if (note != null) { return { type: 'Note', - object: await Notes.pack(note, null, { detail: true }) + object: await Notes.pack(note, null, { detail: true }), }; } diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index c2ce943dcc..78586cbcf2 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -53,11 +53,11 @@ export default define(meta, async (ps, user) => { description: ps.description, permission, callbackUrl: ps.callbackUrl, - secret: secret + secret: secret, }); return await Apps.pack(app, null, { detail: true, - includeSecret: true + includeSecret: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/app/show.ts b/packages/backend/src/server/api/endpoints/app/show.ts index 27f12eb44f..c83d576b43 100644 --- a/packages/backend/src/server/api/endpoints/app/show.ts +++ b/packages/backend/src/server/api/endpoints/app/show.ts @@ -23,15 +23,15 @@ export const meta = { noSuchApp: { message: 'No such app.', code: 'NO_SUCH_APP', - id: 'dce83913-2dc6-4093-8a7b-71dbb11718a3' - } + id: 'dce83913-2dc6-4093-8a7b-71dbb11718a3', + }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'App' - } + ref: 'App', + }, }; export default define(meta, async (ps, user, token) => { @@ -46,6 +46,6 @@ export default define(meta, async (ps, user, token) => { return await Apps.pack(ap, user, { detail: true, - includeSecret: isSecure && (ap.userId === user!.id) + includeSecret: isSecure && (ap.userId === user!.id), }); }); diff --git a/packages/backend/src/server/api/endpoints/auth/accept.ts b/packages/backend/src/server/api/endpoints/auth/accept.ts index 1d1d8ac227..989ebf8f25 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -15,17 +15,17 @@ export const meta = { params: { token: { - validator: $.str - } + validator: $.str, + }, }, errors: { noSuchSession: { message: 'No such session.', code: 'NO_SUCH_SESSION', - id: '9c72d8de-391a-43c1-9d06-08d29efde8df' + id: '9c72d8de-391a-43c1-9d06-08d29efde8df', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -65,12 +65,12 @@ export default define(meta, async (ps, user) => { appId: session.appId, userId: user.id, token: accessToken, - hash: hash + hash: hash, }); } // Update session await AuthSessions.update(session.id, { - userId: user.id + userId: user.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/auth/session/generate.ts b/packages/backend/src/server/api/endpoints/auth/session/generate.ts index 859cf52ed3..39ba5a972a 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/generate.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/generate.ts @@ -14,7 +14,7 @@ export const meta = { params: { appSecret: { validator: $.str, - } + }, }, res: { @@ -30,22 +30,22 @@ export const meta = { optional: false as const, nullable: false as const, format: 'url', }, - } + }, }, errors: { noSuchApp: { message: 'No such app.', code: 'NO_SUCH_APP', - id: '92f93e63-428e-4f2f-a5a4-39e1407fe998' - } - } + id: '92f93e63-428e-4f2f-a5a4-39e1407fe998', + }, + }, }; export default define(meta, async (ps) => { // Lookup app const app = await Apps.findOne({ - secret: ps.appSecret + secret: ps.appSecret, }); if (app == null) { @@ -60,11 +60,11 @@ export default define(meta, async (ps) => { id: genId(), createdAt: new Date(), appId: app.id, - token: token + token: token, }); return { token: doc.token, - url: `${config.authUrl}/${doc.token}` + url: `${config.authUrl}/${doc.token}`, }; }); diff --git a/packages/backend/src/server/api/endpoints/auth/session/show.ts b/packages/backend/src/server/api/endpoints/auth/session/show.ts index 23f1a56a37..e890dd95a3 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/show.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/show.ts @@ -11,15 +11,15 @@ export const meta = { params: { token: { validator: $.str, - } + }, }, errors: { noSuchSession: { message: 'No such session.', code: 'NO_SUCH_SESSION', - id: 'bd72c97d-eba7-4adb-a467-f171b8847250' - } + id: 'bd72c97d-eba7-4adb-a467-f171b8847250', + }, }, res: { @@ -29,25 +29,25 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, app: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'App' + ref: 'App', }, token: { type: 'string' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps, user) => { // Lookup session const session = await AuthSessions.findOne({ - token: ps.token + token: ps.token, }); if (session == null) { diff --git a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index 72201cb207..241b13d4da 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts @@ -15,7 +15,7 @@ export const meta = { token: { validator: $.str, - } + }, }, res: { @@ -32,34 +32,34 @@ export const meta = { optional: false as const, nullable: false as const, ref: 'User', }, - } + }, }, errors: { noSuchApp: { message: 'No such app.', code: 'NO_SUCH_APP', - id: 'fcab192a-2c5a-43b7-8ad8-9b7054d8d40d' + id: 'fcab192a-2c5a-43b7-8ad8-9b7054d8d40d', }, noSuchSession: { message: 'No such session.', code: 'NO_SUCH_SESSION', - id: '5b5a1503-8bc8-4bd0-8054-dc189e8cdcb3' + id: '5b5a1503-8bc8-4bd0-8054-dc189e8cdcb3', }, pendingSession: { message: 'This session is not completed yet.', code: 'PENDING_SESSION', - id: '8c8a4145-02cc-4cca-8e66-29ba60445a8e' - } - } + id: '8c8a4145-02cc-4cca-8e66-29ba60445a8e', + }, + }, }; export default define(meta, async (ps) => { // Lookup app const app = await Apps.findOne({ - secret: ps.appSecret + secret: ps.appSecret, }); if (app == null) { @@ -69,7 +69,7 @@ export default define(meta, async (ps) => { // Fetch token const session = await AuthSessions.findOne({ token: ps.token, - appId: app.id + appId: app.id, }); if (session == null) { @@ -83,7 +83,7 @@ export default define(meta, async (ps) => { // Lookup access token const accessToken = await AccessTokens.findOneOrFail({ appId: app.id, - userId: session.userId + userId: session.userId, }); // Delete session @@ -92,7 +92,7 @@ export default define(meta, async (ps) => { return { accessToken: accessToken.token, user: await Users.pack(session.userId, null, { - detail: true - }) + detail: true, + }), }; }); diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index 4d33c09479..cb92589d19 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -12,7 +12,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 100 + max: 100, }, requireCredential: true as const, @@ -22,34 +22,34 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '7cc4f851-e2f1-4621-9633-ec9e1d00c01e' + id: '7cc4f851-e2f1-4621-9633-ec9e1d00c01e', }, blockeeIsYourself: { message: 'Blockee is yourself.', code: 'BLOCKEE_IS_YOURSELF', - id: '88b19138-f28d-42c0-8499-6a31bbd0fdc6' + id: '88b19138-f28d-42c0-8499-6a31bbd0fdc6', }, alreadyBlocking: { message: 'You are already blocking that user.', code: 'ALREADY_BLOCKING', - id: '787fed64-acb9-464a-82eb-afbd745b9614' + id: '787fed64-acb9-464a-82eb-afbd745b9614', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { @@ -69,7 +69,7 @@ export default define(meta, async (ps, user) => { // Check if already blocking const exist = await Blockings.findOne({ blockerId: blocker.id, - blockeeId: blockee.id + blockeeId: blockee.id, }); if (exist != null) { @@ -80,10 +80,10 @@ export default define(meta, async (ps, user) => { NoteWatchings.delete({ userId: blocker.id, - noteUserId: blockee.id + noteUserId: blockee.id, }); return await Users.pack(blockee.id, blocker, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index ae5dab020a..7a99fe0f49 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -12,7 +12,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 100 + max: 100, }, requireCredential: true as const, @@ -22,26 +22,26 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '8621d8bf-c358-4303-a066-5ea78610eb3f' + id: '8621d8bf-c358-4303-a066-5ea78610eb3f', }, blockeeIsYourself: { message: 'Blockee is yourself.', code: 'BLOCKEE_IS_YOURSELF', - id: '06f6fac6-524b-473c-a354-e97a40ae6eac' + id: '06f6fac6-524b-473c-a354-e97a40ae6eac', }, notBlocking: { message: 'You are not blocking that user.', code: 'NOT_BLOCKING', - id: '291b2efa-60c6-45c0-9f6a-045c8f9b02cd' + id: '291b2efa-60c6-45c0-9f6a-045c8f9b02cd', }, }, @@ -69,7 +69,7 @@ export default define(meta, async (ps, user) => { // Check not blocking const exist = await Blockings.findOne({ blockerId: blocker.id, - blockeeId: blockee.id + blockeeId: blockee.id, }); if (exist == null) { @@ -80,6 +80,6 @@ export default define(meta, async (ps, user) => { await deleteBlocking(blocker, blockee); return await Users.pack(blockee.id, blocker, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index fe25fdaba1..901403d144 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 30 + default: 30, }, sinceId: { @@ -33,7 +33,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Blocking', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index 0cedfd6c6a..0176f86e00 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -15,16 +15,16 @@ export const meta = { params: { name: { - validator: $.str.range(1, 128) + validator: $.str.range(1, 128), }, description: { - validator: $.nullable.optional.str.range(1, 2048) + validator: $.nullable.optional.str.range(1, 2048), }, bannerId: { validator: $.nullable.optional.type(ID), - } + }, }, res: { @@ -37,9 +37,9 @@ export const meta = { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'cd1e9f3e-5a12-4ab4-96f6-5d0a2cc32050' + id: 'cd1e9f3e-5a12-4ab4-96f6-5d0a2cc32050', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -47,7 +47,7 @@ export default define(meta, async (ps, user) => { if (ps.bannerId != null) { banner = await DriveFiles.findOne({ id: ps.bannerId, - userId: user.id + userId: user.id, }); if (banner == null) { diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index dc1f49f960..8eab2402be 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -13,7 +13,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Channel', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index d4664e6996..d30593acd9 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -23,9 +23,9 @@ export const meta = { noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', - id: 'c0031718-d573-4e85-928e-10039f1fbb68' + id: 'c0031718-d573-4e85-928e-10039f1fbb68', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index be239a01d6..28454c97fd 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -22,7 +22,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 5 + default: 5, }, }, @@ -33,7 +33,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Channel', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index 4a2e9db17b..44024b158e 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -22,7 +22,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 5 + default: 5, }, }, @@ -33,7 +33,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Channel', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/channels/show.ts b/packages/backend/src/server/api/endpoints/channels/show.ts index 803ce6363d..e7ce4f22eb 100644 --- a/packages/backend/src/server/api/endpoints/channels/show.ts +++ b/packages/backend/src/server/api/endpoints/channels/show.ts @@ -25,9 +25,9 @@ export const meta = { noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', - id: '6f6c314b-7486-4897-8966-c04a66a02923' + id: '6f6c314b-7486-4897-8966-c04a66a02923', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index 0ed057a11e..56c205cae5 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -45,16 +45,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', - id: '4d0eeeba-a02c-4c3c-9966-ef60d38d2e7f' - } - } + id: '4d0eeeba-a02c-4c3c-9966-ef60d38d2e7f', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index 700f8e93ba..8ce9a7e644 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -22,9 +22,9 @@ export const meta = { noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', - id: '19959ee9-0153-4c51-bbd9-a98c49dc59d6' + id: '19959ee9-0153-4c51-bbd9-a98c49dc59d6', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index 05f279d6ac..0e6863ac76 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -17,16 +17,16 @@ export const meta = { }, name: { - validator: $.optional.str.range(1, 128) + validator: $.optional.str.range(1, 128), }, description: { - validator: $.nullable.optional.str.range(1, 2048) + validator: $.nullable.optional.str.range(1, 2048), }, bannerId: { validator: $.nullable.optional.type(ID), - } + }, }, res: { @@ -39,21 +39,21 @@ export const meta = { noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', - id: 'f9c5467f-d492-4c3c-9a8d-a70dacc86512' + id: 'f9c5467f-d492-4c3c-9a8d-a70dacc86512', }, accessDenied: { message: 'You do not have edit privilege of the channel.', code: 'ACCESS_DENIED', - id: '1fb7cb09-d46a-4fdf-b8df-057788cce513' + id: '1fb7cb09-d46a-4fdf-b8df-057788cce513', }, noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'e86c14a4-0da2-4032-8df3-e737a04c7f3b' + id: 'e86c14a4-0da2-4032-8df3-e737a04c7f3b', }, - } + }, }; export default define(meta, async (ps, me) => { @@ -74,7 +74,7 @@ export default define(meta, async (ps, me) => { if (ps.bannerId != null) { banner = await DriveFiles.findOne({ id: ps.bannerId, - userId: me.id + userId: me.id, }); if (banner == null) { diff --git a/packages/backend/src/server/api/endpoints/charts/instance.ts b/packages/backend/src/server/api/endpoints/charts/instance.ts index 1835023188..4e96304d8c 100644 --- a/packages/backend/src/server/api/endpoints/charts/instance.ts +++ b/packages/backend/src/server/api/endpoints/charts/instance.ts @@ -23,7 +23,7 @@ export const meta = { host: { validator: $.str, - } + }, }, res: convertLog(instanceChart.schema), diff --git a/packages/backend/src/server/api/endpoints/charts/user/drive.ts b/packages/backend/src/server/api/endpoints/charts/user/drive.ts index f2770e2df8..4fc12b3306 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/drive.ts @@ -24,7 +24,7 @@ export const meta = { userId: { validator: $.type(ID), - } + }, }, res: convertLog(perUserDriveChart.schema), diff --git a/packages/backend/src/server/api/endpoints/charts/user/following.ts b/packages/backend/src/server/api/endpoints/charts/user/following.ts index 8c97b63e89..9207760a3c 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/following.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/following.ts @@ -24,7 +24,7 @@ export const meta = { userId: { validator: $.type(ID), - } + }, }, res: convertLog(perUserFollowingChart.schema), diff --git a/packages/backend/src/server/api/endpoints/charts/user/notes.ts b/packages/backend/src/server/api/endpoints/charts/user/notes.ts index 0d5f5a8b6a..f543920572 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/notes.ts @@ -24,7 +24,7 @@ export const meta = { userId: { validator: $.type(ID), - } + }, }, res: convertLog(perUserNotesChart.schema), diff --git a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts index 3cabe40d56..4ceb79f7f8 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts @@ -24,7 +24,7 @@ export const meta = { userId: { validator: $.type(ID), - } + }, }, res: convertLog(perUserReactionsChart.schema), diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index 79d7b8adde..99312a71b9 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -27,27 +27,27 @@ export const meta = { noSuchClip: { message: 'No such clip.', code: 'NO_SUCH_CLIP', - id: 'd6e76cc0-a1b5-4c7c-a287-73fa9c716dcf' + id: 'd6e76cc0-a1b5-4c7c-a287-73fa9c716dcf', }, noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'fc8c0b49-c7a3-4664-a0a6-b418d386bb8b' + id: 'fc8c0b49-c7a3-4664-a0a6-b418d386bb8b', }, alreadyClipped: { message: 'The note has already been clipped.', code: 'ALREADY_CLIPPED', - id: '734806c4-542c-463a-9311-15c512803965' + id: '734806c4-542c-463a-9311-15c512803965', }, - } + }, }; export default define(meta, async (ps, user) => { const clip = await Clips.findOne({ id: ps.clipId, - userId: user.id + userId: user.id, }); if (clip == null) { @@ -61,7 +61,7 @@ export default define(meta, async (ps, user) => { const exist = await ClipNotes.findOne({ noteId: note.id, - clipId: clip.id + clipId: clip.id, }); if (exist != null) { @@ -71,6 +71,6 @@ export default define(meta, async (ps, user) => { await ClipNotes.insert({ id: genId(), noteId: note.id, - clipId: clip.id + clipId: clip.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index 02d2773709..cb4ff56abd 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -12,23 +12,23 @@ export const meta = { params: { name: { - validator: $.str.range(1, 100) + validator: $.str.range(1, 100), }, isPublic: { - validator: $.optional.bool + validator: $.optional.bool, }, description: { - validator: $.optional.nullable.str.range(1, 2048) - } + validator: $.optional.nullable.str.range(1, 2048), + }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Clip' - } + ref: 'Clip', + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index ca489af3bf..9ec6bc7eac 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -14,22 +14,22 @@ export const meta = { params: { clipId: { validator: $.type(ID), - } + }, }, errors: { noSuchClip: { message: 'No such clip.', code: 'NO_SUCH_CLIP', - id: '70ca08ba-6865-4630-b6fb-8494759aa754' - } - } + id: '70ca08ba-6865-4630-b6fb-8494759aa754', + }, + }, }; export default define(meta, async (ps, user) => { const clip = await Clips.findOne({ id: ps.clipId, - userId: user.id + userId: user.id, }); if (clip == null) { diff --git a/packages/backend/src/server/api/endpoints/clips/list.ts b/packages/backend/src/server/api/endpoints/clips/list.ts index 1f6db9b979..3b32c02899 100644 --- a/packages/backend/src/server/api/endpoints/clips/list.ts +++ b/packages/backend/src/server/api/endpoints/clips/list.ts @@ -14,9 +14,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Clip' - } - } + ref: 'Clip', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index 5a9fed52fa..90ddd66a1f 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -22,7 +22,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -38,8 +38,8 @@ export const meta = { noSuchClip: { message: 'No such clip.', code: 'NO_SUCH_CLIP', - id: '1d7645e6-2b6d-4635-b0fe-fe22b0e72e00' - } + id: '1d7645e6-2b6d-4635-b0fe-fe22b0e72e00', + }, }, res: { @@ -48,9 +48,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Note' - } - } + ref: 'Note', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/clips/show.ts b/packages/backend/src/server/api/endpoints/clips/show.ts index 8f245cd18e..8e9409fadd 100644 --- a/packages/backend/src/server/api/endpoints/clips/show.ts +++ b/packages/backend/src/server/api/endpoints/clips/show.ts @@ -21,15 +21,15 @@ export const meta = { noSuchClip: { message: 'No such clip.', code: 'NO_SUCH_CLIP', - id: 'c3c5fe33-d62c-44d2-9ea5-d997703f5c20' + id: 'c3c5fe33-d62c-44d2-9ea5-d997703f5c20', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Clip' - } + ref: 'Clip', + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index 7f645560bb..9cf12499af 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -21,34 +21,34 @@ export const meta = { }, isPublic: { - validator: $.optional.bool + validator: $.optional.bool, }, description: { - validator: $.optional.nullable.str.range(1, 2048) - } + validator: $.optional.nullable.str.range(1, 2048), + }, }, errors: { noSuchClip: { message: 'No such clip.', code: 'NO_SUCH_CLIP', - id: 'b4d92d70-b216-46fa-9a3f-a8c811699257' + id: 'b4d92d70-b216-46fa-9a3f-a8c811699257', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Clip' - } + ref: 'Clip', + }, }; export default define(meta, async (ps, user) => { // Fetch the clip const clip = await Clips.findOne({ id: ps.clipId, - userId: user.id + userId: user.id, }); if (clip == null) { diff --git a/packages/backend/src/server/api/endpoints/drive.ts b/packages/backend/src/server/api/endpoints/drive.ts index 2974ccfab9..b9741ba875 100644 --- a/packages/backend/src/server/api/endpoints/drive.ts +++ b/packages/backend/src/server/api/endpoints/drive.ts @@ -20,9 +20,9 @@ export const meta = { usage: { type: 'number' as const, optional: false as const, nullable: false as const, - } - } - } + }, + }, + }, }; export default define(meta, async (ps, user) => { @@ -33,6 +33,6 @@ export default define(meta, async (ps, user) => { return { capacity: 1024 * 1024 * instance.localDriveCapacityMb, - usage: usage + usage: usage, }; }); diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index 95435e1e43..00ebb51e30 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -31,8 +31,8 @@ export const meta = { }, type: { - validator: $.optional.nullable.str.match(/^[a-zA-Z\/\-*]+$/) - } + validator: $.optional.nullable.str.match(/^[a-zA-Z\/\-*]+$/), + }, }, res: { @@ -42,7 +42,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFile', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index eec7d7877e..c8317c1cc8 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -14,7 +14,7 @@ export const meta = { params: { fileId: { validator: $.type(ID), - } + }, }, res: { @@ -24,7 +24,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { @@ -32,8 +32,8 @@ export const meta = { message: 'No such file.', code: 'NO_SUCH_FILE', id: 'c118ece3-2e4b-4296-99d1-51756e32d232', - } - } + }, + }, }; export default define(meta, async (ps, user) => { @@ -52,6 +52,6 @@ export default define(meta, async (ps, user) => { .getMany(); return await Notes.packMany(notes, user, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts index 2c36078421..a6db160d2f 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts @@ -12,7 +12,7 @@ export const meta = { params: { md5: { validator: $.str, - } + }, }, res: { diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index 89755d9498..5523ae1967 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -14,7 +14,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 120 + max: 120, }, requireFile: true, @@ -42,7 +42,7 @@ export const meta = { validator: $.optional.either($.bool, $.str), default: false, transform: (v: any): boolean => v === true || v === 'true', - } + }, }, res: { @@ -55,9 +55,9 @@ export const meta = { invalidFileName: { message: 'Invalid file name.', code: 'INVALID_FILE_NAME', - id: 'f449b209-0c60-4e51-84d5-29486263bfd4' - } - } + id: 'f449b209-0c60-4e51-84d5-29486263bfd4', + }, + }, }; export default define(meta, async (ps, user, _, file, cleanup) => { diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 038325694d..3a8e4b11f4 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -16,22 +16,22 @@ export const meta = { params: { fileId: { validator: $.type(ID), - } + }, }, errors: { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: '908939ec-e52b-4458-b395-1025195cea58' + id: '908939ec-e52b-4458-b395-1025195cea58', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '5eb8d909-2540-4970-90b8-dd6f86088121' + id: '5eb8d909-2540-4970-90b8-dd6f86088121', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts index 5fea7bbbb0..16717149ac 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -12,7 +12,7 @@ export const meta = { params: { md5: { validator: $.str, - } + }, }, res: { @@ -22,7 +22,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFile', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/drive/files/find.ts b/packages/backend/src/server/api/endpoints/drive/files/find.ts index dd419f4c04..108e08593a 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find.ts @@ -12,7 +12,7 @@ export const meta = { params: { name: { - validator: $.str + validator: $.str, }, folderId: { @@ -28,7 +28,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFile', - } + }, }, }; @@ -36,7 +36,7 @@ export default define(meta, async (ps, user) => { const files = await DriveFiles.find({ name: ps.name, userId: user.id, - folderId: ps.folderId + folderId: ps.folderId, }); return await Promise.all(files.map(file => DriveFiles.pack(file, { self: true }))); diff --git a/packages/backend/src/server/api/endpoints/drive/files/show.ts b/packages/backend/src/server/api/endpoints/drive/files/show.ts index a96ebaa123..96f8e5c03a 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/show.ts @@ -19,7 +19,7 @@ export const meta = { url: { validator: $.optional.str, - } + }, }, res: { @@ -32,21 +32,21 @@ export const meta = { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: '067bc436-2718-4795-b0fb-ecbe43949e31' + id: '067bc436-2718-4795-b0fb-ecbe43949e31', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '25b73c73-68b1-41d0-bad1-381cfdf6579f' + id: '25b73c73-68b1-41d0-bad1-381cfdf6579f', }, fileIdOrUrlRequired: { message: 'fileId or url required.', code: 'INVALID_PARAM', - id: '89674805-722c-440c-8d88-5641830dc3e4' - } - } + id: '89674805-722c-440c-8d88-5641830dc3e4', + }, + }, }; export default define(meta, async (ps, user) => { @@ -57,11 +57,11 @@ export default define(meta, async (ps, user) => { } else if (ps.url) { file = await DriveFiles.findOne({ where: [{ - url: ps.url + url: ps.url, }, { - webpublicUrl: ps.url + webpublicUrl: ps.url, }, { - thumbnailUrl: ps.url + thumbnailUrl: ps.url, }], }); } else { @@ -79,6 +79,6 @@ export default define(meta, async (ps, user) => { return await DriveFiles.pack(file, { detail: true, withUser: true, - self: true + self: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index f277a9c3dc..04b2db9cf4 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -36,34 +36,34 @@ export const meta = { comment: { validator: $.optional.nullable.str.max(DB_MAX_IMAGE_COMMENT_LENGTH), default: undefined as any, - } + }, }, errors: { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'e7778c7e-3af9-49cd-9690-6dbc3e6c972d' + id: 'e7778c7e-3af9-49cd-9690-6dbc3e6c972d', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '01a53b27-82fc-445b-a0c1-b558465a8ed2' + id: '01a53b27-82fc-445b-a0c1-b558465a8ed2', }, noSuchFolder: { message: 'No such folder.', code: 'NO_SUCH_FOLDER', - id: 'ea8fb7a5-af77-4a08-b608-c0218176cd73' + id: 'ea8fb7a5-af77-4a08-b608-c0218176cd73', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'DriveFile' - } + ref: 'DriveFile', + }, }; export default define(meta, async (ps, user) => { @@ -89,7 +89,7 @@ export default define(meta, async (ps, user) => { } else { const folder = await DriveFolders.findOne({ id: ps.folderId, - userId: user.id + userId: user.id, }); if (folder == null) { @@ -104,7 +104,7 @@ export default define(meta, async (ps, user) => { name: file.name, comment: file.comment, folderId: file.folderId, - isSensitive: file.isSensitive + isSensitive: file.isSensitive, }); const fileObj = await DriveFiles.pack(file, { self: true }); diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index adb5126fbe..8a2fbc36b5 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -12,7 +12,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 60 + max: 60, }, requireCredential: true as const, @@ -48,8 +48,8 @@ export const meta = { force: { validator: $.optional.bool, default: false, - } - } + }, + }, }; export default define(meta, async (ps, user) => { @@ -57,7 +57,7 @@ export default define(meta, async (ps, user) => { DriveFiles.pack(file, { self: true }).then(packedFile => { publishMainStream(user.id, 'urlUploadFinished', { marker: ps.marker, - file: packedFile + file: packedFile, }); }); }); diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index 6f16878b13..cd2d1743c8 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -28,7 +28,7 @@ export const meta = { folderId: { validator: $.optional.nullable.type(ID), default: null, - } + }, }, res: { @@ -38,7 +38,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFolder', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index 80f96bd641..9ae59d4b49 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -21,22 +21,22 @@ export const meta = { parentId: { validator: $.optional.nullable.type(ID), - } + }, }, errors: { noSuchFolder: { message: 'No such folder.', code: 'NO_SUCH_FOLDER', - id: '53326628-a00d-40a6-a3cd-8975105c0f95' + id: '53326628-a00d-40a6-a3cd-8975105c0f95', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'DriveFolder' - } + ref: 'DriveFolder', + }, }; export default define(meta, async (ps, user) => { @@ -46,7 +46,7 @@ export default define(meta, async (ps, user) => { // Fetch parent folder parent = await DriveFolders.findOne({ id: ps.parentId, - userId: user.id + userId: user.id, }); if (parent == null) { @@ -60,7 +60,7 @@ export default define(meta, async (ps, user) => { createdAt: new Date(), name: ps.name, parentId: parent !== null ? parent.id : null, - userId: user.id + userId: user.id, }).then(x => DriveFolders.findOneOrFail(x.identifiers[0])); const folderObj = await DriveFolders.pack(folder); diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index 38b4aef103..bfd3361e76 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -15,29 +15,29 @@ export const meta = { params: { folderId: { validator: $.type(ID), - } + }, }, errors: { noSuchFolder: { message: 'No such folder.', code: 'NO_SUCH_FOLDER', - id: '1069098f-c281-440f-b085-f9932edbe091' + id: '1069098f-c281-440f-b085-f9932edbe091', }, hasChildFilesOrFolders: { message: 'This folder has child files or folders.', code: 'HAS_CHILD_FILES_OR_FOLDERS', - id: 'b0fc8a17-963c-405d-bfbc-859a487295e1' + id: 'b0fc8a17-963c-405d-bfbc-859a487295e1', }, - } + }, }; export default define(meta, async (ps, user) => { // Get folder const folder = await DriveFolders.findOne({ id: ps.folderId, - userId: user.id + userId: user.id, }); if (folder == null) { @@ -46,7 +46,7 @@ export default define(meta, async (ps, user) => { const [childFoldersCount, childFilesCount] = await Promise.all([ DriveFolders.count({ parentId: folder.id }), - DriveFiles.count({ folderId: folder.id }) + DriveFiles.count({ folderId: folder.id }), ]); if (childFoldersCount !== 0 || childFilesCount !== 0) { diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index a6c5a49988..872eabef98 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/find.ts @@ -12,7 +12,7 @@ export const meta = { params: { name: { - validator: $.str + validator: $.str, }, parentId: { @@ -28,7 +28,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFolder', - } + }, }, }; @@ -36,7 +36,7 @@ export default define(meta, async (ps, user) => { const folders = await DriveFolders.find({ name: ps.name, userId: user.id, - parentId: ps.parentId + parentId: ps.parentId, }); return await Promise.all(folders.map(folder => DriveFolders.pack(folder))); diff --git a/packages/backend/src/server/api/endpoints/drive/folders/show.ts b/packages/backend/src/server/api/endpoints/drive/folders/show.ts index e907a24f05..63b5bc9e77 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/show.ts @@ -14,7 +14,7 @@ export const meta = { params: { folderId: { validator: $.type(ID), - } + }, }, res: { @@ -27,16 +27,16 @@ export const meta = { noSuchFolder: { message: 'No such folder.', code: 'NO_SUCH_FOLDER', - id: 'd74ab9eb-bb09-4bba-bf24-fb58f761e1e9' + id: 'd74ab9eb-bb09-4bba-bf24-fb58f761e1e9', }, - } + }, }; export default define(meta, async (ps, user) => { // Get folder const folder = await DriveFolders.findOne({ id: ps.folderId, - userId: user.id + userId: user.id, }); if (folder == null) { @@ -44,6 +44,6 @@ export default define(meta, async (ps, user) => { } return await DriveFolders.pack(folder, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index 612252e6df..e547808866 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -23,41 +23,41 @@ export const meta = { parentId: { validator: $.optional.nullable.type(ID), - } + }, }, errors: { noSuchFolder: { message: 'No such folder.', code: 'NO_SUCH_FOLDER', - id: 'f7974dac-2c0d-4a27-926e-23583b28e98e' + id: 'f7974dac-2c0d-4a27-926e-23583b28e98e', }, noSuchParentFolder: { message: 'No such parent folder.', code: 'NO_SUCH_PARENT_FOLDER', - id: 'ce104e3a-faaf-49d5-b459-10ff0cbbcaa1' + id: 'ce104e3a-faaf-49d5-b459-10ff0cbbcaa1', }, recursiveNesting: { message: 'It can not be structured like nesting folders recursively.', code: 'NO_SUCH_PARENT_FOLDER', - id: 'ce104e3a-faaf-49d5-b459-10ff0cbbcaa1' + id: 'ce104e3a-faaf-49d5-b459-10ff0cbbcaa1', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'DriveFolder' - } + ref: 'DriveFolder', + }, }; export default define(meta, async (ps, user) => { // Fetch folder const folder = await DriveFolders.findOne({ id: ps.folderId, - userId: user.id + userId: user.id, }); if (folder == null) { @@ -75,7 +75,7 @@ export default define(meta, async (ps, user) => { // Get parent folder const parent = await DriveFolders.findOne({ id: ps.parentId, - userId: user.id + userId: user.id, }); if (parent == null) { @@ -86,7 +86,7 @@ export default define(meta, async (ps, user) => { async function checkCircle(folderId: any): Promise<boolean> { // Fetch folder const folder2 = await DriveFolders.findOne({ - id: folderId + id: folderId, }); if (folder2!.id === folder!.id) { @@ -111,7 +111,7 @@ export default define(meta, async (ps, user) => { // Update DriveFolders.update(folder.id, { name: folder.name, - parentId: folder.parentId + parentId: folder.parentId, }); const folderObj = await DriveFolders.pack(folder); diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 141e02f748..e3031f75b2 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -26,8 +26,8 @@ export const meta = { }, type: { - validator: $.optional.str.match(/^[a-zA-Z\/\-*]+$/) - } + validator: $.optional.str.match(/^[a-zA-Z\/\-*]+$/), + }, }, res: { @@ -37,7 +37,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFile', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/email-address/available.ts b/packages/backend/src/server/api/endpoints/email-address/available.ts index f6fccd59b0..f2254e1481 100644 --- a/packages/backend/src/server/api/endpoints/email-address/available.ts +++ b/packages/backend/src/server/api/endpoints/email-address/available.ts @@ -9,8 +9,8 @@ export const meta = { params: { emailAddress: { - validator: $.str - } + validator: $.str, + }, }, res: { @@ -25,8 +25,8 @@ export const meta = { type: 'string' as const, optional: false as const, nullable: true as const, }, - } - } + }, + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/endpoint.ts b/packages/backend/src/server/api/endpoints/endpoint.ts index 1a04d8bee8..eacee689dc 100644 --- a/packages/backend/src/server/api/endpoints/endpoint.ts +++ b/packages/backend/src/server/api/endpoints/endpoint.ts @@ -10,7 +10,7 @@ export const meta = { params: { endpoint: { validator: $.str, - } + }, }, }; @@ -20,7 +20,7 @@ export default define(meta, async (ps) => { return { params: Object.entries(ep.meta.params || {}).map(([k, v]) => ({ name: k, - type: v.validator.name === 'ID' ? 'String' : v.validator.name - })) + type: v.validator.name === 'ID' ? 'String' : v.validator.name, + })), }; }); diff --git a/packages/backend/src/server/api/endpoints/endpoints.ts b/packages/backend/src/server/api/endpoints/endpoints.ts index f7b9757d8d..6d4588383d 100644 --- a/packages/backend/src/server/api/endpoints/endpoints.ts +++ b/packages/backend/src/server/api/endpoints/endpoints.ts @@ -14,15 +14,15 @@ export const meta = { optional: false as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, example: [ 'admin/abuse-user-reports', 'admin/accounts/create', 'admin/announcements/create', - '...' - ] - } + '...', + ], + }, }; export default define(meta, async () => { diff --git a/packages/backend/src/server/api/endpoints/federation/dns.ts b/packages/backend/src/server/api/endpoints/federation/dns.ts index 7ba566301a..19e3ef8055 100644 --- a/packages/backend/src/server/api/endpoints/federation/dns.ts +++ b/packages/backend/src/server/api/endpoints/federation/dns.ts @@ -14,8 +14,8 @@ export const meta = { params: { host: { - validator: $.str - } + validator: $.str, + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index 655e7b7b9a..9cb4082bbf 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -11,7 +11,7 @@ export const meta = { params: { host: { - validator: $.str + validator: $.str, }, sinceId: { @@ -24,7 +24,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -35,7 +35,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Following', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 5b283581a6..4a42550f93 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -11,7 +11,7 @@ export const meta = { params: { host: { - validator: $.str + validator: $.str, }, sinceId: { @@ -24,7 +24,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -35,7 +35,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Following', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index cf5e44ebd5..50d9ff3fd7 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -40,17 +40,17 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 30 + default: 30, }, offset: { validator: $.optional.num.min(0), - default: 0 + default: 0, }, sort: { validator: $.optional.str, - } + }, }, res: { @@ -59,9 +59,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'FederationInstance' - } - } + ref: 'FederationInstance', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index f8352aefb3..9d5d9bc9f8 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -10,15 +10,15 @@ export const meta = { params: { host: { - validator: $.str - } + validator: $.str, + }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'FederationInstance' - } + ref: 'FederationInstance', + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index 580c3cb3d9..2ba09b1361 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -13,7 +13,7 @@ export const meta = { userId: { validator: $.type(ID), }, - } + }, }; export default define(meta, async (ps) => { diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index 0e35df3e1c..730dbd74c3 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -11,7 +11,7 @@ export const meta = { params: { host: { - validator: $.str + validator: $.str, }, sinceId: { @@ -24,7 +24,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -35,7 +35,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/following/create.ts b/packages/backend/src/server/api/endpoints/following/create.ts index 92e86bf6b2..096b1f6055 100644 --- a/packages/backend/src/server/api/endpoints/following/create.ts +++ b/packages/backend/src/server/api/endpoints/following/create.ts @@ -12,7 +12,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 100 + max: 100, }, requireCredential: true as const, @@ -22,46 +22,46 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: 'fcd2eef9-a9b2-4c4f-8624-038099e90aa5' + id: 'fcd2eef9-a9b2-4c4f-8624-038099e90aa5', }, followeeIsYourself: { message: 'Followee is yourself.', code: 'FOLLOWEE_IS_YOURSELF', - id: '26fbe7bb-a331-4857-af17-205b426669a9' + id: '26fbe7bb-a331-4857-af17-205b426669a9', }, alreadyFollowing: { message: 'You are already following that user.', code: 'ALREADY_FOLLOWING', - id: '35387507-38c7-4cb9-9197-300b93783fa0' + id: '35387507-38c7-4cb9-9197-300b93783fa0', }, blocking: { message: 'You are blocking that user.', code: 'BLOCKING', - id: '4e2206ec-aa4f-4960-b865-6c23ac38e2d9' + id: '4e2206ec-aa4f-4960-b865-6c23ac38e2d9', }, blocked: { message: 'You are blocked by that user.', code: 'BLOCKED', - id: 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0' + id: 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { @@ -81,7 +81,7 @@ export default define(meta, async (ps, user) => { // Check if already following const exist = await Followings.findOne({ followerId: follower.id, - followeeId: followee.id + followeeId: followee.id, }); if (exist != null) { diff --git a/packages/backend/src/server/api/endpoints/following/delete.ts b/packages/backend/src/server/api/endpoints/following/delete.ts index 030d30c9b5..5a0e44ad0b 100644 --- a/packages/backend/src/server/api/endpoints/following/delete.ts +++ b/packages/backend/src/server/api/endpoints/following/delete.ts @@ -12,7 +12,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 100 + max: 100, }, requireCredential: true as const, @@ -22,34 +22,34 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '5b12c78d-2b28-4dca-99d2-f56139b42ff8' + id: '5b12c78d-2b28-4dca-99d2-f56139b42ff8', }, followeeIsYourself: { message: 'Followee is yourself.', code: 'FOLLOWEE_IS_YOURSELF', - id: 'd9e400b9-36b0-4808-b1d8-79e707f1296c' + id: 'd9e400b9-36b0-4808-b1d8-79e707f1296c', }, notFollowing: { message: 'You are not following that user.', code: 'NOT_FOLLOWING', - id: '5dbf82f5-c92b-40b1-87d1-6c8c0741fd09' + id: '5dbf82f5-c92b-40b1-87d1-6c8c0741fd09', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { @@ -69,7 +69,7 @@ export default define(meta, async (ps, user) => { // Check not following const exist = await Followings.findOne({ followerId: follower.id, - followeeId: followee.id + followeeId: followee.id, }); if (exist == null) { diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index c0e9df3652..050199bfaa 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -12,7 +12,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 100 + max: 100, }, requireCredential: true as const, @@ -22,34 +22,34 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '5b12c78d-2b28-4dca-99d2-f56139b42ff8' + id: '5b12c78d-2b28-4dca-99d2-f56139b42ff8', }, followerIsYourself: { message: 'Follower is yourself.', code: 'FOLLOWER_IS_YOURSELF', - id: '07dc03b9-03da-422d-885b-438313707662' + id: '07dc03b9-03da-422d-885b-438313707662', }, notFollowing: { message: 'The other use is not following you.', code: 'NOT_FOLLOWING', - id: '5dbf82f5-c92b-40b1-87d1-6c8c0741fd09' + id: '5dbf82f5-c92b-40b1-87d1-6c8c0741fd09', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { @@ -69,7 +69,7 @@ export default define(meta, async (ps, user) => { // Check not following const exist = await Followings.findOne({ followerId: follower.id, - followeeId: followee.id + followeeId: followee.id, }); if (exist == null) { diff --git a/packages/backend/src/server/api/endpoints/following/requests/accept.ts b/packages/backend/src/server/api/endpoints/following/requests/accept.ts index af39ea1d90..9c07248568 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/accept.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/accept.ts @@ -15,21 +15,21 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '66ce1645-d66c-46bb-8b79-96739af885bd' + id: '66ce1645-d66c-46bb-8b79-96739af885bd', }, noFollowRequest: { message: 'No follow request.', code: 'NO_FOLLOW_REQUEST', - id: 'bcde4f8b-0913-4614-8881-614e522fb041' + id: 'bcde4f8b-0913-4614-8881-614e522fb041', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index b69c9d2fe1..d65aa436a0 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts @@ -16,28 +16,28 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '4e68c551-fc4c-4e46-bb41-7d4a37bf9dab' + id: '4e68c551-fc4c-4e46-bb41-7d4a37bf9dab', }, followRequestNotFound: { message: 'Follow request not found.', code: 'FOLLOW_REQUEST_NOT_FOUND', - id: '089b125b-d338-482a-9a09-e2622ac9f8d4' + id: '089b125b-d338-482a-9a09-e2622ac9f8d4', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index 84440ccac7..2dadd0d60c 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -18,26 +18,26 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, follower: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' + ref: 'User', }, followee: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } - } - } - } + ref: 'User', + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { const reqs = await FollowRequests.find({ - followeeId: user.id + followeeId: user.id, }); return await Promise.all(reqs.map(req => FollowRequests.pack(req))); diff --git a/packages/backend/src/server/api/endpoints/following/requests/reject.ts b/packages/backend/src/server/api/endpoints/following/requests/reject.ts index 30d0e094c3..c385b32385 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/reject.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/reject.ts @@ -15,16 +15,16 @@ export const meta = { params: { userId: { validator: $.type(ID), - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: 'abc2ffa6-25b2-4380-ba99-321ff3a94555' + id: 'abc2ffa6-25b2-4380-ba99-321ff3a94555', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index 30ef8cedec..dc86cf40ba 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -13,7 +13,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'GalleryPost', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 18449b9654..ee3fe51ebf 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -13,7 +13,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'GalleryPost', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index 53d3236d2d..90bd2d959f 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -10,7 +10,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -29,7 +29,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'GalleryPost', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index 34af72695d..dae6e27ddb 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -17,7 +17,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 300 + max: 300, }, params: { @@ -47,14 +47,14 @@ export const meta = { errors: { - } + }, }; export default define(meta, async (ps, user) => { const files = (await Promise.all(ps.fileIds.map(fileId => DriveFiles.findOne({ id: fileId, - userId: user.id + userId: user.id, }) ))).filter((file): file is DriveFile => file != null); @@ -70,7 +70,7 @@ export default define(meta, async (ps, user) => { description: ps.description, userId: user.id, isSensitive: ps.isSensitive, - fileIds: files.map(file => file.id) + fileIds: files.map(file => file.id), })).then(x => GalleryPosts.findOneOrFail(x.identifiers[0])); return await GalleryPosts.pack(post, user); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index e5b7c07f2f..e43c12a4c1 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -21,9 +21,9 @@ export const meta = { noSuchPost: { message: 'No such post.', code: 'NO_SUCH_POST', - id: 'ae52f367-4bd7-4ecd-afc6-5672fff427f5' + id: 'ae52f367-4bd7-4ecd-afc6-5672fff427f5', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index 81a25c0ad1..d355d1e312 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -15,28 +15,28 @@ export const meta = { params: { postId: { validator: $.type(ID), - } + }, }, errors: { noSuchPost: { message: 'No such post.', code: 'NO_SUCH_POST', - id: '56c06af3-1287-442f-9701-c93f7c4a62ff' + id: '56c06af3-1287-442f-9701-c93f7c4a62ff', }, yourPost: { message: 'You cannot like your post.', code: 'YOUR_POST', - id: 'f78f1511-5ebc-4478-a888-1198d752da68' + id: 'f78f1511-5ebc-4478-a888-1198d752da68', }, alreadyLiked: { message: 'The post has already been liked.', code: 'ALREADY_LIKED', - id: '40e9ed56-a59c-473a-bf3f-f289c54fb5a7' + id: '40e9ed56-a59c-473a-bf3f-f289c54fb5a7', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -52,7 +52,7 @@ export default define(meta, async (ps, user) => { // if already liked const exist = await GalleryLikes.findOne({ postId: post.id, - userId: user.id + userId: user.id, }); if (exist != null) { @@ -64,7 +64,7 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), postId: post.id, - userId: user.id + userId: user.id, }); GalleryPosts.increment({ id: post.id }, 'likedCount', 1); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts index 93852a5f8d..7e620b2c48 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts @@ -19,15 +19,15 @@ export const meta = { noSuchPost: { message: 'No such post.', code: 'NO_SUCH_POST', - id: '1137bf14-c5b0-4604-85bb-5b5371b1cd45' + id: '1137bf14-c5b0-4604-85bb-5b5371b1cd45', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'GalleryPost' - } + ref: 'GalleryPost', + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index 0347cdf79e..323e7c4828 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -14,22 +14,22 @@ export const meta = { params: { postId: { validator: $.type(ID), - } + }, }, errors: { noSuchPost: { message: 'No such post.', code: 'NO_SUCH_POST', - id: 'c32e6dd0-b555-4413-925e-b3757d19ed84' + id: 'c32e6dd0-b555-4413-925e-b3757d19ed84', }, notLiked: { message: 'You have not liked that post.', code: 'NOT_LIKED', - id: 'e3e8e06e-be37-41f7-a5b4-87a8250288f0' + id: 'e3e8e06e-be37-41f7-a5b4-87a8250288f0', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -40,7 +40,7 @@ export default define(meta, async (ps, user) => { const exist = await GalleryLikes.findOne({ postId: post.id, - userId: user.id + userId: user.id, }); if (exist == null) { diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index f94606acf2..7cd694e804 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -16,7 +16,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 300 + max: 300, }, params: { @@ -50,14 +50,14 @@ export const meta = { errors: { - } + }, }; export default define(meta, async (ps, user) => { const files = (await Promise.all(ps.fileIds.map(fileId => DriveFiles.findOne({ id: fileId, - userId: user.id + userId: user.id, }) ))).filter((file): file is DriveFile => file != null); @@ -73,7 +73,7 @@ export default define(meta, async (ps, user) => { title: ps.title, description: ps.description, isSensitive: ps.isSensitive, - fileIds: files.map(file => file.id) + fileIds: files.map(file => file.id), }); const post = await GalleryPosts.findOneOrFail(ps.postId); diff --git a/packages/backend/src/server/api/endpoints/games/reversi/games.ts b/packages/backend/src/server/api/endpoints/games/reversi/games.ts index 4db9ecb69f..f77f11942c 100644 --- a/packages/backend/src/server/api/endpoints/games/reversi/games.ts +++ b/packages/backend/src/server/api/endpoints/games/reversi/games.ts @@ -11,7 +11,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -24,8 +24,8 @@ export const meta = { my: { validator: $.optional.bool, - default: false - } + default: false, + }, }, res: { @@ -38,86 +38,86 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, createdAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, startedAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, isStarted: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isEnded: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, form1: { type: 'any' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, form2: { type: 'any' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, user1Accepted: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, user2Accepted: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, user1Id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, user2Id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, user1: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' + ref: 'User', }, user2: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' + ref: 'User', }, winnerId: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'id' + format: 'id', }, winner: { type: 'object' as const, optional: false as const, nullable: true as const, - ref: 'User' + ref: 'User', }, surrendered: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'id' + format: 'id', }, black: { type: 'number' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, bw: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isLlotheo: { type: 'boolean' as const, @@ -125,15 +125,15 @@ export const meta = { }, canPutEverywhere: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, loopedBoard: { type: 'boolean' as const, - optional: false as const, nullable: false as const - } - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { @@ -151,6 +151,6 @@ export default define(meta, async (ps, user) => { const games = await query.take(ps.limit!).getMany(); return await Promise.all(games.map((g) => ReversiGames.pack(g, user, { - detail: false + detail: false, }))); }); diff --git a/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts b/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts index 93afffdb1f..0476a4be9b 100644 --- a/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts +++ b/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts @@ -18,7 +18,7 @@ export const meta = { noSuchGame: { message: 'No such game.', code: 'NO_SUCH_GAME', - id: 'f13a03db-fae1-46c9-87f3-43c8165419e1' + id: 'f13a03db-fae1-46c9-87f3-43c8165419e1', }, }, @@ -32,86 +32,86 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, createdAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, startedAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, isStarted: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isEnded: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, form1: { type: 'any' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, form2: { type: 'any' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, user1Accepted: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, user2Accepted: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, user1Id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, user2Id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, user1: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' + ref: 'User', }, user2: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' + ref: 'User', }, winnerId: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'id' + format: 'id', }, winner: { type: 'object' as const, optional: false as const, nullable: true as const, - ref: 'User' + ref: 'User', }, surrendered: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'id' + format: 'id', }, black: { type: 'number' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, bw: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isLlotheo: { type: 'boolean' as const, @@ -119,27 +119,27 @@ export const meta = { }, canPutEverywhere: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, loopedBoard: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, board: { type: 'array' as const, optional: false as const, nullable: false as const, items: { type: 'any' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, turn: { type: 'any' as const, - optional: false as const, nullable: false as const - } - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { @@ -152,7 +152,7 @@ export default define(meta, async (ps, user) => { const o = new Reversi(game.map, { isLlotheo: game.isLlotheo, canPutEverywhere: game.canPutEverywhere, - loopedBoard: game.loopedBoard + loopedBoard: game.loopedBoard, }); for (const log of game.logs) { @@ -163,6 +163,6 @@ export default define(meta, async (ps, user) => { return Object.assign({ board: o.board, - turn: o.turn + turn: o.turn, }, packed); }); diff --git a/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts b/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts index 00d58b19e3..84b80c47a0 100644 --- a/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts +++ b/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts @@ -13,28 +13,28 @@ export const meta = { params: { gameId: { validator: $.type(ID), - } + }, }, errors: { noSuchGame: { message: 'No such game.', code: 'NO_SUCH_GAME', - id: 'ace0b11f-e0a6-4076-a30d-e8284c81b2df' + id: 'ace0b11f-e0a6-4076-a30d-e8284c81b2df', }, alreadyEnded: { message: 'That game has already ended.', code: 'ALREADY_ENDED', - id: '6c2ad4a6-cbf1-4a5b-b187-b772826cfc6d' + id: '6c2ad4a6-cbf1-4a5b-b187-b772826cfc6d', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '6e04164b-a992-4c93-8489-2123069973e1' + id: '6e04164b-a992-4c93-8489-2123069973e1', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -57,11 +57,11 @@ export default define(meta, async (ps, user) => { await ReversiGames.update(game.id, { surrendered: user.id, isEnded: true, - winnerId: winnerId + winnerId: winnerId, }); publishReversiGameStream(game.id, 'ended', { winnerId: winnerId, - game: await ReversiGames.pack(game.id, user) + game: await ReversiGames.pack(game.id, user), }); }); diff --git a/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts b/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts index c8629377b2..b859a2fc75 100644 --- a/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts +++ b/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts @@ -16,42 +16,42 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, createdAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, parentId: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, parent: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' + ref: 'User', }, childId: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, child: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } - } - } - } + ref: 'User', + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { // Find session const invitations = await ReversiMatchings.find({ - childId: user.id + childId: user.id, }); return await Promise.all(invitations.map((i) => ReversiMatchings.pack(i, user))); diff --git a/packages/backend/src/server/api/endpoints/games/reversi/match.ts b/packages/backend/src/server/api/endpoints/games/reversi/match.ts index 5ceb16c7d7..c66c5a4f75 100644 --- a/packages/backend/src/server/api/endpoints/games/reversi/match.ts +++ b/packages/backend/src/server/api/endpoints/games/reversi/match.ts @@ -25,15 +25,15 @@ export const meta = { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '0b4f0559-b484-4e31-9581-3f73cee89b28' + id: '0b4f0559-b484-4e31-9581-3f73cee89b28', }, isYourself: { message: 'Target user is yourself.', code: 'TARGET_IS_YOURSELF', - id: '96fd7bd6-d2bc-426c-a865-d055dcd2828e' + id: '96fd7bd6-d2bc-426c-a865-d055dcd2828e', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -45,7 +45,7 @@ export default define(meta, async (ps, user) => { // Find session const exist = await ReversiMatchings.findOne({ parentId: ps.userId, - childId: user.id + childId: user.id, }); if (exist) { @@ -65,13 +65,13 @@ export default define(meta, async (ps, user) => { logs: [], map: eighteight.data, bw: 'random', - isLlotheo: false + isLlotheo: false, } as Partial<ReversiGame>); publishReversiStream(exist.parentId, 'matched', await ReversiGames.pack(game, { id: exist.parentId })); const other = await ReversiMatchings.count({ - childId: user.id + childId: user.id, }); if (other == 0) { @@ -88,7 +88,7 @@ export default define(meta, async (ps, user) => { // 以前のセッションはすべて削除しておく await ReversiMatchings.delete({ - parentId: user.id + parentId: user.id, }); // セッションを作成 @@ -96,7 +96,7 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), parentId: user.id, - childId: child.id + childId: child.id, } as ReversiMatching); const packed = await ReversiMatchings.pack(matching, child); diff --git a/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts b/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts index e4a138bb87..8076b7c5d8 100644 --- a/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts +++ b/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts @@ -4,11 +4,11 @@ import { ReversiMatchings } from '@/models/index'; export const meta = { tags: ['games'], - requireCredential: true as const + requireCredential: true as const, }; export default define(meta, async (ps, user) => { await ReversiMatchings.delete({ - parentId: user.id + parentId: user.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/get-online-users-count.ts b/packages/backend/src/server/api/endpoints/get-online-users-count.ts index 5c80d588d3..0616431abc 100644 --- a/packages/backend/src/server/api/endpoints/get-online-users-count.ts +++ b/packages/backend/src/server/api/endpoints/get-online-users-count.ts @@ -9,15 +9,15 @@ export const meta = { requireCredential: false as const, params: { - } + }, }; export default define(meta, async () => { const count = await Users.count({ - lastActiveDate: MoreThan(new Date(Date.now() - USER_ONLINE_THRESHOLD)) + lastActiveDate: MoreThan(new Date(Date.now() - USER_ONLINE_THRESHOLD)), }); return { - count + count, }; }); diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 821016a50c..5f8bfee2df 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -10,22 +10,22 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, attachedToUserOnly: { validator: $.optional.bool, - default: false + default: false, }, attachedToLocalUserOnly: { validator: $.optional.bool, - default: false + default: false, }, attachedToRemoteUserOnly: { validator: $.optional.bool, - default: false + default: false, }, sort: { @@ -53,7 +53,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Hashtag', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index fd0cac3983..d7de1db557 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -20,7 +20,7 @@ export const meta = { offset: { validator: $.optional.num.min(0), default: 0, - } + }, }, res: { @@ -29,7 +29,7 @@ export const meta = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index f22edbfffd..9410aea389 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -12,7 +12,7 @@ export const meta = { params: { tag: { validator: $.str, - } + }, }, res: { @@ -25,9 +25,9 @@ export const meta = { noSuchHashtag: { message: 'No such hashtag.', code: 'NO_SUCH_HASHTAG', - id: '110ee688-193e-4a3a-9ecf-c167b2e6981e' - } - } + id: '110ee688-193e-4a3a-9ecf-c167b2e6981e', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index 3d67241ab6..deb8417ad6 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -42,15 +42,15 @@ export const meta = { items: { type: 'number' as const, optional: false as const, nullable: false as const, - } + }, }, usersCount: { type: 'number' as const, optional: false as const, nullable: false as const, - } - } - } - } + }, + }, + }, + }, }; export default define(meta, async () => { @@ -92,7 +92,7 @@ export default define(meta, async () => { } else { tags.push({ name: tag, - users: [note.userId] + users: [note.userId], }); } } @@ -139,7 +139,7 @@ export default define(meta, async () => { const stats = hots.map((tag, i) => ({ tag, chart: countsLog.map(counts => counts[i]), - usersCount: totalCounts[i] + usersCount: totalCounts[i], })); return stats; diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index 8c8cd1510b..69b17a19eb 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -15,7 +15,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sort: { @@ -32,9 +32,9 @@ export const meta = { state: { validator: $.optional.str.or([ 'all', - 'alive' + 'alive', ]), - default: 'all' + default: 'all', }, origin: { @@ -43,8 +43,8 @@ export const meta = { 'local', 'remote', ]), - default: 'local' - } + default: 'local', + }, }, res: { @@ -54,7 +54,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index 0568a962d8..2063a55a81 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -21,6 +21,6 @@ export default define(meta, async (ps, user, token) => { // ここで渡ってきている user はキャッシュされていて古い可能性もあるので id だけ渡す return await Users.pack(user.id, user, { detail: true, - includeSecrets: isSecure + includeSecrets: isSecure, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index 2bd2128cce..3b772386f3 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -10,9 +10,9 @@ export const meta = { params: { token: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, user) => { @@ -27,7 +27,7 @@ export default define(meta, async (ps, user) => { const verified = (speakeasy as any).totp.verify({ secret: profile.twoFactorTempSecret, encoding: 'base32', - token: token + token: token, }); if (!verified) { @@ -36,6 +36,6 @@ export default define(meta, async (ps, user) => { await UserProfiles.update(user.id, { twoFactorSecret: profile.twoFactorTempSecret, - twoFactorEnabled: true + twoFactorEnabled: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts index e06d0a9f68..f0045fb997 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts @@ -7,7 +7,7 @@ import { UserProfiles, UserSecurityKeys, AttestationChallenges, - Users + Users, } from '@/models/index'; import config from '@/config/index'; import { procedures, hash } from '../../../2fa'; @@ -22,21 +22,21 @@ export const meta = { params: { clientDataJSON: { - validator: $.str + validator: $.str, }, attestationObject: { - validator: $.str + validator: $.str, }, password: { - validator: $.str + validator: $.str, }, challengeId: { - validator: $.str + validator: $.str, }, name: { - validator: $.str - } - } + validator: $.str, + }, + }, }; const rpIdHashReal = hash(Buffer.from(config.hostname, 'utf-8')); @@ -99,7 +99,7 @@ export default define(meta, async (ps, user) => { clientDataHash: clientDataJSONHash, credentialId, publicKey, - rpIdHash + rpIdHash, }); if (!verificationData.valid) throw new Error('signature invalid'); @@ -107,7 +107,7 @@ export default define(meta, async (ps, user) => { userId: user.id, id: ps.challengeId, registrationChallenge: true, - challenge: hash(clientData.challenge).toString('hex') + challenge: hash(clientData.challenge).toString('hex'), }); if (!attestationChallenge) { @@ -116,7 +116,7 @@ export default define(meta, async (ps, user) => { await AttestationChallenges.delete({ userId: user.id, - id: ps.challengeId + id: ps.challengeId, }); // Expired challenge (> 5min old) @@ -134,17 +134,17 @@ export default define(meta, async (ps, user) => { id: credentialIdString, lastUsed: new Date(), name: ps.name, - publicKey: verificationData.publicKey.toString('hex') + publicKey: verificationData.publicKey.toString('hex'), }); // Publish meUpdated event publishMainStream(user.id, 'meUpdated', await Users.pack(user.id, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); return { id: credentialIdString, - name: ps.name + name: ps.name, }; }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts index 064828b638..dc2b66286b 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts @@ -9,13 +9,13 @@ export const meta = { params: { value: { - validator: $.boolean - } - } + validator: $.boolean, + }, + }, }; export default define(meta, async (ps, user) => { await UserProfiles.update(user.id, { - usePasswordLessLogin: ps.value + usePasswordLessLogin: ps.value, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts index 1b385a10ee..aa6c8fb1d5 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts @@ -16,9 +16,9 @@ export const meta = { params: { password: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, user) => { @@ -49,11 +49,11 @@ export default define(meta, async (ps, user) => { id: challengeId, challenge: hash(Buffer.from(challenge, 'utf-8')).toString('hex'), createdAt: new Date(), - registrationChallenge: true + registrationChallenge: true, }); return { challengeId, - challenge + challenge, }; }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index b03b98188a..347dec0f43 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -13,9 +13,9 @@ export const meta = { params: { password: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, user) => { @@ -30,11 +30,11 @@ export default define(meta, async (ps, user) => { // Generate user's secret key const secret = speakeasy.generateSecret({ - length: 32 + length: 32, }); await UserProfiles.update(user.id, { - twoFactorTempSecret: secret.base32 + twoFactorTempSecret: secret.base32, }); // Get the data URL of the authenticator URL @@ -42,13 +42,13 @@ export default define(meta, async (ps, user) => { secret: secret.base32, encoding: 'base32', label: user.username, - issuer: config.host + issuer: config.host, })); return { qr: dataUrl, secret: secret.base32, label: user.username, - issuer: config.host + issuer: config.host, }; }); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts index dea56301ab..05d63452f1 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts @@ -11,12 +11,12 @@ export const meta = { params: { password: { - validator: $.str + validator: $.str, }, credentialId: { - validator: $.str + validator: $.str, }, - } + }, }; export default define(meta, async (ps, user) => { @@ -32,13 +32,13 @@ export default define(meta, async (ps, user) => { // Make sure we only delete the user's own creds await UserSecurityKeys.delete({ userId: user.id, - id: ps.credentialId + id: ps.credentialId, }); // Publish meUpdated event publishMainStream(user.id, 'meUpdated', await Users.pack(user.id, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); return {}; diff --git a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts index af53033daa..a0d8b5906b 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts @@ -10,9 +10,9 @@ export const meta = { params: { password: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, user) => { @@ -27,6 +27,6 @@ export default define(meta, async (ps, user) => { await UserProfiles.update(user.id, { twoFactorSecret: null, - twoFactorEnabled: false + twoFactorEnabled: false, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/apps.ts b/packages/backend/src/server/api/endpoints/i/apps.ts index 994528e5c9..64986865b2 100644 --- a/packages/backend/src/server/api/endpoints/i/apps.ts +++ b/packages/backend/src/server/api/endpoints/i/apps.ts @@ -16,7 +16,7 @@ export const meta = { '-lastUsedAt', ]), }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts index 042fcd14e8..bfe20eb984 100644 --- a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts +++ b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts @@ -21,24 +21,24 @@ export const meta = { sort: { validator: $.optional.str.or('desc|asc'), default: 'desc', - } - } + }, + }, }; export default define(meta, async (ps, user) => { // Get tokens const tokens = await AccessTokens.find({ where: { - userId: user.id + userId: user.id, }, take: ps.limit!, skip: ps.offset, order: { - id: ps.sort == 'asc' ? 1 : -1 - } + id: ps.sort == 'asc' ? 1 : -1, + }, }); return await Promise.all(tokens.map(token => Apps.pack(token.appId, user, { - detail: true + detail: true, }))); }); diff --git a/packages/backend/src/server/api/endpoints/i/change-password.ts b/packages/backend/src/server/api/endpoints/i/change-password.ts index 7ea5f8c488..416eb6229f 100644 --- a/packages/backend/src/server/api/endpoints/i/change-password.ts +++ b/packages/backend/src/server/api/endpoints/i/change-password.ts @@ -10,13 +10,13 @@ export const meta = { params: { currentPassword: { - validator: $.str + validator: $.str, }, newPassword: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, user) => { @@ -34,6 +34,6 @@ export default define(meta, async (ps, user) => { const hash = await bcrypt.hash(ps.newPassword, salt); await UserProfiles.update(user.id, { - password: hash + password: hash, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index 10e5adf64a..13a8f79dfa 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -13,9 +13,9 @@ export const meta = { params: { password: { - validator: $.str + validator: $.str, }, - } + }, }; export default define(meta, async (ps, user) => { @@ -36,7 +36,7 @@ export default define(meta, async (ps, user) => { await doPostSuspend(user).catch(e => {}); createDeleteAccountJob(user, { - soft: false + soft: false, }); await Users.update(user.id, { diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index b79d68ae73..49b0bcd46c 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -33,7 +33,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'NoteFavorite', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index 7a2935a5ec..3ee7174f71 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -33,15 +33,15 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, page: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'GalleryPost' - } - } - } + ref: 'GalleryPost', + }, + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index 21bb8759fc..c8aceb8bf3 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -32,9 +32,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'GalleryPost' - } - } + ref: 'GalleryPost', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts index 6b9be98582..3eddc2746c 100644 --- a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -17,17 +17,17 @@ export const meta = { properties: { count: { type: 'number' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps, user) => { return { count: await MutedNotes.count({ userId: user.id, - reason: 'word' - }) + reason: 'word', + }), }; }); diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index 4822bd5868..f0e3106c53 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -18,34 +18,34 @@ export const meta = { params: { fileId: { validator: $.type(ID), - } + }, }, errors: { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'ebb53e5f-6574-9c0c-0b92-7ca6def56d7e' + id: 'ebb53e5f-6574-9c0c-0b92-7ca6def56d7e', }, unexpectedFileType: { message: 'We need csv file.', code: 'UNEXPECTED_FILE_TYPE', - id: 'b6fab7d6-d945-d67c-dfdb-32da1cd12cfe' + id: 'b6fab7d6-d945-d67c-dfdb-32da1cd12cfe', }, tooBigFile: { message: 'That file is too big.', code: 'TOO_BIG_FILE', - id: 'b7fbf0b1-aeef-3b21-29ef-fadd4cb72ccf' + id: 'b7fbf0b1-aeef-3b21-29ef-fadd4cb72ccf', }, emptyFile: { message: 'That file is empty.', code: 'EMPTY_FILE', - id: '6f3a4dcc-f060-a707-4950-806fbdbe60d6' + id: '6f3a4dcc-f060-a707-4950-806fbdbe60d6', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/import-following.ts b/packages/backend/src/server/api/endpoints/i/import-following.ts index 19aa2fa933..61e500599f 100644 --- a/packages/backend/src/server/api/endpoints/i/import-following.ts +++ b/packages/backend/src/server/api/endpoints/i/import-following.ts @@ -17,34 +17,34 @@ export const meta = { params: { fileId: { validator: $.type(ID), - } + }, }, errors: { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'b98644cf-a5ac-4277-a502-0b8054a709a3' + id: 'b98644cf-a5ac-4277-a502-0b8054a709a3', }, unexpectedFileType: { message: 'We need csv file.', code: 'UNEXPECTED_FILE_TYPE', - id: '660f3599-bce0-4f95-9dde-311fd841c183' + id: '660f3599-bce0-4f95-9dde-311fd841c183', }, tooBigFile: { message: 'That file is too big.', code: 'TOO_BIG_FILE', - id: 'dee9d4ed-ad07-43ed-8b34-b2856398bc60' + id: 'dee9d4ed-ad07-43ed-8b34-b2856398bc60', }, emptyFile: { message: 'That file is empty.', code: 'EMPTY_FILE', - id: '31a1b42c-06f7-42ae-8a38-a661c5c9f691' + id: '31a1b42c-06f7-42ae-8a38-a661c5c9f691', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index c474dd7186..da26617d91 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -18,34 +18,34 @@ export const meta = { params: { fileId: { validator: $.type(ID), - } + }, }, errors: { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'e674141e-bd2a-ba85-e616-aefb187c9c2a' + id: 'e674141e-bd2a-ba85-e616-aefb187c9c2a', }, unexpectedFileType: { message: 'We need csv file.', code: 'UNEXPECTED_FILE_TYPE', - id: '568c6e42-c86c-ba09-c004-517f83f9f1a8' + id: '568c6e42-c86c-ba09-c004-517f83f9f1a8', }, tooBigFile: { message: 'That file is too big.', code: 'TOO_BIG_FILE', - id: '9b4ada6d-d7f7-0472-0713-4f558bd1ec9c' + id: '9b4ada6d-d7f7-0472-0713-4f558bd1ec9c', }, emptyFile: { message: 'That file is empty.', code: 'EMPTY_FILE', - id: 'd2f12af1-e7b4-feac-86a3-519548f2728e' + id: 'd2f12af1-e7b4-feac-86a3-519548f2728e', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index ceccdd1852..1b850d314f 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -17,34 +17,34 @@ export const meta = { params: { fileId: { validator: $.type(ID), - } + }, }, errors: { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'ea9cc34f-c415-4bc6-a6fe-28ac40357049' + id: 'ea9cc34f-c415-4bc6-a6fe-28ac40357049', }, unexpectedFileType: { message: 'We need csv file.', code: 'UNEXPECTED_FILE_TYPE', - id: 'a3c9edda-dd9b-4596-be6a-150ef813745c' + id: 'a3c9edda-dd9b-4596-be6a-150ef813745c', }, tooBigFile: { message: 'That file is too big.', code: 'TOO_BIG_FILE', - id: 'ae6e7a22-971b-4b52-b2be-fc0b9b121fe9' + id: 'ae6e7a22-971b-4b52-b2be-fc0b9b121fe9', }, emptyFile: { message: 'That file is empty.', code: 'EMPTY_FILE', - id: '99efe367-ce6e-4d44-93f8-5fae7b040356' + id: '99efe367-ce6e-4d44-93f8-5fae7b040356', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index a85637d8a0..9083aefacd 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -19,7 +19,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -32,17 +32,17 @@ export const meta = { following: { validator: $.optional.bool, - default: false + default: false, }, unreadOnly: { validator: $.optional.bool, - default: false + default: false, }, markAsRead: { validator: $.optional.bool, - default: true + default: true, }, includeTypes: { @@ -51,7 +51,7 @@ export const meta = { excludeTypes: { validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])), - } + }, }, res: { @@ -61,7 +61,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Notification', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index fa2bc31730..92fc294850 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -33,15 +33,15 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, page: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Page' - } - } - } + ref: 'Page', + }, + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index ee87fffa2d..5948712c30 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -32,9 +32,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Page' - } - } + ref: 'Page', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index de94220ba9..5fc49d6518 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -15,34 +15,34 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '56734f8b-3928-431e-bf80-6ff87df40cb3' + id: '56734f8b-3928-431e-bf80-6ff87df40cb3', }, pinLimitExceeded: { message: 'You can not pin notes any more.', code: 'PIN_LIMIT_EXCEEDED', - id: '72dab508-c64d-498f-8740-a8eec1ba385a' + id: '72dab508-c64d-498f-8740-a8eec1ba385a', }, alreadyPinned: { message: 'That note has already been pinned.', code: 'ALREADY_PINNED', - id: '8b18c2b7-68fe-4edb-9892-c0cbaeb6c913' + id: '8b18c2b7-68fe-4edb-9892-c0cbaeb6c913', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { @@ -54,6 +54,6 @@ export default define(meta, async (ps, user) => { }); return await Users.pack(user.id, user, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts index 9aca7611c9..a66d6bac7b 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -10,23 +10,23 @@ export const meta = { kind: 'write:account', params: { - } + }, }; export default define(meta, async (ps, user) => { // Update documents await MessagingMessages.update({ recipientId: user.id, - isRead: false + isRead: false, }, { - isRead: true + isRead: true, }); const joinings = await UserGroupJoinings.find({ userId: user.id }); await Promise.all(joinings.map(j => MessagingMessages.createQueryBuilder().update() .set({ - reads: (() => `array_append("reads", '${user.id}')`) as any + reads: (() => `array_append("reads", '${user.id}')`) as any, }) .where(`groupId = :groupId`, { groupId: j.userGroupId }) .andWhere('userId != :userId', { userId: user.id }) diff --git a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts index 2a7102a590..90f555763e 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -10,13 +10,13 @@ export const meta = { kind: 'write:account', params: { - } + }, }; export default define(meta, async (ps, user) => { // Remove documents await NoteUnreads.delete({ - userId: user.id + userId: user.id, }); // 全て既読になったイベントを発行 diff --git a/packages/backend/src/server/api/endpoints/i/read-announcement.ts b/packages/backend/src/server/api/endpoints/i/read-announcement.ts index 2f5036f953..d948f3efdf 100644 --- a/packages/backend/src/server/api/endpoints/i/read-announcement.ts +++ b/packages/backend/src/server/api/endpoints/i/read-announcement.ts @@ -23,9 +23,9 @@ export const meta = { noSuchAnnouncement: { message: 'No such announcement.', code: 'NO_SUCH_ANNOUNCEMENT', - id: '184663db-df88-4bc2-8b52-fb85f0681939' + id: '184663db-df88-4bc2-8b52-fb85f0681939', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -39,7 +39,7 @@ export default define(meta, async (ps, user) => { // Check if already read const read = await AnnouncementReads.findOne({ announcementId: ps.announcementId, - userId: user.id + userId: user.id, }); if (read != null) { 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 1cce2d37be..f7e910154d 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -12,9 +12,9 @@ export const meta = { params: { password: { - validator: $.str - } - } + validator: $.str, + }, + }, }; export default define(meta, async (ps, user) => { @@ -31,7 +31,7 @@ export default define(meta, async (ps, user) => { const secret = generateUserToken(); await Users.update(user.id, { - token: secret + token: secret, }); // Publish event diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts index c8eaf83a25..1599ccea6b 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts @@ -12,7 +12,7 @@ export const meta = { validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), default: [], }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts index 992800c44c..4edeae9e95 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts @@ -10,7 +10,7 @@ export const meta = { params: { key: { - validator: $.str + validator: $.str, }, scope: { @@ -23,7 +23,7 @@ export const meta = { noSuchKey: { message: 'No such key.', code: 'NO_SUCH_KEY', - id: '97a1e8e7-c0f7-47d2-957a-92e61256e01a' + id: '97a1e8e7-c0f7-47d2-957a-92e61256e01a', }, }, }; diff --git a/packages/backend/src/server/api/endpoints/i/registry/get.ts b/packages/backend/src/server/api/endpoints/i/registry/get.ts index 569c3a9280..aa0695281a 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get.ts @@ -10,7 +10,7 @@ export const meta = { params: { key: { - validator: $.str + validator: $.str, }, scope: { @@ -23,7 +23,7 @@ export const meta = { noSuchKey: { message: 'No such key.', code: 'NO_SUCH_KEY', - id: 'ac3ed68a-62f0-422b-a7bc-d5e09e8f6a6a' + id: 'ac3ed68a-62f0-422b-a7bc-d5e09e8f6a6a', }, }, }; diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index 16a4fee374..9cac503538 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -12,7 +12,7 @@ export const meta = { validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), default: [], }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys.ts b/packages/backend/src/server/api/endpoints/i/registry/keys.ts index 3a8aeaa195..215ccbd5b5 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys.ts @@ -12,7 +12,7 @@ export const meta = { validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), default: [], }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/registry/remove.ts b/packages/backend/src/server/api/endpoints/i/registry/remove.ts index 07bc23d4a6..17ce5851c0 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/remove.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/remove.ts @@ -10,7 +10,7 @@ export const meta = { params: { key: { - validator: $.str + validator: $.str, }, scope: { @@ -23,7 +23,7 @@ export const meta = { noSuchKey: { message: 'No such key.', code: 'NO_SUCH_KEY', - id: '1fac4e8a-a6cd-4e39-a4a5-3a7e11f1b019' + id: '1fac4e8a-a6cd-4e39-a4a5-3a7e11f1b019', }, }, }; diff --git a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index ecbdb05a8e..45aeb59771 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts @@ -7,7 +7,7 @@ export const meta = { secure: true, params: { - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/registry/set.ts b/packages/backend/src/server/api/endpoints/i/registry/set.ts index f129ee1b70..7c282064c3 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/set.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/set.ts @@ -11,18 +11,18 @@ export const meta = { params: { key: { - validator: $.str.min(1) + validator: $.str.min(1), }, value: { - validator: $.nullable.any + validator: $.nullable.any, }, scope: { validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)), default: [], }, - } + }, }; export default define(meta, async (ps, user) => { @@ -37,7 +37,7 @@ export default define(meta, async (ps, user) => { if (existingItem) { await RegistryItems.update(existingItem.id, { updatedAt: new Date(), - value: ps.value + value: ps.value, }); } else { await RegistryItems.insert({ @@ -48,7 +48,7 @@ export default define(meta, async (ps, user) => { domain: null, scope: ps.scope, key: ps.key, - value: ps.value + value: ps.value, }); } @@ -56,6 +56,6 @@ export default define(meta, async (ps, user) => { publishMainStream(user.id, 'registryUpdated', { scope: ps.scope, key: ps.key, - value: ps.value + value: ps.value, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/revoke-token.ts b/packages/backend/src/server/api/endpoints/i/revoke-token.ts index bed868def4..1b6b18aa80 100644 --- a/packages/backend/src/server/api/endpoints/i/revoke-token.ts +++ b/packages/backend/src/server/api/endpoints/i/revoke-token.ts @@ -11,9 +11,9 @@ export const meta = { params: { tokenId: { - validator: $.type(ID) - } - } + validator: $.type(ID), + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index a2c10148c6..6f2f8fc8ca 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -12,7 +12,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -21,8 +21,8 @@ export const meta = { untilId: { validator: $.optional.type(ID), - } - } + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index dc79e255ab..c1b753bfaf 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -15,22 +15,22 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '454170ce-9d63-4a43-9da1-ea10afe81e21' + id: '454170ce-9d63-4a43-9da1-ea10afe81e21', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, user) => { @@ -40,6 +40,6 @@ export default define(meta, async (ps, user) => { }); return await Users.pack(user.id, user, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index ff5a9f292c..d99fa2474d 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -17,16 +17,16 @@ export const meta = { limit: { duration: ms('1hour'), - max: 3 + max: 3, }, params: { password: { - validator: $.str + validator: $.str, }, email: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, }, @@ -34,15 +34,15 @@ export const meta = { incorrectPassword: { message: 'Incorrect password.', code: 'INCORRECT_PASSWORD', - id: 'e54c1d7e-e7d6-4103-86b6-0a95069b4ad3' + id: 'e54c1d7e-e7d6-4103-86b6-0a95069b4ad3', }, unavailable: { message: 'Unavailable email address.', code: 'UNAVAILABLE', - id: 'a2defefb-f220-8849-0af6-17f816099323' + id: 'a2defefb-f220-8849-0af6-17f816099323', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -65,12 +65,12 @@ export default define(meta, async (ps, user) => { await UserProfiles.update(user.id, { email: ps.email, emailVerified: false, - emailVerifyCode: null + emailVerifyCode: null, }); const iObj = await Users.pack(user.id, user, { detail: true, - includeSecrets: true + includeSecrets: true, }); // Publish meUpdated event @@ -80,7 +80,7 @@ export default define(meta, async (ps, user) => { const code = rndstr('a-z0-9', 16); await UserProfiles.update(user.id, { - emailVerifyCode: code + emailVerifyCode: code, }); const link = `${config.url}/verify-email/${code}`; diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 4c5a4da622..5a62b39377 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -113,19 +113,19 @@ export const meta = { }, mutedWords: { - validator: $.optional.arr($.arr($.str)) + validator: $.optional.arr($.arr($.str)), }, mutedInstances: { - validator: $.optional.arr($.str) + validator: $.optional.arr($.str), }, mutingNotificationTypes: { - validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])) + validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])), }, emailNotificationTypes: { - validator: $.optional.arr($.str) + validator: $.optional.arr($.str), }, }, @@ -133,39 +133,39 @@ export const meta = { noSuchAvatar: { message: 'No such avatar file.', code: 'NO_SUCH_AVATAR', - id: '539f3a45-f215-4f81-a9a8-31293640207f' + id: '539f3a45-f215-4f81-a9a8-31293640207f', }, noSuchBanner: { message: 'No such banner file.', code: 'NO_SUCH_BANNER', - id: '0d8f5629-f210-41c2-9433-735831a58595' + id: '0d8f5629-f210-41c2-9433-735831a58595', }, avatarNotAnImage: { message: 'The file specified as an avatar is not an image.', code: 'AVATAR_NOT_AN_IMAGE', - id: 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191' + id: 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191', }, bannerNotAnImage: { message: 'The file specified as a banner is not an image.', code: 'BANNER_NOT_AN_IMAGE', - id: '75aedb19-2afd-4e6d-87fc-67941256fa60' + id: '75aedb19-2afd-4e6d-87fc-67941256fa60', }, noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: '8e01b590-7eb9-431b-a239-860e086c408e' + id: '8e01b590-7eb9-431b-a239-860e086c408e', }, }, res: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'User' - } + ref: 'User', + }, }; export default define(meta, async (ps, _user, token) => { @@ -280,7 +280,7 @@ export default define(meta, async (ps, _user, token) => { const iObj = await Users.pack(user.id, user, { detail: true, - includeSecrets: isSecure + includeSecrets: isSecure, }); // Publish meUpdated event diff --git a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts index 1ebde243ca..6949e486ab 100644 --- a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts +++ b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -36,16 +36,16 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, group: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'UserGroup' - } - } - } - } + ref: 'UserGroup', + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index e447703546..4ca3d6ebed 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -14,13 +14,13 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, group: { validator: $.optional.bool, - default: false - } + default: false, + }, }, res: { @@ -30,7 +30,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'MessagingMessage', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/messaging/messages.ts b/packages/backend/src/server/api/endpoints/messaging/messages.ts index 6baa24609e..79e7764245 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages.ts @@ -26,7 +26,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -39,8 +39,8 @@ export const meta = { markAsRead: { validator: $.optional.bool, - default: true - } + default: true, + }, }, res: { @@ -50,28 +50,28 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'MessagingMessage', - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '11795c64-40ea-4198-b06e-3c873ed9039d' + id: '11795c64-40ea-4198-b06e-3c873ed9039d', }, noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: 'c4d9f88c-9270-4632-b032-6ed8cee36f7f' + id: 'c4d9f88c-9270-4632-b032-6ed8cee36f7f', }, groupAccessDenied: { message: 'You can not read messages of groups that you have not joined.', code: 'GROUP_ACCESS_DENIED', - id: 'a053a8dd-a491-4718-8f87-50775aad9284' + id: 'a053a8dd-a491-4718-8f87-50775aad9284', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -109,7 +109,7 @@ export default define(meta, async (ps, user) => { } return await Promise.all(messages.map(message => MessagingMessages.pack(message, user, { - populateRecipient: false + populateRecipient: false, }))); } else if (ps.groupId != null) { // Fetch recipient (group) @@ -122,7 +122,7 @@ export default define(meta, async (ps, user) => { // check joined const joining = await UserGroupJoinings.findOne({ userId: user.id, - userGroupId: recipientGroup.id + userGroupId: recipientGroup.id, }); if (joining == null) { @@ -140,7 +140,7 @@ export default define(meta, async (ps, user) => { } return await Promise.all(messages.map(message => MessagingMessages.pack(message, user, { - populateGroup: false + populateGroup: false, }))); } else { throw new Error(); diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index df0b455cbe..02b22ead80 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -25,12 +25,12 @@ export const meta = { }, text: { - validator: $.optional.str.pipe(MessagingMessages.validateText) + validator: $.optional.str.pipe(MessagingMessages.validateText), }, fileId: { validator: $.optional.type(ID), - } + }, }, res: { @@ -43,45 +43,45 @@ export const meta = { recipientIsYourself: { message: 'You can not send a message to yourself.', code: 'RECIPIENT_IS_YOURSELF', - id: '17e2ba79-e22a-4cbc-bf91-d327643f4a7e' + id: '17e2ba79-e22a-4cbc-bf91-d327643f4a7e', }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '11795c64-40ea-4198-b06e-3c873ed9039d' + id: '11795c64-40ea-4198-b06e-3c873ed9039d', }, noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: 'c94e2a5d-06aa-4914-8fa6-6a42e73d6537' + id: 'c94e2a5d-06aa-4914-8fa6-6a42e73d6537', }, groupAccessDenied: { message: 'You can not send messages to groups that you have not joined.', code: 'GROUP_ACCESS_DENIED', - id: 'd96b3cca-5ad1-438b-ad8b-02f931308fbd' + id: 'd96b3cca-5ad1-438b-ad8b-02f931308fbd', }, noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: '4372b8e2-185d-4146-8749-2f68864a3e5f' + id: '4372b8e2-185d-4146-8749-2f68864a3e5f', }, contentRequired: { message: 'Content required. You need to set text or fileId.', code: 'CONTENT_REQUIRED', - id: '25587321-b0e6-449c-9239-f8925092942c' + id: '25587321-b0e6-449c-9239-f8925092942c', }, youHaveBeenBlocked: { message: 'You cannot send a message because you have been blocked by this user.', code: 'YOU_HAVE_BEEN_BLOCKED', - id: 'c15a5199-7422-4968-941a-2a462c478f7d' + id: 'c15a5199-7422-4968-941a-2a462c478f7d', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -119,7 +119,7 @@ export default define(meta, async (ps, user) => { // check joined const joining = await UserGroupJoinings.findOne({ userId: user.id, - userGroupId: recipientGroup.id + userGroupId: recipientGroup.id, }); if (joining == null) { @@ -131,7 +131,7 @@ export default define(meta, async (ps, user) => { if (ps.fileId != null) { file = await DriveFiles.findOne({ id: ps.fileId, - userId: user.id + userId: user.id, }); if (file == null) { diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts index 25bf676383..dd1c2e8dee 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts @@ -16,28 +16,28 @@ export const meta = { limit: { duration: ms('1hour'), max: 300, - minInterval: ms('1sec') + minInterval: ms('1sec'), }, params: { messageId: { validator: $.type(ID), - } + }, }, errors: { noSuchMessage: { message: 'No such message.', code: 'NO_SUCH_MESSAGE', - id: '54b5b326-7925-42cf-8019-130fda8b56af' + id: '54b5b326-7925-42cf-8019-130fda8b56af', }, - } + }, }; export default define(meta, async (ps, user) => { const message = await MessagingMessages.findOne({ id: ps.messageId, - userId: user.id + userId: user.id, }); if (message == null) { diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts index a1747310d3..96d68b2605 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts @@ -15,16 +15,16 @@ export const meta = { params: { messageId: { validator: $.type(ID), - } + }, }, errors: { noSuchMessage: { message: 'No such message.', code: 'NO_SUCH_MESSAGE', - id: '86d56a2f-a9c3-4afb-b13c-3e9bfef9aa14' + id: '86d56a2f-a9c3-4afb-b13c-3e9bfef9aa14', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index ce21556243..bced077c12 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -14,8 +14,8 @@ export const meta = { params: { detail: { validator: $.optional.bool, - default: true - } + default: true, + }, }, res: { @@ -24,16 +24,16 @@ export const meta = { properties: { maintainerName: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, maintainerEmail: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, version: { type: 'string' as const, optional: false as const, nullable: false as const, - example: config.version + example: config.version, }, name: { type: 'string' as const, @@ -43,7 +43,7 @@ export const meta = { type: 'string' as const, optional: false as const, nullable: false as const, format: 'url', - example: 'https://misskey.example.com' + example: 'https://misskey.example.com', }, description: { type: 'string' as const, @@ -54,27 +54,27 @@ export const meta = { optional: false as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, tosUrl: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, repositoryUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - default: 'https://github.com/misskey-dev/misskey' + default: 'https://github.com/misskey-dev/misskey', }, feedbackUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - default: 'https://github.com/misskey-dev/misskey/issues/new' + default: 'https://github.com/misskey-dev/misskey/issues/new', }, secure: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, disableRegistration: { type: 'boolean' as const, @@ -90,66 +90,66 @@ export const meta = { }, driveCapacityPerLocalUserMb: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, driveCapacityPerRemoteUserMb: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, cacheRemoteFiles: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, proxyRemoteFiles: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, emailRequiredForSignup: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, enableHcaptcha: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hcaptchaSiteKey: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, enableRecaptcha: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, recaptchaSiteKey: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, swPublickey: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, mascotImageUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - default: '/assets/ai.png' + default: '/assets/ai.png', }, bannerUrl: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, errorImageUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - default: 'https://xn--931a.moe/aiart/yubitun.png' + default: 'https://xn--931a.moe/aiart/yubitun.png', }, iconUrl: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, maxNoteTextLength: { type: 'number' as const, optional: false as const, nullable: false as const, - default: 500 + default: 500, }, emojis: { type: 'array' as const, @@ -161,31 +161,31 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, aliases: { type: 'array' as const, optional: false as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, category: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, host: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, url: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'url' - } - } - } + format: 'url', + }, + }, + }, }, ads: { type: 'array' as const, @@ -196,53 +196,53 @@ export const meta = { properties: { place: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, url: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'url' + format: 'url', }, imageUrl: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'url' + format: 'url', }, - } - } + }, + }, }, requireSetup: { type: 'boolean' as const, optional: false as const, nullable: false as const, - example: false + example: false, }, enableEmail: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, enableTwitterIntegration: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, enableGithubIntegration: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, enableDiscordIntegration: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, enableServiceWorker: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, translatorAvailable: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, proxyAccountName: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, features: { type: 'object' as const, @@ -250,54 +250,54 @@ export const meta = { properties: { registration: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, localTimeLine: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, globalTimeLine: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, elasticsearch: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hcaptcha: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, recaptcha: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, objectStorage: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, twitter: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, github: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, discord: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, serviceWorker: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, miauth: { type: 'boolean' as const, optional: true as const, nullable: false as const, - default: true + default: true, }, - } + }, }, userStarForReactionFallback: { type: 'boolean' as const, @@ -308,144 +308,144 @@ export const meta = { optional: true as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, hiddenTags: { type: 'array' as const, optional: true as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, blockedHosts: { type: 'array' as const, optional: true as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, hcaptchaSecretKey: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, recaptchaSecretKey: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, proxyAccountId: { type: 'string' as const, optional: true as const, nullable: true as const, - format: 'id' + format: 'id', }, twitterConsumerKey: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, twitterConsumerSecret: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, githubClientId: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, githubClientSecret: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, discordClientId: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, discordClientSecret: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, summaryProxy: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, email: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, smtpSecure: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, smtpHost: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, smtpPort: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, smtpUser: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, smtpPass: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, swPrivateKey: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, useObjectStorage: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, objectStorageBaseUrl: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStorageBucket: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStoragePrefix: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStorageEndpoint: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStorageRegion: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStoragePort: { type: 'number' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStorageAccessKey: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStorageSecretKey: { type: 'string' as const, - optional: true as const, nullable: true as const + optional: true as const, nullable: true as const, }, objectStorageUseSSL: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, objectStorageUseProxy: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, objectStorageSetPublicRead: { type: 'boolean' as const, - optional: true as const, nullable: false as const - } - } - } + optional: true as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps, me) => { @@ -453,21 +453,21 @@ export default define(meta, async (ps, me) => { const emojis = await Emojis.find({ where: { - host: null + host: null, }, order: { category: 'ASC', - name: 'ASC' + name: 'ASC', }, cache: { id: 'meta_emojis', - milliseconds: 3600000 // 1 hour - } + milliseconds: 3600000, // 1 hour + }, }); const ads = await Ads.find({ where: { - expiresAt: MoreThan(new Date()) + expiresAt: MoreThan(new Date()), }, }); @@ -531,7 +531,7 @@ export default define(meta, async (ps, me) => { requireSetup: (await Users.count({ host: null, })) === 0, - } : {}) + } : {}), }; if (ps.detail) { diff --git a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts index 321fa42fc9..29f109f369 100644 --- a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts +++ b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts @@ -13,11 +13,11 @@ export const meta = { params: { session: { - validator: $.nullable.str + validator: $.nullable.str, }, name: { - validator: $.nullable.optional.str + validator: $.nullable.optional.str, }, description: { @@ -39,10 +39,10 @@ export const meta = { properties: { token: { type: 'string' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps, user) => { @@ -67,6 +67,6 @@ export default define(meta, async (ps, user) => { }); return { - token: accessToken + token: accessToken, }; }); diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index 3fc64d3eba..703611f67f 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -25,21 +25,21 @@ export const meta = { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '6fef56f3-e765-4957-88e5-c6f65329b8a5' + id: '6fef56f3-e765-4957-88e5-c6f65329b8a5', }, muteeIsYourself: { message: 'Mutee is yourself.', code: 'MUTEE_IS_YOURSELF', - id: 'a4619cb2-5f23-484b-9301-94c903074e10' + id: 'a4619cb2-5f23-484b-9301-94c903074e10', }, alreadyMuting: { message: 'You are already muting that user.', code: 'ALREADY_MUTING', - id: '7e7359cb-160c-4956-b08f-4d1c653cd007' + id: '7e7359cb-160c-4956-b08f-4d1c653cd007', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -59,7 +59,7 @@ export default define(meta, async (ps, user) => { // Check if already muting const exist = await Mutings.findOne({ muterId: muter.id, - muteeId: mutee.id + muteeId: mutee.id, }); if (exist != null) { @@ -78,6 +78,6 @@ export default define(meta, async (ps, user) => { NoteWatchings.delete({ userId: muter.id, - noteUserId: mutee.id + noteUserId: mutee.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 3ffd1f4562..aa8c33d046 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -23,21 +23,21 @@ export const meta = { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: 'b851d00b-8ab1-4a56-8b1b-e24187cb48ef' + id: 'b851d00b-8ab1-4a56-8b1b-e24187cb48ef', }, muteeIsYourself: { message: 'Mutee is yourself.', code: 'MUTEE_IS_YOURSELF', - id: 'f428b029-6b39-4d48-a1d2-cc1ae6dd5cf9' + id: 'f428b029-6b39-4d48-a1d2-cc1ae6dd5cf9', }, notMuting: { message: 'You are not muting that user.', code: 'NOT_MUTING', - id: '5467d020-daa9-4553-81e1-135c0c35a96d' + id: '5467d020-daa9-4553-81e1-135c0c35a96d', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -57,7 +57,7 @@ export default define(meta, async (ps, user) => { // Check not muting const exist = await Mutings.findOne({ muterId: muter.id, - muteeId: mutee.id + muteeId: mutee.id, }); if (exist == null) { @@ -66,7 +66,7 @@ export default define(meta, async (ps, user) => { // Delete mute await Mutings.delete({ - id: exist.id + id: exist.id, }); publishUserEvent(user.id, 'unmute', mutee); diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index ae4c3a719d..48b6ddb060 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -14,7 +14,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 30 + default: 30, }, sinceId: { @@ -33,7 +33,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Muting', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index d91562b62f..1164f5f6f3 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -10,13 +10,13 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num.min(0), - default: 0 - } + default: 0, + }, }, res: { @@ -28,27 +28,27 @@ export const meta = { properties: { id: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, name: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, callbackUrl: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, permission: { type: 'array' as const, optional: false as const, nullable: false as const, items: { type: 'string' as const, - optional: false as const, nullable: false as const - } + optional: false as const, nullable: false as const, + }, }, secret: { type: 'string' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, isAuthorized: { type: 'object' as const, @@ -56,22 +56,22 @@ export const meta = { properties: { appId: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, userId: { type: 'string' as const, - optional: false as const, nullable: false as const - } - } - } - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, + }, + }, + }, }; export default define(meta, async (ps, user) => { const query = { - userId: user.id + userId: user.id, }; const apps = await Apps.find({ @@ -81,6 +81,6 @@ export default define(meta, async (ps, user) => { }); return await Promise.all(apps.map(app => Apps.pack(app, user, { - detail: true + detail: true, }))); }); diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index a3f6e187f2..37d1b03dce 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -30,7 +30,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -49,7 +49,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index 49e5a2f84d..acd9d6f7e4 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -21,7 +21,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -40,7 +40,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/clips.ts b/packages/backend/src/server/api/endpoints/notes/clips.ts index 6b303d87ec..deb14da16c 100644 --- a/packages/backend/src/server/api/endpoints/notes/clips.ts +++ b/packages/backend/src/server/api/endpoints/notes/clips.ts @@ -24,16 +24,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '47db1a1c-b0af-458d-8fb4-986e4efafe1e' - } - } + id: '47db1a1c-b0af-458d-8fb4-986e4efafe1e', + }, + }, }; export default define(meta, async (ps, me) => { @@ -48,7 +48,7 @@ export default define(meta, async (ps, me) => { const clips = await Clips.find({ id: In(clipNotes.map(x => x.clipId)), - isPublic: true + isPublic: true, }); return await Promise.all(clips.map(x => Clips.pack(x))); diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index 0fe323ea00..8fdbb7fdeb 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -18,12 +18,12 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num.min(0), - default: 0 + default: 0, }, }, @@ -34,16 +34,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'e1035875-9551-45ec-afa8-1ded1fcb53c8' - } - } + id: 'e1035875-9551-45ec-afa8-1ded1fcb53c8', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index d2d1ede3c8..9567374c63 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -29,7 +29,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 300 + max: 300, }, kind: 'write:notes', @@ -106,10 +106,10 @@ export const meta = { .each(c => c.length > 0 && c.length < 50), multiple: $.optional.bool, expiresAt: $.optional.nullable.num.int(), - expiredAfter: $.optional.nullable.num.int().min(1) + expiredAfter: $.optional.nullable.num.int().min(1), }).strict(), - ref: 'poll' - } + ref: 'poll', + }, }, res: { @@ -120,59 +120,59 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } - } + }, + }, }, errors: { noSuchRenoteTarget: { message: 'No such renote target.', code: 'NO_SUCH_RENOTE_TARGET', - id: 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4' + id: 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4', }, cannotReRenote: { message: 'You can not Renote a pure Renote.', code: 'CANNOT_RENOTE_TO_A_PURE_RENOTE', - id: 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a' + id: 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a', }, noSuchReplyTarget: { message: 'No such reply target.', code: 'NO_SUCH_REPLY_TARGET', - id: '749ee0f6-d3da-459a-bf02-282e2da4292c' + id: '749ee0f6-d3da-459a-bf02-282e2da4292c', }, cannotReplyToPureRenote: { message: 'You can not reply to a pure Renote.', code: 'CANNOT_REPLY_TO_A_PURE_RENOTE', - id: '3ac74a84-8fd5-4bb0-870f-01804f82ce15' + id: '3ac74a84-8fd5-4bb0-870f-01804f82ce15', }, contentRequired: { message: 'Content required. You need to set text, fileIds, renoteId or poll.', code: 'CONTENT_REQUIRED', - id: '6f57e42b-c348-439b-bc45-993995cc515a' + id: '6f57e42b-c348-439b-bc45-993995cc515a', }, cannotCreateAlreadyExpiredPoll: { message: 'Poll is already expired.', code: 'CANNOT_CREATE_ALREADY_EXPIRED_POLL', - id: '04da457d-b083-4055-9082-955525eda5a5' + id: '04da457d-b083-4055-9082-955525eda5a5', }, noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', - id: 'b1653923-5453-4edc-b786-7c4f39bb0bbb' + id: 'b1653923-5453-4edc-b786-7c4f39bb0bbb', }, youHaveBeenBlocked: { message: 'You have been blocked by this user.', code: 'YOU_HAVE_BEEN_BLOCKED', - id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3' + id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -188,7 +188,7 @@ export default define(meta, async (ps, user) => { files = (await Promise.all(fileIds.map(fileId => DriveFiles.findOne({ id: fileId, - userId: user.id + userId: user.id, }) ))).filter(file => file != null) as DriveFile[]; } @@ -273,7 +273,7 @@ export default define(meta, async (ps, user) => { poll: ps.poll ? { choices: ps.poll.choices, multiple: ps.poll.multiple || false, - expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null + expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null, } : undefined, text: ps.text || undefined, reply, @@ -289,6 +289,6 @@ export default define(meta, async (ps, user) => { }); return { - createdNote: await Notes.pack(note, user) + createdNote: await Notes.pack(note, user), }; }); diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 7f0d59669e..532213c725 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -17,28 +17,28 @@ export const meta = { limit: { duration: ms('1hour'), max: 300, - minInterval: ms('1sec') + minInterval: ms('1sec'), }, params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '490be23f-8c1f-4796-819f-94cb4f9d1630' + id: '490be23f-8c1f-4796-819f-94cb4f9d1630', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: 'fe8d7103-0ea8-4ec3-814d-f8b401dc69e9' - } - } + id: 'fe8d7103-0ea8-4ec3-814d-f8b401dc69e9', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 1bb25edd7f..14191eefde 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -16,22 +16,22 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '6dd26674-e060-4816-909a-45ba3f4da458' + id: '6dd26674-e060-4816-909a-45ba3f4da458', }, alreadyFavorited: { message: 'The note has already been marked as a favorite.', code: 'ALREADY_FAVORITED', - id: 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6' + id: 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -44,7 +44,7 @@ export default define(meta, async (ps, user) => { // if already favorited const exist = await NoteFavorites.findOne({ noteId: note.id, - userId: user.id + userId: user.id, }); if (exist != null) { @@ -56,6 +56,6 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), noteId: note.id, - userId: user.id + userId: user.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index 75eb9a359a..f8d3b63026 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -15,22 +15,22 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '80848a2c-398f-4343-baa9-df1d57696c56' + id: '80848a2c-398f-4343-baa9-df1d57696c56', }, notFavorited: { message: 'You have not marked that note a favorite.', code: 'NOT_FAVORITED', - id: 'b625fc69-635e-45e9-86f4-dbefbef35af5' + id: 'b625fc69-635e-45e9-86f4-dbefbef35af5', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -43,7 +43,7 @@ export default define(meta, async (ps, user) => { // if already favorited const exist = await NoteFavorites.findOne({ noteId: note.id, - userId: user.id + userId: user.id, }); if (exist == null) { diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index 8d33c0e73d..2a14c52abc 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -17,7 +17,7 @@ export const meta = { offset: { validator: $.optional.num.min(0), - default: 0 + default: 0, }, }, @@ -28,7 +28,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index 7c80153b42..c3be042bfb 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -22,7 +22,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -34,11 +34,11 @@ export const meta = { }, sinceDate: { - validator: $.optional.num + validator: $.optional.num, }, untilDate: { - validator: $.optional.num + validator: $.optional.num, }, }, @@ -49,16 +49,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { gtlDisabled: { message: 'Global timeline has been disabled.', code: 'GTL_DISABLED', - id: '0332fc13-6ab2-4427-ae80-a9fadffd1a6b' + id: '0332fc13-6ab2-4427-ae80-a9fadffd1a6b', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index 22babb5d0c..4a0b9d49d7 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -69,16 +69,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { stlDisabled: { message: 'Hybrid timeline has been disabled.', code: 'STL_DISABLED', - id: '620763f4-f621-4533-ab33-0577a1a3c342' + id: '620763f4-f621-4533-ab33-0577a1a3c342', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index f670d478bf..113268982b 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -33,7 +33,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -60,16 +60,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { ltlDisabled: { message: 'Local timeline has been disabled.', code: 'LTL_DISABLED', - id: '45a6eb02-7695-4393-b023-dd3be9aaaefd' + id: '45a6eb02-7695-4393-b023-dd3be9aaaefd', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index ffaebd6c95..916209ca71 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -18,12 +18,12 @@ export const meta = { params: { following: { validator: $.optional.bool, - default: false + default: false, }, limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -46,7 +46,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index 0763f0c8fd..9f133c071e 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -11,13 +11,13 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num.min(0), - default: 0 - } + default: 0, + }, }, res: { @@ -26,9 +26,9 @@ export const meta = { items: { type: 'object' as const, optional: false as const, nullable: false as const, - ref: 'Note' - } - } + ref: 'Note', + }, + }, }; export default define(meta, async (ps, user) => { @@ -68,10 +68,10 @@ export default define(meta, async (ps, user) => { if (polls.length === 0) return []; const notes = await Notes.find({ - id: In(polls.map(poll => poll.noteId)) + id: In(polls.map(poll => poll.noteId)), }); return await Notes.packMany(notes, user, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index e7a6537025..479034389a 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -27,7 +27,7 @@ export const meta = { }, choice: { - validator: $.num + validator: $.num, }, }, @@ -35,39 +35,39 @@ export const meta = { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'ecafbd2e-c283-4d6d-aecb-1a0a33b75396' + id: 'ecafbd2e-c283-4d6d-aecb-1a0a33b75396', }, noPoll: { message: 'The note does not attach a poll.', code: 'NO_POLL', - id: '5f979967-52d9-4314-a911-1c673727f92f' + id: '5f979967-52d9-4314-a911-1c673727f92f', }, invalidChoice: { message: 'Choice ID is invalid.', code: 'INVALID_CHOICE', - id: 'e0cc9a04-f2e8-41e4-a5f1-4127293260cc' + id: 'e0cc9a04-f2e8-41e4-a5f1-4127293260cc', }, alreadyVoted: { message: 'You have already voted.', code: 'ALREADY_VOTED', - id: '0963fc77-efac-419b-9424-b391608dc6d8' + id: '0963fc77-efac-419b-9424-b391608dc6d8', }, alreadyExpired: { message: 'The poll is already expired.', code: 'ALREADY_EXPIRED', - id: '1022a357-b085-4054-9083-8f8de358337e' + id: '1022a357-b085-4054-9083-8f8de358337e', }, youHaveBeenBlocked: { message: 'You cannot vote this poll because you have been blocked by this user.', code: 'YOU_HAVE_BEEN_BLOCKED', - id: '85a5377e-b1e9-4617-b0b9-5bea73331e49' + id: '85a5377e-b1e9-4617-b0b9-5bea73331e49', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -107,7 +107,7 @@ export default define(meta, async (ps, user) => { // if already voted const exist = await PollVotes.find({ noteId: note.id, - userId: user.id + userId: user.id, }); if (exist.length) { @@ -126,7 +126,7 @@ export default define(meta, async (ps, user) => { createdAt, noteId: note.id, userId: user.id, - choice: ps.choice + choice: ps.choice, }).then(x => PollVotes.findOneOrFail(x.identifiers[0])); // Increment votes count @@ -135,14 +135,14 @@ export default define(meta, async (ps, user) => { publishNoteStream(note.id, 'pollVoted', { choice: ps.choice, - userId: user.id + userId: user.id, }); // Notify createNotification(note.userId, 'pollVote', { notifierId: user.id, noteId: note.id, - choice: ps.choice + choice: ps.choice, }); // Fetch watchers @@ -154,7 +154,7 @@ export default define(meta, async (ps, user) => { createNotification(watcher.userId, 'pollVote', { notifierId: user.id, noteId: note.id, - choice: ps.choice + choice: ps.choice, }); } }); diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index 09dd6b600b..dca6deb06f 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -23,12 +23,12 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num, - default: 0 + default: 0, }, sinceId: { @@ -47,16 +47,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'NoteReaction', - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '263fff3d-d0e1-4af4-bea7-8408059b451a' - } - } + id: '263fff3d-d0e1-4af4-bea7-8408059b451a', + }, + }, }; export default define(meta, async (ps, user) => { @@ -66,7 +66,7 @@ export default define(meta, async (ps, user) => { }); const query = { - noteId: note.id + noteId: note.id, } as DeepPartial<NoteReaction>; if (ps.type) { @@ -82,8 +82,8 @@ export default define(meta, async (ps, user) => { take: ps.limit!, skip: ps.offset, order: { - id: -1 - } + id: -1, + }, }); return await Promise.all(reactions.map(reaction => NoteReactions.pack(reaction, user))); diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index 24a73a8d4f..879b32cd07 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -19,28 +19,28 @@ export const meta = { reaction: { validator: $.str, - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '033d0620-5bfe-4027-965d-980b0c85a3ea' + id: '033d0620-5bfe-4027-965d-980b0c85a3ea', }, alreadyReacted: { message: 'You are already reacting to that note.', code: 'ALREADY_REACTED', - id: '71efcf98-86d6-4e2b-b2ad-9d032369366b' + id: '71efcf98-86d6-4e2b-b2ad-9d032369366b', }, youHaveBeenBlocked: { message: 'You cannot react this note because you have been blocked by this user.', code: 'YOU_HAVE_BEEN_BLOCKED', - id: '20ef5475-9f38-4e4c-bd33-de6d979498ec' + id: '20ef5475-9f38-4e4c-bd33-de6d979498ec', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index ea851458d2..eb9281f7a0 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -16,7 +16,7 @@ export const meta = { limit: { duration: ms('1hour'), max: 60, - minInterval: ms('3sec') + minInterval: ms('3sec'), }, params: { @@ -29,15 +29,15 @@ export const meta = { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '764d9fce-f9f2-4a0e-92b1-6ceac9a7ad37' + id: '764d9fce-f9f2-4a0e-92b1-6ceac9a7ad37', }, notReacted: { message: 'You are not reacting to that note.', code: 'NOT_REACTED', - id: '92f4426d-4196-4125-aa5b-02943e2ec8fc' + id: '92f4426d-4196-4125-aa5b-02943e2ec8fc', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index 26bfc1657d..d53d725165 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -21,7 +21,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -30,7 +30,7 @@ export const meta = { untilId: { validator: $.optional.type(ID), - } + }, }, res: { @@ -40,16 +40,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '12908022-2e21-46cd-ba6a-3edaf6093f46' - } - } + id: '12908022-2e21-46cd-ba6a-3edaf6093f46', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index 0bb62413ae..e39878f4f2 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -27,7 +27,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -38,7 +38,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 40e1499736..2275f7c1ae 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -51,7 +51,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -62,7 +62,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index eb832a6b31..b49ee87199 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -17,7 +17,7 @@ export const meta = { params: { query: { - validator: $.str + validator: $.str, }, sinceId: { @@ -30,22 +30,22 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, host: { validator: $.optional.nullable.str, - default: undefined + default: undefined, }, userId: { validator: $.optional.nullable.type(ID), - default: null + default: null, }, channelId: { validator: $.optional.nullable.type(ID), - default: null + default: null, }, }, @@ -56,11 +56,11 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { - } + }, }; export default define(meta, async (ps, me) => { @@ -91,8 +91,8 @@ export default define(meta, async (ps, me) => { } else { const userQuery = ps.userId != null ? [{ term: { - userId: ps.userId - } + userId: ps.userId, + }, }] : []; const hostQuery = ps.userId == null ? @@ -100,14 +100,14 @@ export default define(meta, async (ps, me) => { bool: { must_not: { exists: { - field: 'userHost' - } - } - } + field: 'userHost', + }, + }, + }, }] : ps.host !== undefined ? [{ term: { - userHost: ps.host - } + userHost: ps.host, + }, }] : [] : []; @@ -122,15 +122,15 @@ export default define(meta, async (ps, me) => { simple_query_string: { fields: ['text'], query: ps.query.toLowerCase(), - default_operator: 'and' + default_operator: 'and', }, - }, ...hostQuery, ...userQuery] - } + }, ...hostQuery, ...userQuery], + }, }, sort: [{ - _doc: 'desc' - }] - } + _doc: 'desc', + }], + }, }); const hits = result.body.hits.hits.map((hit: any) => hit._id); @@ -140,11 +140,11 @@ export default define(meta, async (ps, me) => { // Fetch found notes const notes = await Notes.find({ where: { - id: In(hits) + id: In(hits), }, order: { - id: -1 - } + id: -1, + }, }); return await Notes.packMany(notes, me); diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index fad63d6483..1f7f84cbe4 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -13,7 +13,7 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, res: { @@ -26,9 +26,9 @@ export const meta = { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '24fcbfc6-2e37-42b6-8388-c29b3861a08d' - } - } + id: '24fcbfc6-2e37-42b6-8388-c29b3861a08d', + }, + }, }; export default define(meta, async (ps, user) => { @@ -38,6 +38,6 @@ export default define(meta, async (ps, user) => { }); return await Notes.pack(note, user, { - detail: true + detail: true, }); }); diff --git a/packages/backend/src/server/api/endpoints/notes/state.ts b/packages/backend/src/server/api/endpoints/notes/state.ts index b3913a5e79..9673b5a77c 100644 --- a/packages/backend/src/server/api/endpoints/notes/state.ts +++ b/packages/backend/src/server/api/endpoints/notes/state.ts @@ -11,7 +11,7 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, res: { @@ -20,18 +20,18 @@ export const meta = { properties: { isFavorited: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isWatching: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isMutedThread: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, - } - } + }, + }, }; export default define(meta, async (ps, user) => { @@ -43,21 +43,21 @@ export default define(meta, async (ps, user) => { userId: user.id, noteId: note.id, }, - take: 1 + take: 1, }), NoteWatchings.count({ where: { userId: user.id, noteId: note.id, }, - take: 1 + take: 1, }), NoteThreadMutings.count({ where: { userId: user.id, threadId: note.threadId || note.id, }, - take: 1 + take: 1, }), ]); diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index 2010d54331..dd2f887f01 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -17,16 +17,16 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '5ff67ada-ed3b-2e71-8e87-a1a421e177d2' - } - } + id: '5ff67ada-ed3b-2e71-8e87-a1a421e177d2', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index 05d5691870..d34c99f901 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -15,16 +15,16 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'bddd57ac-ceb3-b29d-4334-86ea5fae481a' - } - } + id: 'bddd57ac-ceb3-b29d-4334-86ea5fae481a', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index 7a69b1590d..211b8d4f40 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -67,7 +67,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; @@ -76,7 +76,7 @@ export default define(meta, async (ps, user) => { where: { followerId: user.id, }, - take: 1 + take: 1, })) !== 0; //#region Construct query diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index b56b1debdd..647ae4efe7 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -33,9 +33,9 @@ export const meta = { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'bea9b03f-36e0-49c5-a4db-627a029f8971' - } - } + id: 'bea9b03f-36e0-49c5-a4db-627a029f8971', + }, + }, }; export default define(meta, async (ps, user) => { @@ -73,7 +73,7 @@ export default define(meta, async (ps, user) => { headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': config.userAgent, - Accept: 'application/json, */*' + Accept: 'application/json, */*', }, body: params, timeout: 10000, @@ -84,6 +84,6 @@ export default define(meta, async (ps, user) => { return { sourceLang: json.translations[0].detected_source_language, - text: json.translations[0].text + text: json.translations[0].text, }; }); diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index d3fba66095..3661db4d86 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -17,22 +17,22 @@ export const meta = { limit: { duration: ms('1hour'), max: 300, - minInterval: ms('1sec') + minInterval: ms('1sec'), }, params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'efd4a259-2442-496b-8dd7-b255aa1a160f' + id: 'efd4a259-2442-496b-8dd7-b255aa1a160f', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -43,7 +43,7 @@ export default define(meta, async (ps, user) => { const renotes = await Notes.find({ userId: user.id, - renoteId: note.id + renoteId: note.id, }); for (const note of renotes) { diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 32c370004c..d614ddf453 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -66,22 +66,22 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { noSuchList: { message: 'No such list.', code: 'NO_SUCH_LIST', - id: '8fb1fbd5-e476-4c37-9fb0-43d55b63a2ff' - } - } + id: '8fb1fbd5-e476-4c37-9fb0-43d55b63a2ff', + }, + }, }; export default define(meta, async (ps, user) => { const list = await UserLists.findOne({ id: ps.listId, - userId: user.id + userId: user.id, }); if (list == null) { diff --git a/packages/backend/src/server/api/endpoints/notes/watching/create.ts b/packages/backend/src/server/api/endpoints/notes/watching/create.ts index 4d182d3715..7f724953df 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/create.ts @@ -15,16 +15,16 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'ea0e37a6-90a3-4f58-ba6b-c328ca206fc7' - } - } + id: 'ea0e37a6-90a3-4f58-ba6b-c328ca206fc7', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts index dd58c52b57..76a368c51d 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts @@ -15,16 +15,16 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: '09b3695c-f72c-4731-a428-7cff825fc82e' - } - } + id: '09b3695c-f72c-4731-a428-7cff825fc82e', + }, + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index 8003c497ee..e285eae460 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -11,20 +11,20 @@ export const meta = { params: { body: { - validator: $.str + validator: $.str, }, header: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, icon: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, }, errors: { - } + }, }; export default define(meta, async (ps, user, token) => { diff --git a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts index 8d4e512750..963af6cb43 100644 --- a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -7,7 +7,7 @@ export const meta = { requireCredential: true as const, - kind: 'write:notifications' + kind: 'write:notifications', }; export default define(meta, async (ps, user) => { @@ -16,7 +16,7 @@ export default define(meta, async (ps, user) => { notifieeId: user.id, isRead: false, }, { - isRead: true + isRead: true, }); // 全ての通知を読みましたよというイベントを発行 diff --git a/packages/backend/src/server/api/endpoints/notifications/read.ts b/packages/backend/src/server/api/endpoints/notifications/read.ts index 66bbc4efd7..9ff0bbeb83 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -23,7 +23,7 @@ export const meta = { noSuchNotification: { message: 'No such notification.', code: 'NO_SUCH_NOTIFICATION', - id: 'efa929d5-05b5-47d1-beec-e6a4dbed011e' + id: 'efa929d5-05b5-47d1-beec-e6a4dbed011e', }, }, }; diff --git a/packages/backend/src/server/api/endpoints/page-push.ts b/packages/backend/src/server/api/endpoints/page-push.ts index a0412e89f1..421eed5ea1 100644 --- a/packages/backend/src/server/api/endpoints/page-push.ts +++ b/packages/backend/src/server/api/endpoints/page-push.ts @@ -11,25 +11,25 @@ export const meta = { params: { pageId: { - validator: $.type(ID) + validator: $.type(ID), }, event: { - validator: $.str + validator: $.str, }, var: { - validator: $.optional.nullable.any - } + validator: $.optional.nullable.any, + }, }, errors: { noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: '4a13ad31-6729-46b4-b9af-e86b265c2e74' - } - } + id: '4a13ad31-6729-46b4-b9af-e86b265c2e74', + }, + }, }; export default define(meta, async (ps, user) => { @@ -44,7 +44,7 @@ export default define(meta, async (ps, user) => { var: ps.var, userId: user.id, user: await Users.pack(user.id, { id: page.userId }, { - detail: true - }) + detail: true, + }), }); }); diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index 0ec287c592..441ba54265 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -16,7 +16,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 300 + max: 300, }, params: { @@ -33,11 +33,11 @@ export const meta = { }, content: { - validator: $.arr($.obj()) + validator: $.arr($.obj()), }, variables: { - validator: $.arr($.obj()) + validator: $.arr($.obj()), }, script: { @@ -50,17 +50,17 @@ export const meta = { font: { validator: $.optional.str.or(['serif', 'sans-serif']), - default: 'sans-serif' + default: 'sans-serif', }, alignCenter: { validator: $.optional.bool, - default: false + default: false, }, hideTitleWhenPinned: { validator: $.optional.bool, - default: false + default: false, }, }, @@ -74,14 +74,14 @@ export const meta = { noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'b7b97489-0f66-4b12-a5ff-b21bd63f6e1c' + id: 'b7b97489-0f66-4b12-a5ff-b21bd63f6e1c', }, nameAlreadyExists: { message: 'Specified name already exists.', code: 'NAME_ALREADY_EXISTS', - id: '4650348e-301c-499a-83c9-6aa988c66bc1' - } - } + id: '4650348e-301c-499a-83c9-6aa988c66bc1', + }, + }, }; export default define(meta, async (ps, user) => { @@ -89,7 +89,7 @@ export default define(meta, async (ps, user) => { if (ps.eyeCatchingImageId != null) { eyeCatchingImage = await DriveFiles.findOne({ id: ps.eyeCatchingImageId, - userId: user.id + userId: user.id, }); if (eyeCatchingImage == null) { @@ -99,7 +99,7 @@ export default define(meta, async (ps, user) => { await Pages.find({ userId: user.id, - name: ps.name + name: ps.name, }).then(result => { if (result.length > 0) { throw new ApiError(meta.errors.nameAlreadyExists); @@ -121,7 +121,7 @@ export default define(meta, async (ps, user) => { visibility: 'public', alignCenter: ps.alignCenter, hideTitleWhenPinned: ps.hideTitleWhenPinned, - font: ps.font + font: ps.font, })); return await Pages.pack(page); diff --git a/packages/backend/src/server/api/endpoints/pages/delete.ts b/packages/backend/src/server/api/endpoints/pages/delete.ts index b1f8c8a709..7a45237697 100644 --- a/packages/backend/src/server/api/endpoints/pages/delete.ts +++ b/packages/backend/src/server/api/endpoints/pages/delete.ts @@ -21,15 +21,15 @@ export const meta = { noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: 'eb0c6e1d-d519-4764-9486-52a7e1c6392a' + id: 'eb0c6e1d-d519-4764-9486-52a7e1c6392a', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '8b741b3e-2c22-44b3-a15f-29949aa1601e' + id: '8b741b3e-2c22-44b3-a15f-29949aa1601e', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/pages/featured.ts b/packages/backend/src/server/api/endpoints/pages/featured.ts index f891c45f05..1dcfb8dd83 100644 --- a/packages/backend/src/server/api/endpoints/pages/featured.ts +++ b/packages/backend/src/server/api/endpoints/pages/featured.ts @@ -13,7 +13,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Page', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index a95a377802..f48359ab2d 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -15,28 +15,28 @@ export const meta = { params: { pageId: { validator: $.type(ID), - } + }, }, errors: { noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: 'cc98a8a2-0dc3-4123-b198-62c71df18ed3' + id: 'cc98a8a2-0dc3-4123-b198-62c71df18ed3', }, yourPage: { message: 'You cannot like your page.', code: 'YOUR_PAGE', - id: '28800466-e6db-40f2-8fae-bf9e82aa92b8' + id: '28800466-e6db-40f2-8fae-bf9e82aa92b8', }, alreadyLiked: { message: 'The page has already been liked.', code: 'ALREADY_LIKED', - id: 'cc98a8a2-0dc3-4123-b198-62c71df18ed3' + id: 'cc98a8a2-0dc3-4123-b198-62c71df18ed3', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -52,7 +52,7 @@ export default define(meta, async (ps, user) => { // if already liked const exist = await PageLikes.findOne({ pageId: page.id, - userId: user.id + userId: user.id, }); if (exist != null) { @@ -64,7 +64,7 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), pageId: page.id, - userId: user.id + userId: user.id, }); Pages.increment({ id: page.id }, 'likedCount', 1); diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index 7c55d4a9e6..d94c7457da 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -34,9 +34,9 @@ export const meta = { noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: '222120c0-3ead-4528-811b-b96f233388d7' - } - } + id: '222120c0-3ead-4528-811b-b96f233388d7', + }, + }, }; export default define(meta, async (ps, user) => { @@ -47,12 +47,12 @@ export default define(meta, async (ps, user) => { } else if (ps.name && ps.username) { const author = await Users.findOne({ host: null, - usernameLower: ps.username.toLowerCase() + usernameLower: ps.username.toLowerCase(), }); if (author) { page = await Pages.findOne({ name: ps.name, - userId: author.id + userId: author.id, }); } } diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index facf2d6d5f..5a2b68e425 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -14,22 +14,22 @@ export const meta = { params: { pageId: { validator: $.type(ID), - } + }, }, errors: { noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: 'a0d41e20-1993-40bd-890e-f6e560ae648e' + id: 'a0d41e20-1993-40bd-890e-f6e560ae648e', }, notLiked: { message: 'You have not liked that page.', code: 'NOT_LIKED', - id: 'f5e586b0-ce93-4050-b0e3-7f31af5259ee' + id: 'f5e586b0-ce93-4050-b0e3-7f31af5259ee', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -40,7 +40,7 @@ export default define(meta, async (ps, user) => { const exist = await PageLikes.findOne({ pageId: page.id, - userId: user.id + userId: user.id, }); if (exist == null) { diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 4aaf2aed5d..f980d9207b 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -15,7 +15,7 @@ export const meta = { limit: { duration: ms('1hour'), - max: 300 + max: 300, }, params: { @@ -36,11 +36,11 @@ export const meta = { }, content: { - validator: $.arr($.obj()) + validator: $.arr($.obj()), }, variables: { - validator: $.arr($.obj()) + validator: $.arr($.obj()), }, script: { @@ -68,26 +68,26 @@ export const meta = { noSuchPage: { message: 'No such page.', code: 'NO_SUCH_PAGE', - id: '21149b9e-3616-4778-9592-c4ce89f5a864' + id: '21149b9e-3616-4778-9592-c4ce89f5a864', }, accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', - id: '3c15cd52-3b4b-4274-967d-6456fc4f792b' + id: '3c15cd52-3b4b-4274-967d-6456fc4f792b', }, noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', - id: 'cfc23c7c-3887-490e-af30-0ed576703c82' + id: 'cfc23c7c-3887-490e-af30-0ed576703c82', }, nameAlreadyExists: { message: 'Specified name already exists.', code: 'NAME_ALREADY_EXISTS', - id: '2298a392-d4a1-44c5-9ebb-ac1aeaa5a9ab' - } - } + id: '2298a392-d4a1-44c5-9ebb-ac1aeaa5a9ab', + }, + }, }; export default define(meta, async (ps, user) => { @@ -103,7 +103,7 @@ export default define(meta, async (ps, user) => { if (ps.eyeCatchingImageId != null) { eyeCatchingImage = await DriveFiles.findOne({ id: ps.eyeCatchingImageId, - userId: user.id + userId: user.id, }); if (eyeCatchingImage == null) { @@ -114,7 +114,7 @@ export default define(meta, async (ps, user) => { await Pages.find({ id: Not(ps.pageId), userId: user.id, - name: ps.name + name: ps.name, }).then(result => { if (result.length > 0) { throw new ApiError(meta.errors.nameAlreadyExists); diff --git a/packages/backend/src/server/api/endpoints/ping.ts b/packages/backend/src/server/api/endpoints/ping.ts index 0b1bb6e164..c8f67981f5 100644 --- a/packages/backend/src/server/api/endpoints/ping.ts +++ b/packages/backend/src/server/api/endpoints/ping.ts @@ -16,8 +16,8 @@ export const meta = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } - } + }, + }, }; export default define(meta, async () => { diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index 39cf7b0df1..9d8d3963b4 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -19,7 +19,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/promo/read.ts b/packages/backend/src/server/api/endpoints/promo/read.ts index ae57bf9cf1..ac3cd9cd0b 100644 --- a/packages/backend/src/server/api/endpoints/promo/read.ts +++ b/packages/backend/src/server/api/endpoints/promo/read.ts @@ -14,16 +14,16 @@ export const meta = { params: { noteId: { validator: $.type(ID), - } + }, }, errors: { noSuchNote: { message: 'No such note.', code: 'NO_SUCH_NOTE', - id: 'd785b897-fcd3-4fe9-8fc3-b85c26e6c932' + id: 'd785b897-fcd3-4fe9-8fc3-b85c26e6c932', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -34,7 +34,7 @@ export default define(meta, async (ps, user) => { const exist = await PromoReads.findOne({ noteId: note.id, - userId: user.id + userId: user.id, }); if (exist != null) { @@ -45,6 +45,6 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), noteId: note.id, - userId: user.id + userId: user.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/request-reset-password.ts b/packages/backend/src/server/api/endpoints/request-reset-password.ts index 7bb50bf6a6..6caf572222 100644 --- a/packages/backend/src/server/api/endpoints/request-reset-password.ts +++ b/packages/backend/src/server/api/endpoints/request-reset-password.ts @@ -15,28 +15,28 @@ export const meta = { limit: { duration: ms('1hour'), - max: 3 + max: 3, }, params: { username: { - validator: $.str + validator: $.str, }, email: { - validator: $.str + validator: $.str, }, }, errors: { - } + }, }; export default define(meta, async (ps) => { const user = await Users.findOne({ usernameLower: ps.username.toLowerCase(), - host: IsNull() + host: IsNull(), }); // 合致するユーザーが登録されていなかったら無視 @@ -62,7 +62,7 @@ export default define(meta, async (ps) => { id: genId(), createdAt: new Date(), userId: profile.userId, - token + token, }); const link = `${config.url}/reset-password/${token}`; diff --git a/packages/backend/src/server/api/endpoints/reset-db.ts b/packages/backend/src/server/api/endpoints/reset-db.ts index f0a9dae4ff..f6fd5735d9 100644 --- a/packages/backend/src/server/api/endpoints/reset-db.ts +++ b/packages/backend/src/server/api/endpoints/reset-db.ts @@ -11,7 +11,7 @@ export const meta = { errors: { - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index 53b0bfde0b..706f0a32c0 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -10,17 +10,17 @@ export const meta = { params: { token: { - validator: $.str + validator: $.str, }, password: { - validator: $.str - } + validator: $.str, + }, }, errors: { - } + }, }; export default define(meta, async (ps, user) => { @@ -38,7 +38,7 @@ export default define(meta, async (ps, user) => { const hash = await bcrypt.hash(ps.password, salt); await UserProfiles.update(req.userId, { - password: hash + password: hash, }); PasswordResetRequests.delete(req.id); diff --git a/packages/backend/src/server/api/endpoints/room/show.ts b/packages/backend/src/server/api/endpoints/room/show.ts index a6461d4a6e..ec53982ebb 100644 --- a/packages/backend/src/server/api/endpoints/room/show.ts +++ b/packages/backend/src/server/api/endpoints/room/show.ts @@ -16,11 +16,11 @@ export const meta = { }, username: { - validator: $.optional.str + validator: $.optional.str, }, host: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, }, @@ -28,8 +28,8 @@ export const meta = { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '7ad3fa3e-5e12-42f0-b23a-f3d13f10ee4b' - } + id: '7ad3fa3e-5e12-42f0-b23a-f3d13f10ee4b', + }, }, res: { @@ -39,7 +39,7 @@ export const meta = { roomType: { type: 'string' as const, optional: false as const, nullable: false as const, - enum: ['default', 'washitsu'] + enum: ['default', 'washitsu'], }, furnitures: { type: 'array' as const, @@ -50,11 +50,11 @@ export const meta = { properties: { id: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, type: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, props: { type: 'object' as const, @@ -66,17 +66,17 @@ export const meta = { properties: { x: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, y: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, z: { type: 'number' as const, - optional: false as const, nullable: false as const - } - } + optional: false as const, nullable: false as const, + }, + }, }, rotation: { type: 'object' as const, @@ -84,29 +84,29 @@ export const meta = { properties: { x: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, y: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, z: { type: 'number' as const, - optional: false as const, nullable: false as const - } - } - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, + }, + }, }, carpetColor: { type: 'string' as const, optional: false as const, nullable: false as const, format: 'hex', - example: '#85CAF0' - } - } - } + example: '#85CAF0', + }, + }, + }, }; export default define(meta, async (ps, me) => { @@ -124,8 +124,8 @@ export default define(meta, async (ps, me) => { await UserProfiles.update(user.id, { room: { furnitures: [], - ...profile.room - } + ...profile.room, + }, }); profile.room.furnitures = []; @@ -136,8 +136,8 @@ export default define(meta, async (ps, me) => { await UserProfiles.update(user.id, { room: { roomType: initialType as any, - ...profile.room - } + ...profile.room, + }, }); profile.room.roomType = initialType; @@ -148,8 +148,8 @@ export default define(meta, async (ps, me) => { await UserProfiles.update(user.id, { room: { carpetColor: initialColor as any, - ...profile.room - } + ...profile.room, + }, }); profile.room.carpetColor = initialColor; diff --git a/packages/backend/src/server/api/endpoints/room/update.ts b/packages/backend/src/server/api/endpoints/room/update.ts index 8c4cfbdea6..f9fc2b278e 100644 --- a/packages/backend/src/server/api/endpoints/room/update.ts +++ b/packages/backend/src/server/api/endpoints/room/update.ts @@ -27,20 +27,20 @@ export const meta = { props: $.optional.nullable.obj(), })), roomType: $.str, - carpetColor: $.str - }) + carpetColor: $.str, + }), }, }, }; export default define(meta, async (ps, user) => { await UserProfiles.update(user.id, { - room: ps.room as any + room: ps.room as any, }); const iObj = await Users.pack(user.id, user, { detail: true, - includeSecrets: true + includeSecrets: true, }); // Publish meUpdated event diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index 4e636d331c..be502cf24a 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -22,10 +22,10 @@ export default define(meta, async () => { machine: os.hostname(), cpu: { model: os.cpus()[0].model, - cores: os.cpus().length + cores: os.cpus().length, }, mem: { - total: memStats.total + total: memStats.total, }, fs: { total: fsStats[0].size, diff --git a/packages/backend/src/server/api/endpoints/stats.ts b/packages/backend/src/server/api/endpoints/stats.ts index 15c8001742..f47b0d0a2b 100644 --- a/packages/backend/src/server/api/endpoints/stats.ts +++ b/packages/backend/src/server/api/endpoints/stats.ts @@ -36,14 +36,14 @@ export const meta = { }, driveUsageLocal: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, driveUsageRemote: { type: 'number' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async () => { @@ -56,7 +56,7 @@ export default define(meta, async () => { //originalReactionsCount, instances, driveUsageLocal, - driveUsageRemote + driveUsageRemote, ] = await Promise.all([ Notes.count({ cache: 3600000 }), // 1 hour Notes.count({ where: { userHost: null }, cache: 3600000 }), @@ -78,6 +78,6 @@ export default define(meta, async () => { //originalReactionsCount, instances, driveUsageLocal, - driveUsageRemote + driveUsageRemote, }; }); diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index 6e14ba2669..9734746770 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -11,16 +11,16 @@ export const meta = { params: { endpoint: { - validator: $.str + validator: $.str, }, auth: { - validator: $.str + validator: $.str, }, publickey: { - validator: $.str - } + validator: $.str, + }, }, res: { @@ -30,14 +30,14 @@ export const meta = { state: { type: 'string' as const, optional: false as const, nullable: false as const, - enum: ['already-subscribed', 'subscribed'] + enum: ['already-subscribed', 'subscribed'], }, key: { type: 'string' as const, - optional: false as const, nullable: false as const - } - } - } + optional: false as const, nullable: false as const, + }, + }, + }, }; export default define(meta, async (ps, user) => { @@ -54,7 +54,7 @@ export default define(meta, async (ps, user) => { if (exist != null) { return { state: 'already-subscribed', - key: instance.swPublicKey + key: instance.swPublicKey, }; } @@ -64,11 +64,11 @@ export default define(meta, async (ps, user) => { userId: user.id, endpoint: ps.endpoint, auth: ps.auth, - publickey: ps.publickey + publickey: ps.publickey, }); return { state: 'subscribed', - key: instance.swPublicKey + key: instance.swPublicKey, }; }); diff --git a/packages/backend/src/server/api/endpoints/sw/unregister.ts b/packages/backend/src/server/api/endpoints/sw/unregister.ts index 817ad1f517..24ee861f16 100644 --- a/packages/backend/src/server/api/endpoints/sw/unregister.ts +++ b/packages/backend/src/server/api/endpoints/sw/unregister.ts @@ -9,9 +9,9 @@ export const meta = { params: { endpoint: { - validator: $.str + validator: $.str, }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index 1ae75448ea..f1b46a2b65 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -9,8 +9,8 @@ export const meta = { params: { username: { - validator: $.use(Users.validateLocalUsername) - } + validator: $.use(Users.validateLocalUsername), + }, }, res: { @@ -20,21 +20,21 @@ export const meta = { available: { type: 'boolean' as const, optional: false as const, nullable: false as const, - } - } - } + }, + }, + }, }; export default define(meta, async (ps) => { // Get exist const exist = await Users.count({ host: null, - usernameLower: ps.username.toLowerCase() + usernameLower: ps.username.toLowerCase(), }); const exist2 = await UsedUsernames.count({ username: ps.username.toLowerCase() }); return { - available: exist === 0 && exist2 === 0 + available: exist === 0 && exist2 === 0, }; }); diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 930dcc7616..601578de27 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -12,12 +12,12 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num.min(0), - default: 0 + default: 0, }, sort: { @@ -37,9 +37,9 @@ export const meta = { 'admin', 'moderator', 'adminOrModerator', - 'alive' + 'alive', ]), - default: 'all' + default: 'all', }, origin: { @@ -48,8 +48,8 @@ export const meta = { 'local', 'remote', ]), - default: 'local' - } + default: 'local', + }, }, res: { @@ -59,7 +59,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index 8feca9422a..f5964c54db 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -14,7 +14,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -24,7 +24,7 @@ export const meta = { untilId: { validator: $.optional.type(ID), }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 6d042a2861..535b10412e 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -17,11 +17,11 @@ export const meta = { }, username: { - validator: $.optional.str + validator: $.optional.str, }, host: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, sinceId: { @@ -34,7 +34,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -45,22 +45,22 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Following', - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '27fa5435-88ab-43de-9360-387de88727cd' + id: '27fa5435-88ab-43de-9360-387de88727cd', }, forbidden: { message: 'Forbidden.', code: 'FORBIDDEN', - id: '3c6a84db-d619-26af-ca14-06232a21df8a' + id: '3c6a84db-d619-26af-ca14-06232a21df8a', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 1033117ef8..58c72bb957 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -17,11 +17,11 @@ export const meta = { }, username: { - validator: $.optional.str + validator: $.optional.str, }, host: { - validator: $.optional.nullable.str + validator: $.optional.nullable.str, }, sinceId: { @@ -34,7 +34,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -45,22 +45,22 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Following', - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '63e4aba4-4156-4e53-be25-c9559e42d71b' + id: '63e4aba4-4156-4e53-be25-c9559e42d71b', }, forbidden: { message: 'Forbidden.', code: 'FORBIDDEN', - id: 'f6cdb0df-c19f-ec5c-7dbb-0ba84a1f92ba' + id: 'f6cdb0df-c19f-ec5c-7dbb-0ba84a1f92ba', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index 845de1089c..6ef884deda 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -14,7 +14,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -24,7 +24,7 @@ export const meta = { untilId: { validator: $.optional.type(ID), }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts index 32ebfd683a..a88de7ac83 100644 --- a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -19,7 +19,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, }, @@ -30,16 +30,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: 'e6965129-7b2a-40a4-bae2-cd84cd434822' - } - } + id: 'e6965129-7b2a-40a4-bae2-cd84cd434822', + }, + }, }; export default define(meta, async (ps, me) => { @@ -53,13 +53,13 @@ export default define(meta, async (ps, me) => { const recentNotes = await Notes.find({ where: { userId: user.id, - replyId: Not(IsNull()) + replyId: Not(IsNull()), }, order: { - id: -1 + id: -1, }, take: 1000, - select: ['replyId'] + select: ['replyId'], }); // 投稿が少なかったら中断 @@ -72,7 +72,7 @@ export default define(meta, async (ps, me) => { where: { id: In(recentNotes.map(p => p.replyId)), }, - select: ['userId'] + select: ['userId'], }); const repliedUsers: any = {}; @@ -98,7 +98,7 @@ export default define(meta, async (ps, me) => { // Make replies object (includes weights) const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({ user: await Users.pack(user, me, { detail: true }), - weight: repliedUsers[user] / peak + weight: repliedUsers[user] / peak, }))); return repliesObj; diff --git a/packages/backend/src/server/api/endpoints/users/groups/create.ts b/packages/backend/src/server/api/endpoints/users/groups/create.ts index dc1ee3879e..12ee11ba55 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/create.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/create.ts @@ -14,8 +14,8 @@ export const meta = { params: { name: { - validator: $.str.range(1, 100) - } + validator: $.str.range(1, 100), + }, }, res: { @@ -38,7 +38,7 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), userId: user.id, - userGroupId: userGroup.id + userGroupId: userGroup.id, } as UserGroupJoining); return await UserGroups.pack(userGroup); diff --git a/packages/backend/src/server/api/endpoints/users/groups/delete.ts b/packages/backend/src/server/api/endpoints/users/groups/delete.ts index 7da1b4a273..dbc77dd8fe 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/delete.ts @@ -14,22 +14,22 @@ export const meta = { params: { groupId: { validator: $.type(ID), - } + }, }, errors: { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: '63dbd64c-cd77-413f-8e08-61781e210b38' - } - } + id: '63dbd64c-cd77-413f-8e08-61781e210b38', + }, + }, }; export default define(meta, async (ps, user) => { const userGroup = await UserGroups.findOne({ id: ps.groupId, - userId: user.id + userId: user.id, }); if (userGroup == null) { diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts index 09e6ae2647..fef94c306f 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -23,9 +23,9 @@ export const meta = { noSuchInvitation: { message: 'No such invitation.', code: 'NO_SUCH_INVITATION', - id: '98c11eca-c890-4f42-9806-c8c8303ebb5e' + id: '98c11eca-c890-4f42-9806-c8c8303ebb5e', }, - } + }, }; export default define(meta, async (ps, user) => { @@ -47,7 +47,7 @@ export default define(meta, async (ps, user) => { id: genId(), createdAt: new Date(), userId: user.id, - userGroupId: invitation.userGroupId + userGroupId: invitation.userGroupId, } as UserGroupJoining); UserGroupInvitations.delete(invitation.id); diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts index 741fcefb35..33a202f029 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -21,9 +21,9 @@ export const meta = { noSuchInvitation: { message: 'No such invitation.', code: 'NO_SUCH_INVITATION', - id: 'ad7471d4-2cd9-44b4-ac68-e7136b4ce656' + id: 'ad7471d4-2cd9-44b4-ac68-e7136b4ce656', }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/users/groups/invite.ts b/packages/backend/src/server/api/endpoints/users/groups/invite.ts index f1ee8bf8b7..4dee18fcb0 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invite.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invite.ts @@ -29,27 +29,27 @@ export const meta = { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: '583f8bc0-8eee-4b78-9299-1e14fc91e409' + id: '583f8bc0-8eee-4b78-9299-1e14fc91e409', }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: 'da52de61-002c-475b-90e1-ba64f9cf13a8' + id: 'da52de61-002c-475b-90e1-ba64f9cf13a8', }, alreadyAdded: { message: 'That user has already been added to that group.', code: 'ALREADY_ADDED', - id: '7e35c6a0-39b2-4488-aea6-6ee20bd5da2c' + id: '7e35c6a0-39b2-4488-aea6-6ee20bd5da2c', }, alreadyInvited: { message: 'That user has already been invited to that group.', code: 'ALREADY_INVITED', - id: 'ee0f58b4-b529-4d13-b761-b9a3e69f97e6' - } - } + id: 'ee0f58b4-b529-4d13-b761-b9a3e69f97e6', + }, + }, }; export default define(meta, async (ps, me) => { @@ -71,7 +71,7 @@ export default define(meta, async (ps, me) => { const joining = await UserGroupJoinings.findOne({ userGroupId: userGroup.id, - userId: user.id + userId: user.id, }); if (joining) { @@ -80,7 +80,7 @@ export default define(meta, async (ps, me) => { const existInvitation = await UserGroupInvitations.findOne({ userGroupId: userGroup.id, - userId: user.id + userId: user.id, }); if (existInvitation) { @@ -91,12 +91,12 @@ export default define(meta, async (ps, me) => { id: genId(), createdAt: new Date(), userId: user.id, - userGroupId: userGroup.id + userGroupId: userGroup.id, } as UserGroupInvitation).then(x => UserGroupInvitations.findOneOrFail(x.identifiers[0])); // 通知を作成 createNotification(user.id, 'groupInvited', { notifierId: me.id, - userGroupInvitationId: invitation.id + userGroupInvitationId: invitation.id, }); }); diff --git a/packages/backend/src/server/api/endpoints/users/groups/joined.ts b/packages/backend/src/server/api/endpoints/users/groups/joined.ts index d5e8fe4032..1bd065ca00 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/joined.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/joined.ts @@ -16,7 +16,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'UserGroup', - } + }, }, }; @@ -28,8 +28,8 @@ export default define(meta, async (ps, me) => { const joinings = await UserGroupJoinings.find({ userId: me.id, ...(ownedGroups.length > 0 ? { - userGroupId: Not(In(ownedGroups.map(x => x.id))) - } : {}) + userGroupId: Not(In(ownedGroups.map(x => x.id))), + } : {}), }); return await Promise.all(joinings.map(x => UserGroups.pack(x.userGroupId))); diff --git a/packages/backend/src/server/api/endpoints/users/groups/leave.ts b/packages/backend/src/server/api/endpoints/users/groups/leave.ts index 0e52f2abdf..9a41175d63 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/leave.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/leave.ts @@ -21,15 +21,15 @@ export const meta = { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: '62780270-1f67-5dc0-daca-3eb510612e31' + id: '62780270-1f67-5dc0-daca-3eb510612e31', }, youAreOwner: { message: 'Your are the owner.', code: 'YOU_ARE_OWNER', - id: 'b6d6e0c2-ef8a-9bb8-653d-79f4a3107c69' + id: 'b6d6e0c2-ef8a-9bb8-653d-79f4a3107c69', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/groups/owned.ts b/packages/backend/src/server/api/endpoints/users/groups/owned.ts index 17de370dbc..69e4c85717 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/owned.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/owned.ts @@ -15,7 +15,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'UserGroup', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/users/groups/pull.ts b/packages/backend/src/server/api/endpoints/users/groups/pull.ts index ce4d2e2881..70c1457dcd 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/pull.ts @@ -26,21 +26,21 @@ export const meta = { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: '4662487c-05b1-4b78-86e5-fd46998aba74' + id: '4662487c-05b1-4b78-86e5-fd46998aba74', }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '0b5cc374-3681-41da-861e-8bc1146f7a55' + id: '0b5cc374-3681-41da-861e-8bc1146f7a55', }, isOwner: { message: 'The user is the owner.', code: 'IS_OWNER', - id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af' + id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/groups/show.ts b/packages/backend/src/server/api/endpoints/users/groups/show.ts index 3c030bf3a5..0bb06f8df4 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/show.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/show.ts @@ -27,9 +27,9 @@ export const meta = { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: 'ea04751e-9b7e-487b-a509-330fb6bd6b9b' + id: 'ea04751e-9b7e-487b-a509-330fb6bd6b9b', }, - } + }, }; export default define(meta, async (ps, me) => { @@ -44,7 +44,7 @@ export default define(meta, async (ps, me) => { const joining = await UserGroupJoinings.findOne({ userId: me.id, - userGroupId: userGroup.id + userGroupId: userGroup.id, }); if (joining == null && userGroup.userId !== me.id) { diff --git a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts index 17c42e1127..54cf8197e7 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts @@ -32,21 +32,21 @@ export const meta = { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: '8e31d36b-2f88-4ccd-a438-e2d78a9162db' + id: '8e31d36b-2f88-4ccd-a438-e2d78a9162db', }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '711f7ebb-bbb9-4dfa-b540-b27809fed5e9' + id: '711f7ebb-bbb9-4dfa-b540-b27809fed5e9', }, noSuchGroupMember: { message: 'No such group member.', code: 'NO_SUCH_GROUP_MEMBER', - id: 'd31bebee-196d-42c2-9a3e-9474d4be6cc4' + id: 'd31bebee-196d-42c2-9a3e-9474d4be6cc4', }, - } + }, }; export default define(meta, async (ps, me) => { @@ -68,7 +68,7 @@ export default define(meta, async (ps, me) => { const joining = await UserGroupJoinings.findOne({ userGroupId: userGroup.id, - userId: user.id + userId: user.id, }); if (joining == null) { @@ -76,7 +76,7 @@ export default define(meta, async (ps, me) => { } await UserGroups.update(userGroup.id, { - userId: ps.userId + userId: ps.userId, }); return await UserGroups.pack(userGroup.id); diff --git a/packages/backend/src/server/api/endpoints/users/groups/update.ts b/packages/backend/src/server/api/endpoints/users/groups/update.ts index 127bbc47a1..d16f1ac42b 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/update.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/update.ts @@ -18,7 +18,7 @@ export const meta = { name: { validator: $.str.range(1, 100), - } + }, }, res: { @@ -31,16 +31,16 @@ export const meta = { noSuchGroup: { message: 'No such group.', code: 'NO_SUCH_GROUP', - id: '9081cda3-7a9e-4fac-a6ce-908d70f282f6' + id: '9081cda3-7a9e-4fac-a6ce-908d70f282f6', }, - } + }, }; export default define(meta, async (ps, me) => { // Fetch the group const userGroup = await UserGroups.findOne({ id: ps.groupId, - userId: me.id + userId: me.id, }); if (userGroup == null) { @@ -48,7 +48,7 @@ export default define(meta, async (ps, me) => { } await UserGroups.update(userGroup.id, { - name: ps.name + name: ps.name, }); return await UserGroups.pack(userGroup.id); diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index e0bfe611fc..8372139f84 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -13,8 +13,8 @@ export const meta = { params: { name: { - validator: $.str.range(1, 100) - } + validator: $.str.range(1, 100), + }, }, res: { diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 5fe3bfb03d..fac4e90dbf 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -14,22 +14,22 @@ export const meta = { params: { listId: { validator: $.type(ID), - } + }, }, errors: { noSuchList: { message: 'No such list.', code: 'NO_SUCH_LIST', - id: '78436795-db79-42f5-b1e2-55ea2cf19166' - } - } + id: '78436795-db79-42f5-b1e2-55ea2cf19166', + }, + }, }; export default define(meta, async (ps, user) => { const userList = await UserLists.findOne({ id: ps.listId, - userId: user.id + userId: user.id, }); if (userList == null) { diff --git a/packages/backend/src/server/api/endpoints/users/lists/list.ts b/packages/backend/src/server/api/endpoints/users/lists/list.ts index cf0c92bb84..222c930d0e 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/list.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/list.ts @@ -15,7 +15,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'UserList', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index d4357fc5e7..86daa9b2e1 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -27,15 +27,15 @@ export const meta = { noSuchList: { message: 'No such list.', code: 'NO_SUCH_LIST', - id: '7f44670e-ab16-43b8-b4c1-ccd2ee89cc02' + id: '7f44670e-ab16-43b8-b4c1-ccd2ee89cc02', }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '588e7f72-c744-4a61-b180-d354e912bda2' - } - } + id: '588e7f72-c744-4a61-b180-d354e912bda2', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 8e21059d3d..77ecb4a223 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -27,27 +27,27 @@ export const meta = { noSuchList: { message: 'No such list.', code: 'NO_SUCH_LIST', - id: '2214501d-ac96-4049-b717-91e42272a711' + id: '2214501d-ac96-4049-b717-91e42272a711', }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: 'a89abd3d-f0bc-4cce-beb1-2f446f4f1e6a' + id: 'a89abd3d-f0bc-4cce-beb1-2f446f4f1e6a', }, alreadyAdded: { message: 'That user has already been added to that list.', code: 'ALREADY_ADDED', - id: '1de7c884-1595-49e9-857e-61f12f4d4fc5' + id: '1de7c884-1595-49e9-857e-61f12f4d4fc5', }, youHaveBeenBlocked: { message: 'You cannot push this user because you have been blocked by this user.', code: 'YOU_HAVE_BEEN_BLOCKED', - id: '990232c5-3f9d-4d83-9f3f-ef27b6332a4b' + id: '990232c5-3f9d-4d83-9f3f-ef27b6332a4b', }, - } + }, }; export default define(meta, async (ps, me) => { @@ -80,7 +80,7 @@ export default define(meta, async (ps, me) => { const exist = await UserListJoinings.findOne({ userListId: userList.id, - userId: user.id + userId: user.id, }); if (exist) { diff --git a/packages/backend/src/server/api/endpoints/users/lists/show.ts b/packages/backend/src/server/api/endpoints/users/lists/show.ts index f9a35cdab3..9c985bb091 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/show.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/show.ts @@ -27,9 +27,9 @@ export const meta = { noSuchList: { message: 'No such list.', code: 'NO_SUCH_LIST', - id: '7bc05c21-1d7a-41ae-88f1-66820f4dc686' + id: '7bc05c21-1d7a-41ae-88f1-66820f4dc686', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/lists/update.ts b/packages/backend/src/server/api/endpoints/users/lists/update.ts index 1185af5043..8a0f96a5d9 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/update.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/update.ts @@ -18,7 +18,7 @@ export const meta = { name: { validator: $.str.range(1, 100), - } + }, }, res: { @@ -31,16 +31,16 @@ export const meta = { noSuchList: { message: 'No such list.', code: 'NO_SUCH_LIST', - id: '796666fe-3dff-4d39-becb-8a5932c1d5b7' + id: '796666fe-3dff-4d39-becb-8a5932c1d5b7', }, - } + }, }; export default define(meta, async (ps, user) => { // Fetch the list const userList = await UserLists.findOne({ id: ps.listId, - userId: user.id + userId: user.id, }); if (userList == null) { @@ -48,7 +48,7 @@ export default define(meta, async (ps, user) => { } await UserLists.update(userList.id, { - name: ps.name + name: ps.name, }); return await UserLists.pack(userList.id); diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index e461672534..da8e858119 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -72,16 +72,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, errors: { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '27e494ba-2ac2-48e8-893b-10d4d8c2387b' - } - } + id: '27e494ba-2ac2-48e8-893b-10d4d8c2387b', + }, + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index 24e9e207fd..4763303a70 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -14,7 +14,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -24,7 +24,7 @@ export const meta = { untilId: { validator: $.optional.type(ID), }, - } + }, }; export default define(meta, async (ps, user) => { diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index fe5e4d84a9..626487176b 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -45,16 +45,16 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'NoteReaction', - } + }, }, errors: { reactionsNotPublic: { message: 'Reactions of the user is not public.', code: 'REACTIONS_NOT_PUBLIC', - id: '673a7dd2-6924-1093-e0c0-e68456ceae5c' + id: '673a7dd2-6924-1093-e0c0-e68456ceae5c', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 7c775c4dcf..71c564c980 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -15,13 +15,13 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, offset: { validator: $.optional.num.min(0), - default: 0 - } + default: 0, + }, }, res: { @@ -31,7 +31,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/users/relation.ts b/packages/backend/src/server/api/endpoints/users/relation.ts index 32d76a5322..af1984fa2b 100644 --- a/packages/backend/src/server/api/endpoints/users/relation.ts +++ b/packages/backend/src/server/api/endpoints/users/relation.ts @@ -11,7 +11,7 @@ export const meta = { params: { userId: { validator: $.either($.type(ID), $.arr($.type(ID)).unique()), - } + }, }, res: { @@ -23,37 +23,37 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, isFollowing: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hasPendingFollowRequestFromYou: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hasPendingFollowRequestToYou: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isFollowed: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isBlocking: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isBlocked: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isMuted: { type: 'boolean' as const, - optional: false as const, nullable: false as const - } - } + optional: false as const, nullable: false as const, + }, + }, }, { type: 'array' as const, @@ -65,41 +65,41 @@ export const meta = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, isFollowing: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hasPendingFollowRequestFromYou: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hasPendingFollowRequestToYou: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isFollowed: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isBlocking: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isBlocked: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isMuted: { type: 'boolean' as const, - optional: false as const, nullable: false as const - } - } - } - } - ] - } + optional: false as const, nullable: false as const, + }, + }, + }, + }, + ], + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 1ec5e1a743..58a8d929f7 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -37,7 +37,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 9aa988d9ed..f87088688c 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -42,7 +42,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'User', - } + }, }, }; diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index f056983636..eacb2aee16 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -23,12 +23,12 @@ export const meta = { }, username: { - validator: $.optional.str + validator: $.optional.str, }, host: { - validator: $.optional.nullable.str - } + validator: $.optional.nullable.str, + }, }, res: { @@ -42,15 +42,15 @@ export const meta = { message: 'Failed to resolve remote user.', code: 'FAILED_TO_RESOLVE_REMOTE_USER', id: 'ef7b9be4-9cba-4e6f-ab41-90ed171c7d3c', - kind: 'server' as const + kind: 'server' as const, }, noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '4362f8dc-731f-4ad8-a694-be5a88922a24' + id: '4362f8dc-731f-4ad8-a694-be5a88922a24', }, - } + }, }; export default define(meta, async (ps, me) => { @@ -64,10 +64,10 @@ export default define(meta, async (ps, me) => { } const users = await Users.find(isAdminOrModerator ? { - id: In(ps.userIds) + id: In(ps.userIds), } : { id: In(ps.userIds), - isSuspended: false + isSuspended: false, }); // リクエストされた通りに並べ替え @@ -77,7 +77,7 @@ export default define(meta, async (ps, me) => { } return await Promise.all(_users.map(u => Users.pack(u, me, { - detail: true + detail: true, }))); } else { // Lookup user @@ -99,7 +99,7 @@ export default define(meta, async (ps, me) => { } return await Users.pack(user, me, { - detail: true + detail: true, }); } }); diff --git a/packages/backend/src/server/api/endpoints/users/stats.ts b/packages/backend/src/server/api/endpoints/users/stats.ts index ef8afd5625..b8564218ac 100644 --- a/packages/backend/src/server/api/endpoints/users/stats.ts +++ b/packages/backend/src/server/api/endpoints/users/stats.ts @@ -19,9 +19,9 @@ export const meta = { noSuchUser: { message: 'No such user.', code: 'NO_SUCH_USER', - id: '9e638e45-3b25-4ef7-8f95-07e8498f1819' + id: '9e638e45-3b25-4ef7-8f95-07e8498f1819', }, - } + }, }; export default define(meta, async (ps, me) => { diff --git a/packages/backend/src/server/api/error.ts b/packages/backend/src/server/api/error.ts index cb0bdc9f47..3f0861fdb1 100644 --- a/packages/backend/src/server/api/error.ts +++ b/packages/backend/src/server/api/error.ts @@ -14,7 +14,7 @@ export class ApiError extends Error { code: 'INTERNAL_ERROR', id: '5d37dbcb-891e-41ca-a3d6-e690c97775ac', kind: 'server', - httpStatusCode: 500 + httpStatusCode: 500, }; super(e.message); diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index 82579075eb..8f8a9d999e 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -23,7 +23,7 @@ import config from '@/config'; const app = new Koa(); app.use(cors({ - origin: '*' + origin: '*', })); // No caching @@ -34,7 +34,7 @@ app.use(async (ctx, next) => { app.use(bodyParser({ // リクエストが multipart/form-data でない限りはJSONだと見なす - detectJSON: ctx => !ctx.is('multipart/form-data') + detectJSON: ctx => !ctx.is('multipart/form-data'), })); // Init multer instance @@ -43,7 +43,7 @@ const upload = multer({ limits: { fileSize: config.maxFileSize || 262144000, files: 1, - } + }, }); // Init router @@ -74,7 +74,7 @@ router.use(twitter.routes()); router.get('/v1/instance/peers', async ctx => { const instances = await Instances.find({ - select: ['host'] + select: ['host'], }); ctx.body = instances.map(instance => instance.host); @@ -82,18 +82,18 @@ router.get('/v1/instance/peers', async ctx => { router.post('/miauth/:session/check', async ctx => { const token = await AccessTokens.findOne({ - session: ctx.params.session + session: ctx.params.session, }); if (token && token.session != null && !token.fetched) { AccessTokens.update(token.id, { - fetched: true + fetched: true, }); ctx.body = { ok: true, token: token.token, - user: await Users.pack(token.userId, null, { detail: true }) + user: await Users.pack(token.userId, null, { detail: true }), }; } else { ctx.body = { diff --git a/packages/backend/src/server/api/limiter.ts b/packages/backend/src/server/api/limiter.ts index 82a8613c90..5f617771e0 100644 --- a/packages/backend/src/server/api/limiter.ts +++ b/packages/backend/src/server/api/limiter.ts @@ -35,7 +35,7 @@ export default (endpoint: IEndpoint, user: User) => new Promise<void>((ok, rejec id: `${user.id}:${key}:min`, duration: limitation.minInterval, max: 1, - db: redisClient + db: redisClient, }); minIntervalLimiter.get((err, info) => { @@ -63,7 +63,7 @@ export default (endpoint: IEndpoint, user: User) => new Promise<void>((ok, rejec id: `${user.id}:${key}`, duration: limitation.duration, max: limitation.max, - db: redisClient + db: redisClient, }); limiter.get((err, info) => { diff --git a/packages/backend/src/server/api/openapi/errors.ts b/packages/backend/src/server/api/openapi/errors.ts index 43bcc323ba..d7f791c6da 100644 --- a/packages/backend/src/server/api/openapi/errors.ts +++ b/packages/backend/src/server/api/openapi/errors.ts @@ -7,9 +7,9 @@ export const errors = { message: 'Invalid param.', code: 'INVALID_PARAM', id: '3d81ceae-475f-4600-b2a8-2bc116157532', - } - } - } + }, + }, + }, }, '401': { 'CREDENTIAL_REQUIRED': { @@ -18,9 +18,9 @@ export const errors = { message: 'Credential required.', code: 'CREDENTIAL_REQUIRED', id: '1384574d-a912-4b81-8601-c7b1c4085df1', - } - } - } + }, + }, + }, }, '403': { 'AUTHENTICATION_FAILED': { @@ -29,9 +29,9 @@ export const errors = { message: 'Authentication failed. Please ensure your token is correct.', code: 'AUTHENTICATION_FAILED', id: 'b0a7f5f8-dc2f-4171-b91f-de88ad238e14', - } - } - } + }, + }, + }, }, '418': { 'I_AM_AI': { @@ -40,9 +40,9 @@ export const errors = { message: 'You sent a request to Ai-chan, Misskey\'s showgirl, instead of the server.', code: 'I_AM_AI', id: '60c46cd1-f23a-46b1-bebe-5d2b73951a84', - } - } - } + }, + }, + }, }, '429': { 'RATE_LIMIT_EXCEEDED': { @@ -51,9 +51,9 @@ export const errors = { message: 'Rate limit exceeded. Please try again later.', code: 'RATE_LIMIT_EXCEEDED', id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef', - } - } - } + }, + }, + }, }, '500': { 'INTERNAL_ERROR': { @@ -62,8 +62,8 @@ export const errors = { message: 'Internal error occurred. Please contact us if the error persists.', code: 'INTERNAL_ERROR', id: '5d37dbcb-891e-41ca-a3d6-e690c97775ac', - } - } - } - } + }, + }, + }, + }, }; diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index 48b819727f..1c521f212f 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -11,16 +11,16 @@ export function genOpenapiSpec(lang = 'ja-JP') { info: { version: 'v1', title: 'Misskey API', - 'x-logo': { url: '/static-assets/api-doc.png' } + 'x-logo': { url: '/static-assets/api-doc.png' }, }, externalDocs: { description: 'Repository', - url: 'https://github.com/misskey-dev/misskey' + url: 'https://github.com/misskey-dev/misskey', }, servers: [{ - url: config.apiUrl + url: config.apiUrl, }], paths: {} as any, @@ -32,10 +32,10 @@ export function genOpenapiSpec(lang = 'ja-JP') { ApiKeyAuth: { type: 'apiKey', in: 'body', - name: 'i' - } - } - } + name: 'i', + }, + }, + }, }; function genProps(props: { [key: string]: Context; }) { @@ -69,11 +69,11 @@ export function genOpenapiSpec(lang = 'ja-JP') { } : {}), ...(param.name === 'Object' ? { ...(required.length > 0 ? { required } : {}), - properties: (param as any).props ? genProps((param as any).props) : {} + properties: (param as any).props ? genProps((param as any).props) : {}, } : {}), ...(param.name === 'Array' ? { - items: (param as any).ctx ? genProp((param as any).ctx) : {} - } : {}) + items: (param as any).ctx ? genProp((param as any).ctx) : {}, + } : {}), }; } @@ -85,8 +85,8 @@ export function genOpenapiSpec(lang = 'ja-JP') { for (const e of Object.values(endpoint.meta.errors)) { errors[e.code] = { value: { - error: e - } + error: e, + }, }; } } @@ -118,15 +118,15 @@ export function genOpenapiSpec(lang = 'ja-JP') { description: desc, externalDocs: { description: 'Source code', - url: `https://github.com/misskey-dev/misskey/blob/develop/src/server/api/endpoints/${endpoint.name}.ts` + url: `https://github.com/misskey-dev/misskey/blob/develop/src/server/api/endpoints/${endpoint.name}.ts`, }, ...(endpoint.meta.tags ? { - tags: [endpoint.meta.tags[0]] + tags: [endpoint.meta.tags[0]], } : {}), ...(endpoint.meta.requireCredential ? { security: [{ - ApiKeyAuth: [] - }] + ApiKeyAuth: [], + }], } : {}), requestBody: { required: true, @@ -135,10 +135,10 @@ export function genOpenapiSpec(lang = 'ja-JP') { schema: { type: 'object', ...(required.length > 0 ? { required } : {}), - properties: endpoint.meta.params ? genProps(porops) : {} - } - } - } + properties: endpoint.meta.params ? genProps(porops) : {}, + }, + }, + }, }, responses: { ...(endpoint.meta.res ? { @@ -146,58 +146,58 @@ export function genOpenapiSpec(lang = 'ja-JP') { description: 'OK (with results)', content: { 'application/json': { - schema: resSchema - } - } - } + schema: resSchema, + }, + }, + }, } : { '204': { description: 'OK (without any results)', - } + }, }), '400': { description: 'Client error', content: { 'application/json': { schema: { - $ref: '#/components/schemas/Error' + $ref: '#/components/schemas/Error', }, - examples: { ...errors, ...basicErrors['400'] } - } - } + examples: { ...errors, ...basicErrors['400'] }, + }, + }, }, '401': { description: 'Authentication error', content: { 'application/json': { schema: { - $ref: '#/components/schemas/Error' + $ref: '#/components/schemas/Error', }, - examples: basicErrors['401'] - } - } + examples: basicErrors['401'], + }, + }, }, '403': { description: 'Forbidden error', content: { 'application/json': { schema: { - $ref: '#/components/schemas/Error' + $ref: '#/components/schemas/Error', }, - examples: basicErrors['403'] - } - } + examples: basicErrors['403'], + }, + }, }, '418': { description: 'I\'m Ai', content: { 'application/json': { schema: { - $ref: '#/components/schemas/Error' + $ref: '#/components/schemas/Error', }, - examples: basicErrors['418'] - } - } + examples: basicErrors['418'], + }, + }, }, ...(endpoint.meta.limit ? { '429': { @@ -205,29 +205,29 @@ export function genOpenapiSpec(lang = 'ja-JP') { content: { 'application/json': { schema: { - $ref: '#/components/schemas/Error' + $ref: '#/components/schemas/Error', }, - examples: basicErrors['429'] - } - } - } + examples: basicErrors['429'], + }, + }, + }, } : {}), '500': { description: 'Internal server error', content: { 'application/json': { schema: { - $ref: '#/components/schemas/Error' + $ref: '#/components/schemas/Error', }, - examples: basicErrors['500'] - } - } + examples: basicErrors['500'], + }, + }, }, - } + }, }; spec.paths['/' + endpoint.name] = { - post: info + post: info, }; } diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts index 12fc207c47..723b3e884a 100644 --- a/packages/backend/src/server/api/openapi/schemas.ts +++ b/packages/backend/src/server/api/openapi/schemas.ts @@ -42,12 +42,12 @@ export const schemas = { type: 'string', format: 'uuid', description: 'An error ID. This ID is static.', - } + }, }, - required: ['code', 'id', 'message'] + required: ['code', 'id', 'message'], }, }, - required: ['error'] + required: ['error'], }, ...Object.fromEntries( diff --git a/packages/backend/src/server/api/private/signin.ts b/packages/backend/src/server/api/private/signin.ts index 83c3dfee94..7b733b768d 100644 --- a/packages/backend/src/server/api/private/signin.ts +++ b/packages/backend/src/server/api/private/signin.ts @@ -41,7 +41,7 @@ export default async (ctx: Koa.Context) => { // Fetch user const user = await Users.findOne({ usernameLower: username.toLowerCase(), - host: null + host: null, }) as ILocalUser; if (user == null) { @@ -71,7 +71,7 @@ export default async (ctx: Koa.Context) => { userId: user.id, ip: ctx.ip, headers: ctx.headers, - success: false + success: false, }); error(status || 500, failure || { id: '4e30e80c-e338-45a0-8c8f-44455efa3b76' }); @@ -83,7 +83,7 @@ export default async (ctx: Koa.Context) => { return; } else { await fail(403, { - id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c' + id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c', }); return; } @@ -92,7 +92,7 @@ export default async (ctx: Koa.Context) => { if (token) { if (!same) { await fail(403, { - id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c' + id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c', }); return; } @@ -101,7 +101,7 @@ export default async (ctx: Koa.Context) => { secret: profile.twoFactorSecret, encoding: 'base32', token: token, - window: 2 + window: 2, }); if (verified) { @@ -109,14 +109,14 @@ export default async (ctx: Koa.Context) => { return; } else { await fail(403, { - id: 'cdf1235b-ac71-46d4-a3a6-84ccce48df6f' + id: 'cdf1235b-ac71-46d4-a3a6-84ccce48df6f', }); return; } } else if (body.credentialId) { if (!same && !profile.usePasswordLessLogin) { await fail(403, { - id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c' + id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c', }); return; } @@ -127,24 +127,24 @@ export default async (ctx: Koa.Context) => { userId: user.id, id: body.challengeId, registrationChallenge: false, - challenge: hash(clientData.challenge).toString('hex') + challenge: hash(clientData.challenge).toString('hex'), }); if (!challenge) { await fail(403, { - id: '2715a88a-2125-4013-932f-aa6fe72792da' + id: '2715a88a-2125-4013-932f-aa6fe72792da', }); return; } await AttestationChallenges.delete({ userId: user.id, - id: body.challengeId + id: body.challengeId, }); if (new Date().getTime() - challenge.createdAt.getTime() >= 5 * 60 * 1000) { await fail(403, { - id: '2715a88a-2125-4013-932f-aa6fe72792da' + id: '2715a88a-2125-4013-932f-aa6fe72792da', }); return; } @@ -155,12 +155,12 @@ export default async (ctx: Koa.Context) => { .replace(/-/g, '+') .replace(/_/g, '/'), 'base64' - ).toString('hex') + ).toString('hex'), }); if (!securityKey) { await fail(403, { - id: '66269679-aeaf-4474-862b-eb761197e046' + id: '66269679-aeaf-4474-862b-eb761197e046', }); return; } @@ -171,7 +171,7 @@ export default async (ctx: Koa.Context) => { clientDataJSON, clientData, signature: Buffer.from(body.signature, 'hex'), - challenge: challenge.challenge + challenge: challenge.challenge, }); if (isValid) { @@ -179,25 +179,25 @@ export default async (ctx: Koa.Context) => { return; } else { await fail(403, { - id: '93b86c4b-72f9-40eb-9815-798928603d1e' + id: '93b86c4b-72f9-40eb-9815-798928603d1e', }); return; } } else { if (!same && !profile.usePasswordLessLogin) { await fail(403, { - id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c' + id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c', }); return; } const keys = await UserSecurityKeys.find({ - userId: user.id + userId: user.id, }); if (keys.length === 0) { await fail(403, { - id: 'f27fd449-9af4-4841-9249-1f989b9fa4a4' + id: 'f27fd449-9af4-4841-9249-1f989b9fa4a4', }); return; } @@ -215,15 +215,15 @@ export default async (ctx: Koa.Context) => { id: challengeId, challenge: hash(Buffer.from(challenge, 'utf-8')).toString('hex'), createdAt: new Date(), - registrationChallenge: false + registrationChallenge: false, }); ctx.body = { challenge, challengeId, securityKeys: keys.map(key => ({ - id: key.id - })) + id: key.id, + })), }; ctx.status = 200; return; diff --git a/packages/backend/src/server/api/private/signup.ts b/packages/backend/src/server/api/private/signup.ts index 2b6a3eb00c..eaab8e7111 100644 --- a/packages/backend/src/server/api/private/signup.ts +++ b/packages/backend/src/server/api/private/signup.ts @@ -57,7 +57,7 @@ export default async (ctx: Koa.Context) => { } const ticket = await RegistrationTickets.findOne({ - code: invitationCode + code: invitationCode, }); if (ticket == null) { @@ -94,12 +94,12 @@ export default async (ctx: Koa.Context) => { } else { try { const { account, secret } = await signup({ - username, password, host + username, password, host, }); const res = await Users.pack(account, account, { detail: true, - includeSecrets: true + includeSecrets: true, }); (res as any).token = secret; diff --git a/packages/backend/src/server/api/service/discord.ts b/packages/backend/src/server/api/service/discord.ts index dd52a23376..f574fe3878 100644 --- a/packages/backend/src/server/api/service/discord.ts +++ b/packages/backend/src/server/api/service/discord.ts @@ -42,7 +42,7 @@ router.get('/disconnect/discord', async ctx => { const user = await Users.findOneOrFail({ host: null, - token: userToken + token: userToken, }); const profile = await UserProfiles.findOneOrFail(user.id); @@ -58,7 +58,7 @@ router.get('/disconnect/discord', async ctx => { // Publish i updated event publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); }); @@ -93,7 +93,7 @@ router.get('/connect/discord', async ctx => { redirect_uri: `${config.url}/api/dc/cb`, scope: ['identify'], state: uuid(), - response_type: 'code' + response_type: 'code', }; redisClient.set(userToken, JSON.stringify(params)); @@ -109,13 +109,13 @@ router.get('/signin/discord', async ctx => { redirect_uri: `${config.url}/api/dc/cb`, scope: ['identify'], state: uuid(), - response_type: 'code' + response_type: 'code', }; ctx.cookies.set('signin_with_discord_sid', sessid, { path: '/', secure: config.url.startsWith('https'), - httpOnly: true + httpOnly: true, }); redisClient.set(sessid, JSON.stringify(params)); @@ -158,7 +158,7 @@ router.get('/dc/cb', async ctx => { const { accessToken, refreshToken, expiresDate } = await new Promise<any>((res, rej) => oauth2!.getOAuthAccessToken(code, { grant_type: 'authorization_code', - redirect_uri + redirect_uri, }, (err, accessToken, refreshToken, result) => { if (err) { rej(err); @@ -168,7 +168,7 @@ router.get('/dc/cb', async ctx => { res({ accessToken, refreshToken, - expiresDate: Date.now() + Number(result.expires_in) * 1000 + expiresDate: Date.now() + Number(result.expires_in) * 1000, }); } })); @@ -201,8 +201,8 @@ router.get('/dc/cb', async ctx => { refreshToken: refreshToken, expiresDate: expiresDate, username: username, - discriminator: discriminator - } + discriminator: discriminator, + }, }, }); @@ -229,7 +229,7 @@ router.get('/dc/cb', async ctx => { const { accessToken, refreshToken, expiresDate } = await new Promise<any>((res, rej) => oauth2!.getOAuthAccessToken(code, { grant_type: 'authorization_code', - redirect_uri + redirect_uri, }, (err, accessToken, refreshToken, result) => { if (err) { rej(err); @@ -239,7 +239,7 @@ router.get('/dc/cb', async ctx => { res({ accessToken, refreshToken, - expiresDate: Date.now() + Number(result.expires_in) * 1000 + expiresDate: Date.now() + Number(result.expires_in) * 1000, }); } })); @@ -254,7 +254,7 @@ router.get('/dc/cb', async ctx => { const user = await Users.findOneOrFail({ host: null, - token: userToken + token: userToken, }); const profile = await UserProfiles.findOneOrFail(user.id); @@ -268,9 +268,9 @@ router.get('/dc/cb', async ctx => { expiresDate: expiresDate, id: id, username: username, - discriminator: discriminator - } - } + discriminator: discriminator, + }, + }, }); ctx.body = `Discord: @${username}#${discriminator} を、Misskey: @${user.username} に接続しました!`; @@ -278,7 +278,7 @@ router.get('/dc/cb', async ctx => { // Publish i updated event publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); } }); diff --git a/packages/backend/src/server/api/service/github.ts b/packages/backend/src/server/api/service/github.ts index 07b4fe717e..5e0839df93 100644 --- a/packages/backend/src/server/api/service/github.ts +++ b/packages/backend/src/server/api/service/github.ts @@ -92,7 +92,7 @@ router.get('/connect/github', async ctx => { const params = { redirect_uri: `${config.url}/api/gh/cb`, scope: ['read:user'], - state: uuid() + state: uuid(), }; redisClient.set(userToken, JSON.stringify(params)); @@ -107,13 +107,13 @@ router.get('/signin/github', async ctx => { const params = { redirect_uri: `${config.url}/api/gh/cb`, scope: ['read:user'], - state: uuid() + state: uuid(), }; ctx.cookies.set('signin_with_github_sid', sessid, { path: '/', secure: config.url.startsWith('https'), - httpOnly: true + httpOnly: true, }); redisClient.set(sessid, JSON.stringify(params)); @@ -155,7 +155,7 @@ router.get('/gh/cb', async ctx => { const { accessToken } = await new Promise<any>((res, rej) => oauth2!.getOAuthAccessToken(code, { - redirect_uri + redirect_uri, }, (err, accessToken, refresh, result) => { if (err) { rej(err); @@ -167,7 +167,7 @@ router.get('/gh/cb', async ctx => { })); const { login, id } = await getJson('https://api.github.com/user', 'application/vnd.github.v3+json', 10 * 1000, { - 'Authorization': `bearer ${accessToken}` + 'Authorization': `bearer ${accessToken}`, }); if (!login || !id) { ctx.throw(400, 'invalid session'); @@ -219,7 +219,7 @@ router.get('/gh/cb', async ctx => { })); const { login, id } = await getJson('https://api.github.com/user', 'application/vnd.github.v3+json', 10 * 1000, { - 'Authorization': `bearer ${accessToken}` + 'Authorization': `bearer ${accessToken}`, }); if (!login || !id) { @@ -229,7 +229,7 @@ router.get('/gh/cb', async ctx => { const user = await Users.findOneOrFail({ host: null, - token: userToken + token: userToken, }); const profile = await UserProfiles.findOneOrFail(user.id); @@ -241,8 +241,8 @@ router.get('/gh/cb', async ctx => { accessToken: accessToken, id: id, login: login, - } - } + }, + }, }); ctx.body = `GitHub: @${login} を、Misskey: @${user.username} に接続しました!`; @@ -250,7 +250,7 @@ router.get('/gh/cb', async ctx => { // Publish i updated event publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); } }); diff --git a/packages/backend/src/server/api/service/twitter.ts b/packages/backend/src/server/api/service/twitter.ts index 8a6a58aeee..8659b82cbe 100644 --- a/packages/backend/src/server/api/service/twitter.ts +++ b/packages/backend/src/server/api/service/twitter.ts @@ -41,7 +41,7 @@ router.get('/disconnect/twitter', async ctx => { const user = await Users.findOneOrFail({ host: null, - token: userToken + token: userToken, }); const profile = await UserProfiles.findOneOrFail(user.id); @@ -57,7 +57,7 @@ router.get('/disconnect/twitter', async ctx => { // Publish i updated event publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); }); @@ -68,7 +68,7 @@ async function getTwAuth() { return autwh({ consumerKey: meta.twitterConsumerKey, consumerSecret: meta.twitterConsumerSecret, - callbackUrl: `${config.url}/api/tw/cb` + callbackUrl: `${config.url}/api/tw/cb`, }); } else { return null; @@ -104,7 +104,7 @@ router.get('/signin/twitter', async ctx => { ctx.cookies.set('signin_with_twitter_sid', sessid, { path: '/', secure: config.url.startsWith('https'), - httpOnly: true + httpOnly: true, }); ctx.redirect(twCtx.url); @@ -164,7 +164,7 @@ router.get('/tw/cb', async ctx => { const user = await Users.findOneOrFail({ host: null, - token: userToken + token: userToken, }); const profile = await UserProfiles.findOneOrFail(user.id); @@ -177,7 +177,7 @@ router.get('/tw/cb', async ctx => { accessTokenSecret: result.accessTokenSecret, userId: result.userId, screenName: result.screenName, - } + }, }, }); @@ -186,7 +186,7 @@ router.get('/tw/cb', async ctx => { // Publish i updated event publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, { detail: true, - includeSecrets: true + includeSecrets: true, })); } }); diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts index 2824d7d1b8..98337bb318 100644 --- a/packages/backend/src/server/api/stream/channel.ts +++ b/packages/backend/src/server/api/stream/channel.ts @@ -52,7 +52,7 @@ export default abstract class Channel { this.connection.sendMessageToWs('channel', { id: this.id, type: type, - body: body + body: body, }); } diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index bf7942f522..1e51a81c4b 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -32,13 +32,13 @@ export default class extends Channel { // リプライなら再pack if (note.replyId != null) { note.reply = await Notes.pack(note.replyId, this.user, { - detail: true + detail: true, }); } // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user, { - detail: true + detail: true, }); } diff --git a/packages/backend/src/server/api/stream/channels/games/reversi-game.ts b/packages/backend/src/server/api/stream/channels/games/reversi-game.ts index bfdbf1d266..314db48b5e 100644 --- a/packages/backend/src/server/api/stream/channels/games/reversi-game.ts +++ b/packages/backend/src/server/api/stream/channels/games/reversi-game.ts @@ -95,12 +95,12 @@ export default class extends Channel { if (!['map', 'bw', 'isLlotheo', 'canPutEverywhere', 'loopedBoard'].includes(key)) return; await ReversiGames.update(this.gameId!, { - [key]: value + [key]: value, }); publishReversiGameStream(this.gameId!, 'updateSettings', { key: key, - value: value + value: value, }); } @@ -115,16 +115,16 @@ export default class extends Channel { if ((game.user1Id !== this.user.id) && (game.user2Id !== this.user.id)) return; const set = game.user1Id === this.user.id ? { - form1: form + form1: form, } : { - form2: form + form2: form, }; await ReversiGames.update(this.gameId!, set); publishReversiGameStream(this.gameId!, 'initForm', { userId: this.user.id, - form + form, }); } @@ -147,9 +147,9 @@ export default class extends Channel { item.value = value; const set = game.user1Id === this.user.id ? { - form2: form + form2: form, } : { - form1: form + form1: form, }; await ReversiGames.update(this.gameId!, set); @@ -157,7 +157,7 @@ export default class extends Channel { publishReversiGameStream(this.gameId!, 'updateForm', { userId: this.user.id, id, - value + value, }); } @@ -168,7 +168,7 @@ export default class extends Channel { message.id = Math.random(); publishReversiGameStream(this.gameId!, 'message', { userId: this.user.id, - message + message, }); } @@ -185,23 +185,23 @@ export default class extends Channel { if (game.user1Id === this.user.id) { await ReversiGames.update(this.gameId!, { - user1Accepted: accept + user1Accepted: accept, }); publishReversiGameStream(this.gameId!, 'changeAccepts', { user1: accept, - user2: game.user2Accepted + user2: game.user2Accepted, }); if (accept && game.user2Accepted) bothAccepted = true; } else if (game.user2Id === this.user.id) { await ReversiGames.update(this.gameId!, { - user2Accepted: accept + user2Accepted: accept, }); publishReversiGameStream(this.gameId!, 'changeAccepts', { user1: game.user1Accepted, - user2: accept + user2: accept, }); if (accept && game.user1Accepted) bothAccepted = true; @@ -235,14 +235,14 @@ export default class extends Channel { startedAt: new Date(), isStarted: true, black: bw, - map: map + map: map, }); //#region 盤面に最初から石がないなどして始まった瞬間に勝敗が決定する場合があるのでその処理 const o = new Reversi(map, { isLlotheo: freshGame.isLlotheo, canPutEverywhere: freshGame.canPutEverywhere, - loopedBoard: freshGame.loopedBoard + loopedBoard: freshGame.loopedBoard, }); if (o.isEnded) { @@ -257,12 +257,12 @@ export default class extends Channel { await ReversiGames.update(this.gameId!, { isEnded: true, - winnerId: winner + winnerId: winner, }); publishReversiGameStream(this.gameId!, 'ended', { winnerId: winner, - game: await ReversiGames.pack(this.gameId!, this.user) + game: await ReversiGames.pack(this.gameId!, this.user), }); } //#endregion @@ -293,7 +293,7 @@ export default class extends Channel { const o = new Reversi(game.map, { isLlotheo: game.isLlotheo, canPutEverywhere: game.canPutEverywhere, - loopedBoard: game.loopedBoard + loopedBoard: game.loopedBoard, }); // 盤面の状態を再生 @@ -320,7 +320,7 @@ export default class extends Channel { const log = { at: new Date(), color: myColor, - pos + pos, }; const crc32 = CRC32.str(game.logs.map(x => x.pos.toString()).join('') + pos.toString()).toString(); @@ -331,17 +331,17 @@ export default class extends Channel { crc32, isEnded: o.isEnded, winnerId: winner, - logs: game.logs + logs: game.logs, }); publishReversiGameStream(this.gameId!, 'set', Object.assign(log, { - next: o.turn + next: o.turn, })); if (o.isEnded) { publishReversiGameStream(this.gameId!, 'ended', { winnerId: winner, - game: await ReversiGames.pack(this.gameId!, this.user) + game: await ReversiGames.pack(this.gameId!, this.user), }); } } diff --git a/packages/backend/src/server/api/stream/channels/games/reversi.ts b/packages/backend/src/server/api/stream/channels/games/reversi.ts index 399750c26a..121560ff87 100644 --- a/packages/backend/src/server/api/stream/channels/games/reversi.ts +++ b/packages/backend/src/server/api/stream/channels/games/reversi.ts @@ -23,7 +23,7 @@ export default class extends Channel { if (body.id == null) return; const matching = await ReversiMatchings.findOne({ parentId: this.user!.id, - childId: body.id + childId: body.id, }); if (matching == null) return; publishMainStream(matching.childId, 'reversiInvited', await ReversiMatchings.pack(matching, { id: matching.childId })); 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 3c37b16dd7..f14f597aac 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -32,13 +32,13 @@ export default class extends Channel { // リプライなら再pack if (note.replyId != null) { note.reply = await Notes.pack(note.replyId, this.user, { - detail: true + detail: true, }); } // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user, { - detail: true + detail: true, }); } diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts index 281be4f2eb..820095dfcf 100644 --- a/packages/backend/src/server/api/stream/channels/hashtag.ts +++ b/packages/backend/src/server/api/stream/channels/hashtag.ts @@ -31,7 +31,7 @@ export default class extends Channel { // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user, { - detail: true + detail: true, }); } 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 24fb3bd40b..3bd491421d 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -32,7 +32,7 @@ export default class extends Channel { if (['followers', 'specified'].includes(note.visibility)) { note = await Notes.pack(note.id, this.user!, { - detail: true + detail: true, }); if (note.isHidden) { @@ -42,13 +42,13 @@ export default class extends Channel { // リプライなら再pack if (note.replyId != null) { note.reply = await Notes.pack(note.replyId, this.user!, { - detail: true + detail: true, }); } // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user!, { - detail: true + detail: true, }); } } 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 615cc4540f..0ae19aa7ce 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -37,7 +37,7 @@ export default class extends Channel { if (['followers', 'specified'].includes(note.visibility)) { note = await Notes.pack(note.id, this.user!, { - detail: true + detail: true, }); if (note.isHidden) { @@ -47,13 +47,13 @@ export default class extends Channel { // リプライなら再pack if (note.replyId != null) { note.reply = await Notes.pack(note.replyId, this.user!, { - detail: true + detail: true, }); } // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user!, { - detail: true + detail: true, }); } } diff --git a/packages/backend/src/server/api/stream/channels/index.ts b/packages/backend/src/server/api/stream/channels/index.ts index 1841573043..89d93f2da3 100644 --- a/packages/backend/src/server/api/stream/channels/index.ts +++ b/packages/backend/src/server/api/stream/channels/index.ts @@ -33,5 +33,5 @@ export default { channel, admin, gamesReversi, - gamesReversiGame + gamesReversiGame, }; 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 a6166c2be2..3178b1d511 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -32,13 +32,13 @@ export default class extends Channel { // リプライなら再pack if (note.replyId != null) { note.reply = await Notes.pack(note.replyId, this.user, { - detail: true + detail: true, }); } // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user, { - detail: true + detail: true, }); } diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts index 925263aef0..b41eae7c71 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -20,7 +20,7 @@ export default class extends Channel { if (data.body.note && data.body.note.isHidden) { const note = await Notes.pack(data.body.note.id, this.user, { - detail: true + detail: true, }); this.connection.cacheNote(note); data.body.note = note; @@ -33,7 +33,7 @@ export default class extends Channel { if (this.muting.has(data.body.userId)) return; if (data.body.isHidden) { const note = await Notes.pack(data.body.id, this.user, { - detail: true + detail: true, }); this.connection.cacheNote(note); data.body = note; diff --git a/packages/backend/src/server/api/stream/channels/messaging.ts b/packages/backend/src/server/api/stream/channels/messaging.ts index c049e880b9..d8fccf0763 100644 --- a/packages/backend/src/server/api/stream/channels/messaging.ts +++ b/packages/backend/src/server/api/stream/channels/messaging.ts @@ -28,7 +28,7 @@ export default class extends Channel { if (this.groupId) { const joining = await UserGroupJoinings.findOne({ userId: this.user!.id, - userGroupId: this.groupId + userGroupId: this.groupId, }); if (joining == null) { 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 0bda0cfcb9..be18438fa3 100644 --- a/packages/backend/src/server/api/stream/channels/queue-stats.ts +++ b/packages/backend/src/server/api/stream/channels/queue-stats.ts @@ -28,7 +28,7 @@ export default class extends Channel { }); ev.emit('requestQueueStatsLog', { id: body.id, - length: body.length + length: body.length, }); break; } 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 d245a7f70c..df89b4c750 100644 --- a/packages/backend/src/server/api/stream/channels/server-stats.ts +++ b/packages/backend/src/server/api/stream/channels/server-stats.ts @@ -28,7 +28,7 @@ export default class extends Channel { }); ev.emit('requestServerStatsLog', { id: body.id, - length: body.length + length: body.length, }); break; } 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 63b254605b..b75920a180 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -21,7 +21,7 @@ export default class extends Channel { // Check existence and owner const list = await UserLists.findOne({ id: this.listId, - userId: this.user!.id + userId: this.user!.id, }); if (!list) return; @@ -40,7 +40,7 @@ export default class extends Channel { where: { userListId: this.listId, }, - select: ['userId'] + select: ['userId'], }); this.listUsers = users.map(x => x.userId); @@ -52,7 +52,7 @@ export default class extends Channel { if (['followers', 'specified'].includes(note.visibility)) { note = await Notes.pack(note.id, this.user, { - detail: true + detail: true, }); if (note.isHidden) { @@ -62,13 +62,13 @@ export default class extends Channel { // リプライなら再pack if (note.replyId != null) { note.reply = await Notes.pack(note.replyId, this.user, { - detail: true + detail: true, }); } // Renoteなら再pack if (note.renoteId != null) { note.renote = await Notes.pack(note.renoteId, this.user, { - detail: true + detail: true, }); } } diff --git a/packages/backend/src/server/api/stream/index.ts b/packages/backend/src/server/api/stream/index.ts index da4ea5ec99..84689bca1a 100644 --- a/packages/backend/src/server/api/stream/index.ts +++ b/packages/backend/src/server/api/stream/index.ts @@ -203,8 +203,8 @@ export default class Connection { code: e.code, id: e.id, kind: e.kind, - ...(e.info ? { info: e.info } : {}) - } + ...(e.info ? { info: e.info } : {}), + }, }); }); } @@ -281,7 +281,7 @@ export default class Connection { public sendMessageToWs(type: string, payload: any) { this.wsConnection.send(JSON.stringify({ type: type, - body: payload + body: payload, })); } @@ -305,7 +305,7 @@ export default class Connection { if (pong) { this.sendMessageToWs('connected', { - id: id + id: id, }); } } @@ -358,9 +358,9 @@ export default class Connection { private async updateFollowing() { const followings = await Followings.find({ where: { - followerId: this.user!.id + followerId: this.user!.id, }, - select: ['followeeId'] + select: ['followeeId'], }); this.following = new Set<string>(followings.map(x => x.followeeId)); @@ -370,9 +370,9 @@ export default class Connection { private async updateMuting() { const mutings = await Mutings.find({ where: { - muterId: this.user!.id + muterId: this.user!.id, }, - select: ['muteeId'] + select: ['muteeId'], }); this.muting = new Set<string>(mutings.map(x => x.muteeId)); @@ -382,9 +382,9 @@ export default class Connection { private async updateBlocking() { // ここでいうBlockingは被Blockingの意 const blockings = await Blockings.find({ where: { - blockeeId: this.user!.id + blockeeId: this.user!.id, }, - select: ['blockerId'] + select: ['blockerId'], }); this.blocking = new Set<string>(blockings.map(x => x.blockerId)); @@ -394,9 +394,9 @@ export default class Connection { private async updateFollowingChannels() { const followings = await ChannelFollowings.find({ where: { - followerId: this.user!.id + followerId: this.user!.id, }, - select: ['followeeId'] + select: ['followeeId'], }); this.followingChannels = new Set<string>(followings.map(x => x.followeeId)); @@ -405,7 +405,7 @@ export default class Connection { @autobind private async updateUserProfile() { this.userProfile = await UserProfiles.findOne({ - userId: this.user!.id + userId: this.user!.id, }); } diff --git a/packages/backend/src/server/api/streaming.ts b/packages/backend/src/server/api/streaming.ts index 8808bc9860..ad87311064 100644 --- a/packages/backend/src/server/api/streaming.ts +++ b/packages/backend/src/server/api/streaming.ts @@ -11,7 +11,7 @@ import { Users } from '@/models/index'; module.exports = (server: http.Server) => { // Init websocket server const ws = new websocket.server({ - httpServer: server + httpServer: server, }); ws.on('request', async (request) => { |