diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f98d6785..20094cdde5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,19 @@ --> +## 12.x.x (unreleased) + +### Improvements +- Added a user-level instance mute in user settings +- フォローエクスポートでミュートしているユーザーを含めないオプションを追加 +- フォローエクスポートで使われていないアカウントを含めないオプションを追加 +- カスタム絵文字エクスポート機能 + +### Bugfixes +- クライアント: タッチ機能付きディスプレイを使っていてマウス操作をしている場合に一部機能が動作しない問題を修正 +- クライアント: クリップの設定を編集できない問題を修正 +- クライアント: メニューなどがウィンドウの裏に隠れる問題を修正 + ## 12.98.0 (2021/12/03) ### Improvements diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9a9e725f7..fe3df853b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,6 +85,11 @@ TODO Misskey uses GitHub Actions for executing automated tests. Configuration files are located in [`/.github/workflows`](/.github/workflows). +## Vue +Misskey uses Vue(v3) as its front-end framework. +**When creating a new component, please use the Composition API instead of the Options API.** +Some of the existing components are implemented in the Options API, but it is an old implementation. Refactors that migrate those components to the Composition API are also welcome. + ## Adding MisskeyRoom items * Use English for material, object and texture names. * Use meter for unit of length. diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 3a3c15601c..8aa8f13132 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -592,6 +592,7 @@ smtpSecure: "SMTP 接続に暗黙的なSSL/TLSを使用する" smtpSecureInfo: "STARTTLS使用時はオフにします。" testEmail: "配信テスト" wordMute: "ワードミュート" +instanceMute: "インスタンスミュート" userSaysSomething: "{name}が何かを言いました" makeActive: "アクティブにする" display: "表示" @@ -811,6 +812,7 @@ continueThread: "さらにスレッドを見る" deleteAccountConfirm: "アカウントが削除されます。よろしいですか?" incorrectPassword: "パスワードが間違っています。" voteConfirm: "「{choice}」に投票しますか?" +hide: "隠す" _emailUnavailable: used: "既に使用されています" @@ -1021,6 +1023,12 @@ _wordMute: hard: "ハード" mutedNotes: "ミュートされたノート" +_instanceMute: + instanceMuteDescription: "ミュートしたインスタンスのユーザーへの返信を含めて、設定したインスタンスの全てのノートとRenoteをミュートします。" + instanceMuteDescription2: "改行で区切って設定します" + title: "設定したインスタンスのノートを隠します。" + heading: "ミュートするインスタンス" + _theme: explore: "テーマを探す" install: "テーマのインストール" @@ -1311,6 +1319,8 @@ _exportOrImport: muteList: "ミュート" blockingList: "ブロック" userLists: "リスト" + excludeMutingUsers: "ミュートしているユーザーを除外" + excludeInactiveUsers: "使われていないアカウントを除外" _charts: federationInstancesIncDec: "連合の増減" diff --git a/packages/backend/migration/1629968054000_userInstanceBlocks.js b/packages/backend/migration/1629968054000_userInstanceBlocks.js new file mode 100644 index 0000000000..5703ff0b00 --- /dev/null +++ b/packages/backend/migration/1629968054000_userInstanceBlocks.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class userInstanceBlocks1629968054000 { + constructor() { + this.name = 'userInstanceBlocks1629968054000'; + } + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutedInstances" jsonb NOT NULL DEFAULT '[]'`); + await queryRunner.query(`COMMENT ON COLUMN "user_profile"."mutedInstances" IS 'List of instances muted by the user.'`); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutedInstances"`); + } +} +exports.userInstanceBlocks1629968054000 = userInstanceBlocks1629968054000; diff --git a/packages/backend/package.json b/packages/backend/package.json index d7738e75a8..abcde0ab72 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -46,10 +46,8 @@ "@types/node": "16.11.7", "@types/node-fetch": "2.5.12", "@types/nodemailer": "6.4.4", - "@types/nprogress": "0.2.0", "@types/oauth": "0.9.1", - "@types/parse5": "6.0.2", - "@types/parsimmon": "1.10.6", + "@types/parse5": "6.0.3", "@types/portscanner": "2.1.1", "@types/pug": "2.0.5", "@types/punycode": "2.1.0", @@ -76,6 +74,7 @@ "@typescript-eslint/eslint-plugin": "5.3.1", "@typescript-eslint/parser": "5.1.0", "abort-controller": "3.0.0", + "archiver": "5.3.0", "autobind-decorator": "2.4.0", "autosize": "4.0.4", "autwh": "0.1.0", @@ -93,7 +92,6 @@ "chartjs-plugin-zoom": "1.1.1", "cli-highlight": "2.1.11", "compare-versions": "3.6.0", - "concurrently": "6.3.0", "content-disposition": "0.5.3", "crc-32": "1.2.0", "css-loader": "6.5.1", @@ -134,6 +132,7 @@ "koa-views": "7.0.2", "langmap": "0.0.16", "mfm-js": "0.20.0", + "mime-types": "2.1.34", "misskey-js": "0.0.8", "mocha": "8.4.0", "ms": "3.0.0-canary.1", diff --git a/packages/backend/src/daemons/janitor.ts b/packages/backend/src/daemons/janitor.ts index 72568cfe18..115c1fe380 100644 --- a/packages/backend/src/daemons/janitor.ts +++ b/packages/backend/src/daemons/janitor.ts @@ -10,7 +10,7 @@ import { LessThan } from 'typeorm'; export default function() { async function tick() { await AttestationChallenges.delete({ - createdAt: LessThan(new Date(new Date().getTime() - 5 * 60 * 1000)) + createdAt: LessThan(new Date(new Date().getTime() - 5 * 60 * 1000)), }); } diff --git a/packages/backend/src/daemons/queue-stats.ts b/packages/backend/src/daemons/queue-stats.ts index 77f09b18d6..5faa16ee44 100644 --- a/packages/backend/src/daemons/queue-stats.ts +++ b/packages/backend/src/daemons/queue-stats.ts @@ -35,13 +35,13 @@ export default function() { activeSincePrevTick: activeDeliverJobs, active: deliverJobCounts.active, waiting: deliverJobCounts.waiting, - delayed: deliverJobCounts.delayed + delayed: deliverJobCounts.delayed, }, inbox: { activeSincePrevTick: activeInboxJobs, active: inboxJobCounts.active, waiting: inboxJobCounts.waiting, - delayed: inboxJobCounts.delayed + delayed: inboxJobCounts.delayed, }, }; diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index 8dfa946250..47c46042eb 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -38,7 +38,7 @@ export default function() { fs: { r: round(Math.max(0, fsStats.rIO_sec)), w: round(Math.max(0, fsStats.wIO_sec)), - } + }, }; ev.emit('serverStats', stats); log.unshift(stats); diff --git a/packages/backend/src/db/elasticsearch.ts b/packages/backend/src/db/elasticsearch.ts index c99183007a..60a4061d44 100644 --- a/packages/backend/src/db/elasticsearch.ts +++ b/packages/backend/src/db/elasticsearch.ts @@ -6,10 +6,10 @@ const index = { analysis: { analyzer: { ngram: { - tokenizer: 'ngram' - } - } - } + tokenizer: 'ngram', + }, + }, + }, }, mappings: { properties: { @@ -25,9 +25,9 @@ const index = { userHost: { type: 'keyword', index: true, - } - } - } + }, + }, + }, }; // Init ElasticSearch connection @@ -35,9 +35,9 @@ const client = config.elasticsearch ? new elasticsearch.Client({ node: `${config.elasticsearch.ssl ? 'https://' : 'http://'}${config.elasticsearch.host}:${config.elasticsearch.port}`, auth: (config.elasticsearch.user && config.elasticsearch.pass) ? { username: config.elasticsearch.user, - password: config.elasticsearch.pass + password: config.elasticsearch.pass, } : undefined, - pingTimeout: 30000 + pingTimeout: 30000, }) : null; if (client) { @@ -47,7 +47,7 @@ if (client) { if (!exist.body) { client.indices.create({ index: config.elasticsearch.index || 'misskey_note', - body: index + body: index, }); } }); diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index efbacf3d10..4daf6b4434 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -175,7 +175,7 @@ export const entities = [ Ad, PasswordResetRequest, UserPending, - ...charts as any + ...charts as any, ]; export function initDb(justBorrow = false, sync = false, forceRecreate = false) { @@ -205,12 +205,12 @@ export function initDb(justBorrow = false, sync = false, forceRecreate = false) port: config.redis.port, password: config.redis.pass, prefix: `${config.redis.prefix}:query:`, - db: config.redis.db || 0 - } + db: config.redis.db || 0, + }, } : false, logging: log, logger: log ? new MyCustomLogger() : undefined, - entities: entities + entities: entities, }); } diff --git a/packages/backend/src/db/redis.ts b/packages/backend/src/db/redis.ts index 7e0ee1e3ce..9fc2b62412 100644 --- a/packages/backend/src/db/redis.ts +++ b/packages/backend/src/db/redis.ts @@ -8,7 +8,7 @@ export function createConnection() { { password: config.redis.pass, prefix: config.redis.prefix, - db: config.redis.db || 0 + db: config.redis.db || 0, } ); } diff --git a/packages/backend/src/games/reversi/core.ts b/packages/backend/src/games/reversi/core.ts index fc7f006cea..0cf7714543 100644 --- a/packages/backend/src/games/reversi/core.ts +++ b/packages/backend/src/games/reversi/core.ts @@ -134,7 +134,7 @@ export default class Reversi { color, pos, effects, - turn + turn, }); this.calcTurn(); @@ -211,7 +211,7 @@ export default class Reversi { [ 0, +1], // 下 [ -1, +1], // 左下 [ -1, 0], // 左 - [ -1, -1] // 左上 + [ -1, -1], // 左上 ]; const effectsInLine = ([dx, dy]: [number, number]): number[] => { diff --git a/packages/backend/src/games/reversi/maps.ts b/packages/backend/src/games/reversi/maps.ts index dc0d1bf9d0..8442c6d741 100644 --- a/packages/backend/src/games/reversi/maps.ts +++ b/packages/backend/src/games/reversi/maps.ts @@ -22,8 +22,8 @@ export const fourfour: Map = { '----', '-wb-', '-bw-', - '----' - ] + '----', + ], }; export const sixsix: Map = { @@ -35,8 +35,8 @@ export const sixsix: Map = { '--wb--', '--bw--', '------', - '------' - ] + '------', + ], }; export const roundedSixsix: Map = { @@ -49,8 +49,8 @@ export const roundedSixsix: Map = { '--wb--', '--bw--', '------', - ' ---- ' - ] + ' ---- ', + ], }; export const roundedSixsix2: Map = { @@ -63,8 +63,8 @@ export const roundedSixsix2: Map = { '--wb--', '--bw--', ' ---- ', - ' -- ' - ] + ' -- ', + ], }; export const eighteight: Map = { @@ -78,8 +78,8 @@ export const eighteight: Map = { '---bw---', '--------', '--------', - '--------' - ] + '--------', + ], }; export const eighteightH1: Map = { @@ -93,8 +93,8 @@ export const eighteightH1: Map = { '---bw---', '--------', '--------', - '--------' - ] + '--------', + ], }; export const eighteightH2: Map = { @@ -108,8 +108,8 @@ export const eighteightH2: Map = { '---bw---', '--------', '--------', - '-------b' - ] + '-------b', + ], }; export const eighteightH3: Map = { @@ -123,8 +123,8 @@ export const eighteightH3: Map = { '---bw---', '--------', '--------', - '-------b' - ] + '-------b', + ], }; export const eighteightH4: Map = { @@ -138,8 +138,8 @@ export const eighteightH4: Map = { '---bw---', '--------', '--------', - 'b------b' - ] + 'b------b', + ], }; export const eighteightH28: Map = { @@ -153,8 +153,8 @@ export const eighteightH28: Map = { 'b--bw--b', 'b------b', 'b------b', - 'bbbbbbbb' - ] + 'bbbbbbbb', + ], }; export const roundedEighteight: Map = { @@ -169,8 +169,8 @@ export const roundedEighteight: Map = { '---bw---', '--------', '--------', - ' ------ ' - ] + ' ------ ', + ], }; export const roundedEighteight2: Map = { @@ -185,8 +185,8 @@ export const roundedEighteight2: Map = { '---bw---', '--------', ' ------ ', - ' ---- ' - ] + ' ---- ', + ], }; export const roundedEighteight3: Map = { @@ -201,8 +201,8 @@ export const roundedEighteight3: Map = { '---bw---', ' ------ ', ' ---- ', - ' -- ' - ] + ' -- ', + ], }; export const eighteightWithNotch: Map = { @@ -217,8 +217,8 @@ export const eighteightWithNotch: Map = { ' --bw-- ', '--------', '--------', - '--- ---' - ] + '--- ---', + ], }; export const eighteightWithSomeHoles: Map = { @@ -233,8 +233,8 @@ export const eighteightWithSomeHoles: Map = { '---bw- -', ' -------', '--- ----', - '--------' - ] + '--------', + ], }; export const circle: Map = { @@ -249,8 +249,8 @@ export const circle: Map = { '---bw---', ' ------ ', ' ------ ', - ' -- ' - ] + ' -- ', + ], }; export const smile: Map = { @@ -265,8 +265,8 @@ export const smile: Map = { '-- bw --', '--- ---', '--------', - ' ------ ' - ] + ' ------ ', + ], }; export const window: Map = { @@ -281,8 +281,8 @@ export const window: Map = { '---bw---', '- -- -', '- -- -', - '--------' - ] + '--------', + ], }; export const reserved: Map = { @@ -297,8 +297,8 @@ export const reserved: Map = { '---bw---', '--------', '--------', - 'b------w' - ] + 'b------w', + ], }; export const x: Map = { @@ -313,8 +313,8 @@ export const x: Map = { '---bw---', '--b--w--', '-b----w-', - 'b------w' - ] + 'b------w', + ], }; export const parallel: Map = { @@ -329,8 +329,8 @@ export const parallel: Map = { '---ww---', '--------', '--------', - '--------' - ] + '--------', + ], }; export const lackOfBlack: Map = { @@ -344,8 +344,8 @@ export const lackOfBlack: Map = { '---bw---', '--------', '--------', - '--------' - ] + '--------', + ], }; export const squareParty: Map = { @@ -360,8 +360,8 @@ export const squareParty: Map = { '-bbbwww-', '-b-bw-w-', '-bbbwww-', - '--------' - ] + '--------', + ], }; export const minesweeper: Map = { @@ -376,8 +376,8 @@ export const minesweeper: Map = { '-w-bw-b-', 'b-w--b-w', '-b-bw-w-', - 'w-w--b-b' - ] + 'w-w--b-b', + ], }; export const tenthtenth: Map = { @@ -393,8 +393,8 @@ export const tenthtenth: Map = { '----------', '----------', '----------', - '----------' - ] + '----------', + ], }; export const hole: Map = { @@ -411,8 +411,8 @@ export const hole: Map = { '--wb--wb--', '--bw--bw--', '----------', - '----------' - ] + '----------', + ], }; export const grid: Map = { @@ -429,8 +429,8 @@ export const grid: Map = { '- - -- - -', '----------', '- - -- - -', - '----------' - ] + '----------', + ], }; export const cross: Map = { @@ -447,8 +447,8 @@ export const cross: Map = { '----------', ' ---- ', ' ---- ', - ' ---- ' - ] + ' ---- ', + ], }; export const charX: Map = { @@ -465,8 +465,8 @@ export const charX: Map = { ' -------- ', '----------', '---- ----', - '--- ---' - ] + '--- ---', + ], }; export const charY: Map = { @@ -483,8 +483,8 @@ export const charY: Map = { ' ------ ', ' ------ ', ' ------ ', - ' ------ ' - ] + ' ------ ', + ], }; export const walls: Map = { @@ -501,8 +501,8 @@ export const walls: Map = { 'w--------w', 'w--------w', 'w--------w', - ' bbbbbbbb ' - ] + ' bbbbbbbb ', + ], }; export const cpu: Map = { @@ -519,8 +519,8 @@ export const cpu: Map = { 'w--------w', ' -------- ', 'w--------w', - ' b b b b ' - ] + ' b b b b ', + ], }; export const checker: Map = { @@ -537,8 +537,8 @@ export const checker: Map = { '---bwbw---', '----------', '----------', - '----------' - ] + '----------', + ], }; export const japaneseCurry: Map = { @@ -555,8 +555,8 @@ export const japaneseCurry: Map = { 'w-w-w-b-b-', '-w-w-w-b-b', 'w-w-w-w-b-', - '-w-w-w-w-b' - ] + '-w-w-w-w-b', + ], }; export const mosaic: Map = { @@ -574,7 +574,7 @@ export const mosaic: Map = { ' - - - - -', '- - - - - ', ' - - - - -', - ] + ], }; export const arena: Map = { @@ -591,8 +591,8 @@ export const arena: Map = { ' -------- ', '- ------ -', ' - - - - ', - '- - -- - -' - ] + '- - -- - -', + ], }; export const reactor: Map = { @@ -609,8 +609,8 @@ export const reactor: Map = { '---w b---', '- --bw-- -', 'w- - - -b', - '-b------w-' - ] + '-b------w-', + ], }; export const sixeight: Map = { @@ -624,8 +624,8 @@ export const sixeight: Map = { '--bw--', '------', '------', - '------' - ] + '------', + ], }; export const spark: Map = { @@ -642,8 +642,8 @@ export const spark: Map = { ' -------- ', ' -------- ', '----------', - ' - - ' - ] + ' - - ', + ], }; export const islands: Map = { @@ -660,8 +660,8 @@ export const islands: Map = { ' --------', ' --------', ' --------', - ' --------' - ] + ' --------', + ], }; export const galaxy: Map = { @@ -680,8 +680,8 @@ export const galaxy: Map = { '---w--bbb---', ' ---w------ ', ' ---www-- ', - ' ------ ' - ] + ' ------ ', + ], }; export const triangle: Map = { @@ -698,8 +698,8 @@ export const triangle: Map = { ' -------- ', ' -------- ', '----------', - '----------' - ] + '----------', + ], }; export const iphonex: Map = { @@ -718,8 +718,8 @@ export const iphonex: Map = { '--------', '--------', '--------', - ' ------ ' - ] + ' ------ ', + ], }; export const dealWithIt: Map = { @@ -731,8 +731,8 @@ export const dealWithIt: Map = { '--w-b-------', ' --b-w------', ' --w-b---- ', - ' ------- ' - ] + ' ------- ', + ], }; export const experiment: Map = { @@ -750,8 +750,8 @@ export const experiment: Map = { 'bbbbbb wwwwww', 'bbbbbb wwwwww', 'bbbbbb wwwwww', - 'wwwwww bbbbbb' - ] + 'wwwwww bbbbbb', + ], }; export const bigBoard: Map = { @@ -773,8 +773,8 @@ export const bigBoard: Map = { '----------------', '----------------', '----------------', - '----------------' - ] + '----------------', + ], }; export const twoBoard: Map = { @@ -789,8 +789,8 @@ export const twoBoard: Map = { '---bw--- ---bw---', '-------- --------', '-------- --------', - '-------- --------' - ] + '-------- --------', + ], }; export const test1: Map = { @@ -800,8 +800,8 @@ export const test1: Map = { '--------', '---wb---', '---bw---', - '--------' - ] + '--------', + ], }; export const test2: Map = { @@ -812,8 +812,8 @@ export const test2: Map = { '------', '-b--w-', '-w--b-', - '-w--b-' - ] + '-w--b-', + ], }; export const test3: Map = { @@ -832,7 +832,7 @@ export const test3: Map = { '-w-', '---', 'b--', - ] + ], }; export const test4: Map = { @@ -843,8 +843,8 @@ export const test4: Map = { '-w--b-', '------', '-w--b-', - '-w--b-' - ] + '-w--b-', + ], }; // 検証用: この盤面で藍(lv3)が黒で始めると何故か(?)A1に打ってしまう @@ -860,7 +860,7 @@ export const test6: Map = { 'wwbwbbbb', '--wbbbbb', '-wwwww--', - ] + ], }; // 検証用: この盤面で藍(lv3)が黒で始めると何故か(?)G7に打ってしまう @@ -876,7 +876,7 @@ export const test7: Map = { '-wwbbwwb', '--wwww--', '--wwww--', - ] + ], }; // 検証用: この盤面で藍(lv5)が黒で始めると何故か(?)A1に打ってしまう @@ -892,5 +892,5 @@ export const test8: Map = { 'wwwwww--', '--www---', '--ww----', - ] + ], }; diff --git a/packages/backend/src/mfm/to-html.ts b/packages/backend/src/mfm/to-html.ts index 343c76fb3e..b16c6b95e5 100644 --- a/packages/backend/src/mfm/to-html.ts +++ b/packages/backend/src/mfm/to-html.ts @@ -144,7 +144,7 @@ export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMenti a.href = `https://www.google.com/search?q=${node.props.query}`; a.textContent = node.props.content; return a; - } + }, }; appendChildren(nodes, doc.body); diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index 71fbbd8a4c..76835b44b1 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -10,7 +10,7 @@ export class Cache { public set(key: string | null, value: T): void { this.cache.set(key, { date: Date.now(), - value + value, }); } diff --git a/packages/backend/src/misc/captcha.ts b/packages/backend/src/misc/captcha.ts index f36943b589..41a986d785 100644 --- a/packages/backend/src/misc/captcha.ts +++ b/packages/backend/src/misc/captcha.ts @@ -33,17 +33,17 @@ type CaptchaResponse = { async function getCaptchaResponse(url: string, secret: string, response: string): Promise { const params = new URLSearchParams({ secret, - response + response, }); const res = await fetch(url, { method: 'POST', body: params, headers: { - 'User-Agent': config.userAgent + 'User-Agent': config.userAgent, }, timeout: 10 * 1000, - agent: getAgentByUrl + agent: getAgentByUrl, }).catch(e => { throw `${e.message || e}`; }); diff --git a/packages/backend/src/misc/check-hit-antenna.ts b/packages/backend/src/misc/check-hit-antenna.ts index e70b7429c7..3c39a337fd 100644 --- a/packages/backend/src/misc/check-hit-antenna.ts +++ b/packages/backend/src/misc/check-hit-antenna.ts @@ -24,7 +24,7 @@ export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'No if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false; } else if (antenna.src === 'list') { const listUsers = (await UserListJoinings.find({ - userListId: antenna.userListId! + userListId: antenna.userListId!, })).map(x => x.userId); if (!listUsers.includes(note.userId)) return false; @@ -32,7 +32,7 @@ export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'No const joining = await UserGroupJoinings.findOneOrFail(antenna.userGroupJoiningId!); const groupUsers = (await UserGroupJoinings.find({ - userGroupId: joining.userGroupId + userGroupId: joining.userGroupId, })).map(x => x.userId); if (!groupUsers.includes(note.userId)) return false; diff --git a/packages/backend/src/misc/download-url.ts b/packages/backend/src/misc/download-url.ts index c96b4fd1d6..8e1f7b9e24 100644 --- a/packages/backend/src/misc/download-url.ts +++ b/packages/backend/src/misc/download-url.ts @@ -11,7 +11,7 @@ const PrivateIp = require('private-ip'); const pipeline = util.promisify(stream.pipeline); -export async function downloadUrl(url: string, path: string) { +export async function downloadUrl(url: string, path: string): Promise { const logger = new Logger('download'); logger.info(`Downloading ${chalk.cyan(url)} ...`); @@ -22,7 +22,7 @@ export async function downloadUrl(url: string, path: string) { const req = got.stream(url, { headers: { - 'User-Agent': config.userAgent + 'User-Agent': config.userAgent, }, timeout: { lookup: timeout, diff --git a/packages/backend/src/misc/fetch-meta.ts b/packages/backend/src/misc/fetch-meta.ts index a0bcdd4d48..b7b055d180 100644 --- a/packages/backend/src/misc/fetch-meta.ts +++ b/packages/backend/src/misc/fetch-meta.ts @@ -10,8 +10,8 @@ export async function fetchMeta(noCache = false): Promise { // 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する const meta = await transactionalEntityManager.findOne(Meta, { order: { - id: 'DESC' - } + id: 'DESC', + }, }); if (meta) { @@ -19,7 +19,7 @@ export async function fetchMeta(noCache = false): Promise { return meta; } else { const saved = await transactionalEntityManager.save(Meta, { - id: 'x' + id: 'x', }) as Meta; cache = saved; diff --git a/packages/backend/src/misc/fetch.ts b/packages/backend/src/misc/fetch.ts index f4f16a27e2..baebab1922 100644 --- a/packages/backend/src/misc/fetch.ts +++ b/packages/backend/src/misc/fetch.ts @@ -12,9 +12,9 @@ export async function getJson(url: string, accept = 'application/json, */*', tim method: 'GET', headers: Object.assign({ 'User-Agent': config.userAgent, - Accept: accept + Accept: accept, }, headers || {}), - timeout + timeout, }); return await res.json(); @@ -26,9 +26,9 @@ export async function getHtml(url: string, accept = 'text/html, */*', timeout = method: 'GET', headers: Object.assign({ 'User-Agent': config.userAgent, - Accept: accept + Accept: accept, }, headers || {}), - timeout + timeout, }); return await res.text(); @@ -95,7 +95,7 @@ export const httpAgent = config.proxy maxSockets, maxFreeSockets: 256, scheduling: 'lifo', - proxy: config.proxy + proxy: config.proxy, }) : _http; @@ -109,7 +109,7 @@ export const httpsAgent = config.proxy maxSockets, maxFreeSockets: 256, scheduling: 'lifo', - proxy: config.proxy + proxy: config.proxy, }) : _https; diff --git a/packages/backend/src/misc/gen-key-pair.ts b/packages/backend/src/misc/gen-key-pair.ts index d4a8fa7534..9db6b2a3ea 100644 --- a/packages/backend/src/misc/gen-key-pair.ts +++ b/packages/backend/src/misc/gen-key-pair.ts @@ -8,14 +8,14 @@ export async function genRsaKeyPair(modulusLength = 2048) { modulusLength, publicKeyEncoding: { type: 'spki', - format: 'pem' + format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: undefined, - passphrase: undefined - } + passphrase: undefined, + }, }); } @@ -24,13 +24,13 @@ export async function genEcKeyPair(namedCurve: 'prime256v1' | 'secp384r1' | 'sec namedCurve, publicKeyEncoding: { type: 'spki', - format: 'pem' + format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: undefined, - passphrase: undefined - } + passphrase: undefined, + }, }); } diff --git a/packages/backend/src/misc/get-file-info.ts b/packages/backend/src/misc/get-file-info.ts index 8d7f6b1bf9..f36aa8f966 100644 --- a/packages/backend/src/misc/get-file-info.ts +++ b/packages/backend/src/misc/get-file-info.ts @@ -26,12 +26,12 @@ export type FileInfo = { const TYPE_OCTET_STREAM = { mime: 'application/octet-stream', - ext: null + ext: null, }; const TYPE_SVG = { mime: 'image/svg+xml', - ext: 'svg' + ext: 'svg', }; /** @@ -116,7 +116,7 @@ export async function detectType(path: string) { return { mime: type.mime, - ext: type.ext + ext: type.ext, }; } diff --git a/packages/backend/src/misc/is-instance-muted.ts b/packages/backend/src/misc/is-instance-muted.ts new file mode 100644 index 0000000000..2e1785b517 --- /dev/null +++ b/packages/backend/src/misc/is-instance-muted.ts @@ -0,0 +1,15 @@ +import { Packed } from "./schema"; + +export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set): boolean { + if (mutedInstances.has(note?.user?.host ?? '')) return true; + if (mutedInstances.has(note?.reply?.user?.host ?? '')) return true; + if (mutedInstances.has(note?.renote?.user?.host ?? '')) return true; + + return false; +} + +export function isUserFromMutedInstance(notif: Packed<'Notification'>, mutedInstances: Set): boolean { + if (mutedInstances.has(notif?.user?.host ?? '')) return true; + + return false; +} diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index e24f4a4fcd..04b1e34ebe 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -112,14 +112,14 @@ export function decodeReaction(str: string): DecodedReaction { return { reaction: `:${name}@${host || '.'}:`, // ローカル分は@以降を省略するのではなく.にする name, - host + host, }; } return { reaction: str, name: undefined, - host: undefined + host: undefined, }; } diff --git a/packages/backend/src/models/entities/abuse-user-report.ts b/packages/backend/src/models/entities/abuse-user-report.ts index c0cff139f6..019d613f76 100644 --- a/packages/backend/src/models/entities/abuse-user-report.ts +++ b/packages/backend/src/models/entities/abuse-user-report.ts @@ -9,7 +9,7 @@ export class AbuseUserReport { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the AbuseUserReport.' + comment: 'The created date of the AbuseUserReport.', }) public createdAt: Date; @@ -18,7 +18,7 @@ export class AbuseUserReport { public targetUserId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public targetUser: User | null; @@ -28,26 +28,26 @@ export class AbuseUserReport { public reporterId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public reporter: User | null; @Column({ ...id(), - nullable: true + nullable: true, }) public assigneeId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public assignee: User | null; @Index() @Column('boolean', { - default: false + default: false, }) public resolved: boolean; @@ -60,14 +60,14 @@ export class AbuseUserReport { @Index() @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public targetUserHost: string | null; @Index() @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public reporterHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/access-token.ts b/packages/backend/src/models/entities/access-token.ts index 5f41b3c1fc..33b60e44f3 100644 --- a/packages/backend/src/models/entities/access-token.ts +++ b/packages/backend/src/models/entities/access-token.ts @@ -9,7 +9,7 @@ export class AccessToken { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the AccessToken.' + comment: 'The created date of the AccessToken.', }) public createdAt: Date; @@ -21,7 +21,7 @@ export class AccessToken { @Index() @Column('varchar', { - length: 128 + length: 128, }) public token: string; @@ -29,13 +29,13 @@ export class AccessToken { @Column('varchar', { length: 128, nullable: true, - default: null + default: null, }) public session: string | null; @Index() @Column('varchar', { - length: 128 + length: 128, }) public hash: string; @@ -44,7 +44,7 @@ export class AccessToken { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -52,12 +52,12 @@ export class AccessToken { @Column({ ...id(), nullable: true, - default: null + default: null, }) public appId: App['id'] | null; @ManyToOne(type => App, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public app: App | null; @@ -65,32 +65,32 @@ export class AccessToken { @Column('varchar', { length: 128, nullable: true, - default: null + default: null, }) public name: string | null; @Column('varchar', { length: 512, nullable: true, - default: null + default: null, }) public description: string | null; @Column('varchar', { length: 512, nullable: true, - default: null + default: null, }) public iconUrl: string | null; @Column('varchar', { length: 64, array: true, - default: '{}' + default: '{}', }) public permission: string[]; @Column('boolean', { - default: false + default: false, }) public fetched: boolean; } diff --git a/packages/backend/src/models/entities/ad.ts b/packages/backend/src/models/entities/ad.ts index b2fc04c4f0..68be4ab1ca 100644 --- a/packages/backend/src/models/entities/ad.ts +++ b/packages/backend/src/models/entities/ad.ts @@ -8,44 +8,44 @@ export class Ad { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Ad.' + comment: 'The created date of the Ad.', }) public createdAt: Date; @Index() @Column('timestamp with time zone', { - comment: 'The expired date of the Ad.' + comment: 'The expired date of the Ad.', }) public expiresAt: Date; @Column('varchar', { - length: 32, nullable: false + length: 32, nullable: false, }) public place: string; // 今は使われていないが将来的に活用される可能性はある @Column('varchar', { - length: 32, nullable: false + length: 32, nullable: false, }) public priority: string; @Column('integer', { - default: 1, nullable: false + default: 1, nullable: false, }) public ratio: number; @Column('varchar', { - length: 1024, nullable: false + length: 1024, nullable: false, }) public url: string; @Column('varchar', { - length: 1024, nullable: false + length: 1024, nullable: false, }) public imageUrl: string; @Column('varchar', { - length: 8192, nullable: false + length: 8192, nullable: false, }) public memo: string; diff --git a/packages/backend/src/models/entities/announcement-read.ts b/packages/backend/src/models/entities/announcement-read.ts index 892beb826f..88a1966e28 100644 --- a/packages/backend/src/models/entities/announcement-read.ts +++ b/packages/backend/src/models/entities/announcement-read.ts @@ -10,7 +10,7 @@ export class AnnouncementRead { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the AnnouncementRead.' + comment: 'The created date of the AnnouncementRead.', }) public createdAt: Date; @@ -19,7 +19,7 @@ export class AnnouncementRead { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -29,7 +29,7 @@ export class AnnouncementRead { public announcementId: Announcement['id']; @ManyToOne(type => Announcement, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public announcement: Announcement | null; diff --git a/packages/backend/src/models/entities/announcement.ts b/packages/backend/src/models/entities/announcement.ts index 06d379c229..3448bb6861 100644 --- a/packages/backend/src/models/entities/announcement.ts +++ b/packages/backend/src/models/entities/announcement.ts @@ -8,28 +8,28 @@ export class Announcement { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Announcement.' + comment: 'The created date of the Announcement.', }) public createdAt: Date; @Column('timestamp with time zone', { comment: 'The updated date of the Announcement.', - nullable: true + nullable: true, }) public updatedAt: Date | null; @Column('varchar', { - length: 8192, nullable: false + length: 8192, nullable: false, }) public text: string; @Column('varchar', { - length: 256, nullable: false + length: 256, nullable: false, }) public title: string; @Column('varchar', { - length: 1024, nullable: true + length: 1024, nullable: true, }) public imageUrl: string | null; diff --git a/packages/backend/src/models/entities/antenna-note.ts b/packages/backend/src/models/entities/antenna-note.ts index 9b911524ef..a72da423de 100644 --- a/packages/backend/src/models/entities/antenna-note.ts +++ b/packages/backend/src/models/entities/antenna-note.ts @@ -12,12 +12,12 @@ export class AntennaNote { @Index() @Column({ ...id(), - comment: 'The note ID.' + comment: 'The note ID.', }) public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @@ -25,19 +25,19 @@ export class AntennaNote { @Index() @Column({ ...id(), - comment: 'The antenna ID.' + comment: 'The antenna ID.', }) public antennaId: Antenna['id']; @ManyToOne(type => Antenna, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public antenna: Antenna | null; @Index() @Column('boolean', { - default: false + default: false, }) public read: boolean; } diff --git a/packages/backend/src/models/entities/antenna.ts b/packages/backend/src/models/entities/antenna.ts index bcfe09a829..ffe7cc7e3d 100644 --- a/packages/backend/src/models/entities/antenna.ts +++ b/packages/backend/src/models/entities/antenna.ts @@ -10,26 +10,26 @@ export class Antenna { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the Antenna.' + comment: 'The created date of the Antenna.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @Column('varchar', { length: 128, - comment: 'The name of the Antenna.' + comment: 'The name of the Antenna.', }) public name: string; @@ -38,51 +38,51 @@ export class Antenna { @Column({ ...id(), - nullable: true + nullable: true, }) public userListId: UserList['id'] | null; @ManyToOne(type => UserList, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public userList: UserList | null; @Column({ ...id(), - nullable: true + nullable: true, }) public userGroupJoiningId: UserGroupJoining['id'] | null; @ManyToOne(type => UserGroupJoining, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public userGroupJoining: UserGroupJoining | null; @Column('varchar', { length: 1024, array: true, - default: '{}' + default: '{}', }) public users: string[]; @Column('jsonb', { - default: [] + default: [], }) public keywords: string[][]; @Column('jsonb', { - default: [] + default: [], }) public excludeKeywords: string[][]; @Column('boolean', { - default: false + default: false, }) public caseSensitive: boolean; @Column('boolean', { - default: false + default: false, }) public withReplies: boolean; diff --git a/packages/backend/src/models/entities/app.ts b/packages/backend/src/models/entities/app.ts index ea87546311..c1efdc0705 100644 --- a/packages/backend/src/models/entities/app.ts +++ b/packages/backend/src/models/entities/app.ts @@ -9,7 +9,7 @@ export class App { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the App.' + comment: 'The created date of the App.', }) public createdAt: Date; @@ -17,7 +17,7 @@ export class App { @Column({ ...id(), nullable: true, - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id'] | null; @@ -30,31 +30,31 @@ export class App { @Index() @Column('varchar', { length: 64, - comment: 'The secret key of the App.' + comment: 'The secret key of the App.', }) public secret: string; @Column('varchar', { length: 128, - comment: 'The name of the App.' + comment: 'The name of the App.', }) public name: string; @Column('varchar', { length: 512, - comment: 'The description of the App.' + comment: 'The description of the App.', }) public description: string; @Column('varchar', { length: 64, array: true, - comment: 'The permission of the App.' + comment: 'The permission of the App.', }) public permission: string[]; @Column('varchar', { length: 512, nullable: true, - comment: 'The callbackUrl of the App.' + comment: 'The callbackUrl of the App.', }) public callbackUrl: string | null; } diff --git a/packages/backend/src/models/entities/attestation-challenge.ts b/packages/backend/src/models/entities/attestation-challenge.ts index 942747c02f..cf3527059e 100644 --- a/packages/backend/src/models/entities/attestation-challenge.ts +++ b/packages/backend/src/models/entities/attestation-challenge.ts @@ -12,7 +12,7 @@ export class AttestationChallenge { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -20,19 +20,19 @@ export class AttestationChallenge { @Index() @Column('varchar', { length: 64, - comment: 'Hex-encoded sha256 hash of the challenge.' + comment: 'Hex-encoded sha256 hash of the challenge.', }) public challenge: string; @Column('timestamp with time zone', { - comment: 'The date challenge was created for expiry purposes.' + comment: 'The date challenge was created for expiry purposes.', }) public createdAt: Date; @Column('boolean', { comment: 'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.', - default: false + default: false, }) public registrationChallenge: boolean; diff --git a/packages/backend/src/models/entities/auth-session.ts b/packages/backend/src/models/entities/auth-session.ts index 4eec27e3f6..1991385525 100644 --- a/packages/backend/src/models/entities/auth-session.ts +++ b/packages/backend/src/models/entities/auth-session.ts @@ -9,25 +9,25 @@ export class AuthSession { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the AuthSession.' + comment: 'The created date of the AuthSession.', }) public createdAt: Date; @Index() @Column('varchar', { - length: 128 + length: 128, }) public token: string; @Column({ ...id(), - nullable: true + nullable: true, }) public userId: User['id']; @ManyToOne(type => User, { onDelete: 'CASCADE', - nullable: true + nullable: true, }) @JoinColumn() public user: User | null; @@ -36,7 +36,7 @@ export class AuthSession { public appId: App['id']; @ManyToOne(type => App, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public app: App | null; diff --git a/packages/backend/src/models/entities/blocking.ts b/packages/backend/src/models/entities/blocking.ts index 48487cb086..aacbfef7fd 100644 --- a/packages/backend/src/models/entities/blocking.ts +++ b/packages/backend/src/models/entities/blocking.ts @@ -10,19 +10,19 @@ export class Blocking { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Blocking.' + comment: 'The created date of the Blocking.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The blockee user ID.' + comment: 'The blockee user ID.', }) public blockeeId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public blockee: User | null; @@ -30,12 +30,12 @@ export class Blocking { @Index() @Column({ ...id(), - comment: 'The blocker user ID.' + comment: 'The blocker user ID.', }) public blockerId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public blocker: User | null; diff --git a/packages/backend/src/models/entities/channel-following.ts b/packages/backend/src/models/entities/channel-following.ts index fca801e5ab..3727283a28 100644 --- a/packages/backend/src/models/entities/channel-following.ts +++ b/packages/backend/src/models/entities/channel-following.ts @@ -11,19 +11,19 @@ export class ChannelFollowing { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the ChannelFollowing.' + comment: 'The created date of the ChannelFollowing.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The followee channel ID.' + comment: 'The followee channel ID.', }) public followeeId: Channel['id']; @ManyToOne(type => Channel, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public followee: Channel | null; @@ -31,12 +31,12 @@ export class ChannelFollowing { @Index() @Column({ ...id(), - comment: 'The follower user ID.' + comment: 'The follower user ID.', }) public followerId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public follower: User | null; diff --git a/packages/backend/src/models/entities/channel-note-pining.ts b/packages/backend/src/models/entities/channel-note-pining.ts index 26a7eb501f..d6b6774033 100644 --- a/packages/backend/src/models/entities/channel-note-pining.ts +++ b/packages/backend/src/models/entities/channel-note-pining.ts @@ -10,7 +10,7 @@ export class ChannelNotePining { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the ChannelNotePining.' + comment: 'The created date of the ChannelNotePining.', }) public createdAt: Date; @@ -19,7 +19,7 @@ export class ChannelNotePining { public channelId: Channel['id']; @ManyToOne(type => Channel, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public channel: Channel | null; @@ -28,7 +28,7 @@ export class ChannelNotePining { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/channel.ts b/packages/backend/src/models/entities/channel.ts index f2d713612d..a6767b038f 100644 --- a/packages/backend/src/models/entities/channel.ts +++ b/packages/backend/src/models/entities/channel.ts @@ -10,13 +10,13 @@ export class Channel { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Channel.' + comment: 'The created date of the Channel.', }) public createdAt: Date; @Index() @Column('timestamp with time zone', { - nullable: true + nullable: true, }) public lastNotedAt: Date | null; @@ -24,37 +24,37 @@ export class Channel { @Column({ ...id(), nullable: true, - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public user: User | null; @Column('varchar', { length: 128, - comment: 'The name of the Channel.' + comment: 'The name of the Channel.', }) public name: string; @Column('varchar', { length: 2048, nullable: true, - comment: 'The description of the Channel.' + comment: 'The description of the Channel.', }) public description: string | null; @Column({ ...id(), nullable: true, - comment: 'The ID of banner Channel.' + comment: 'The ID of banner Channel.', }) public bannerId: DriveFile['id'] | null; @ManyToOne(type => DriveFile, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public banner: DriveFile | null; @@ -62,14 +62,14 @@ export class Channel { @Index() @Column('integer', { default: 0, - comment: 'The count of notes.' + comment: 'The count of notes.', }) public notesCount: number; @Index() @Column('integer', { default: 0, - comment: 'The count of users.' + comment: 'The count of users.', }) public usersCount: number; } diff --git a/packages/backend/src/models/entities/clip-note.ts b/packages/backend/src/models/entities/clip-note.ts index 7d96b2ef7a..2bc4352266 100644 --- a/packages/backend/src/models/entities/clip-note.ts +++ b/packages/backend/src/models/entities/clip-note.ts @@ -12,12 +12,12 @@ export class ClipNote { @Index() @Column({ ...id(), - comment: 'The note ID.' + comment: 'The note ID.', }) public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @@ -25,12 +25,12 @@ export class ClipNote { @Index() @Column({ ...id(), - comment: 'The clip ID.' + comment: 'The clip ID.', }) public clipId: Clip['id']; @ManyToOne(type => Clip, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public clip: Clip | null; diff --git a/packages/backend/src/models/entities/clip.ts b/packages/backend/src/models/entities/clip.ts index 66b5b8847e..84f5c4d214 100644 --- a/packages/backend/src/models/entities/clip.ts +++ b/packages/backend/src/models/entities/clip.ts @@ -8,37 +8,37 @@ export class Clip { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the Clip.' + comment: 'The created date of the Clip.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @Column('varchar', { length: 128, - comment: 'The name of the Clip.' + comment: 'The name of the Clip.', }) public name: string; @Column('boolean', { - default: false + default: false, }) public isPublic: boolean; @Column('varchar', { length: 2048, nullable: true, default: null, - comment: 'The description of the Clip.' + comment: 'The description of the Clip.', }) public description: string | null; } diff --git a/packages/backend/src/models/entities/drive-file.ts b/packages/backend/src/models/entities/drive-file.ts index 4ec7b94ed2..0af52d7cc0 100644 --- a/packages/backend/src/models/entities/drive-file.ts +++ b/packages/backend/src/models/entities/drive-file.ts @@ -11,7 +11,7 @@ export class DriveFile { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the DriveFile.' + comment: 'The created date of the DriveFile.', }) public createdAt: Date; @@ -19,12 +19,12 @@ export class DriveFile { @Column({ ...id(), nullable: true, - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public user: User | null; @@ -32,50 +32,50 @@ export class DriveFile { @Index() @Column('varchar', { length: 128, nullable: true, - comment: 'The host of owner. It will be null if the user in local.' + comment: 'The host of owner. It will be null if the user in local.', }) public userHost: string | null; @Index() @Column('varchar', { length: 32, - comment: 'The MD5 hash of the DriveFile.' + comment: 'The MD5 hash of the DriveFile.', }) public md5: string; @Column('varchar', { length: 256, - comment: 'The file name of the DriveFile.' + comment: 'The file name of the DriveFile.', }) public name: string; @Index() @Column('varchar', { length: 128, - comment: 'The content type (MIME) of the DriveFile.' + comment: 'The content type (MIME) of the DriveFile.', }) public type: string; @Column('integer', { - comment: 'The file size (bytes) of the DriveFile.' + comment: 'The file size (bytes) of the DriveFile.', }) public size: number; @Column('varchar', { length: 512, nullable: true, - comment: 'The comment of the DriveFile.' + comment: 'The comment of the DriveFile.', }) public comment: string | null; @Column('varchar', { length: 128, nullable: true, - comment: 'The BlurHash string.' + comment: 'The BlurHash string.', }) public blurhash: string | null; @Column('jsonb', { default: {}, - comment: 'The any properties of the DriveFile. For example, it includes image width/height.' + comment: 'The any properties of the DriveFile. For example, it includes image width/height.', }) public properties: { width?: number; height?: number; orientation?: number; avgColor?: string }; @@ -85,19 +85,19 @@ export class DriveFile { @Column('varchar', { length: 512, - comment: 'The URL of the DriveFile.' + comment: 'The URL of the DriveFile.', }) public url: string; @Column('varchar', { length: 512, nullable: true, - comment: 'The URL of the thumbnail of the DriveFile.' + comment: 'The URL of the thumbnail of the DriveFile.', }) public thumbnailUrl: string | null; @Column('varchar', { length: 512, nullable: true, - comment: 'The URL of the webpublic of the DriveFile.' + comment: 'The URL of the webpublic of the DriveFile.', }) public webpublicUrl: string | null; @@ -122,7 +122,7 @@ export class DriveFile { @Index() @Column('varchar', { length: 512, nullable: true, - comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.' + comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.', }) public uri: string | null; @@ -135,12 +135,12 @@ export class DriveFile { @Column({ ...id(), nullable: true, - comment: 'The parent folder ID. If null, it means the DriveFile is located in root.' + comment: 'The parent folder ID. If null, it means the DriveFile is located in root.', }) public folderId: DriveFolder['id'] | null; @ManyToOne(type => DriveFolder, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public folder: DriveFolder | null; @@ -148,7 +148,7 @@ export class DriveFile { @Index() @Column('boolean', { default: false, - comment: 'Whether the DriveFile is NSFW.' + comment: 'Whether the DriveFile is NSFW.', }) public isSensitive: boolean; @@ -158,7 +158,7 @@ export class DriveFile { @Index() @Column('boolean', { default: false, - comment: 'Whether the DriveFile is direct link to remote server.' + comment: 'Whether the DriveFile is direct link to remote server.', }) public isLink: boolean; } diff --git a/packages/backend/src/models/entities/drive-folder.ts b/packages/backend/src/models/entities/drive-folder.ts index a80d075855..09f5e6448e 100644 --- a/packages/backend/src/models/entities/drive-folder.ts +++ b/packages/backend/src/models/entities/drive-folder.ts @@ -9,13 +9,13 @@ export class DriveFolder { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the DriveFolder.' + comment: 'The created date of the DriveFolder.', }) public createdAt: Date; @Column('varchar', { length: 128, - comment: 'The name of the DriveFolder.' + comment: 'The name of the DriveFolder.', }) public name: string; @@ -23,12 +23,12 @@ export class DriveFolder { @Column({ ...id(), nullable: true, - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -37,12 +37,12 @@ export class DriveFolder { @Column({ ...id(), nullable: true, - comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.' + comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.', }) public parentId: DriveFolder['id'] | null; @ManyToOne(type => DriveFolder, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public parent: DriveFolder | null; diff --git a/packages/backend/src/models/entities/emoji.ts b/packages/backend/src/models/entities/emoji.ts index d6080ae099..1146908a88 100644 --- a/packages/backend/src/models/entities/emoji.ts +++ b/packages/backend/src/models/entities/emoji.ts @@ -8,24 +8,24 @@ export class Emoji { public id: string; @Column('timestamp with time zone', { - nullable: true + nullable: true, }) public updatedAt: Date | null; @Index() @Column('varchar', { - length: 128 + length: 128, }) public name: string; @Index() @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public host: string | null; @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public category: string | null; @@ -35,17 +35,17 @@ export class Emoji { public url: string; @Column('varchar', { - length: 512, nullable: true + length: 512, nullable: true, }) public uri: string | null; @Column('varchar', { - length: 64, nullable: true + length: 64, nullable: true, }) public type: string | null; @Column('varchar', { - array: true, length: 128, default: '{}' + array: true, length: 128, default: '{}', }) public aliases: string[]; } diff --git a/packages/backend/src/models/entities/follow-request.ts b/packages/backend/src/models/entities/follow-request.ts index 22ec263962..6aa202299a 100644 --- a/packages/backend/src/models/entities/follow-request.ts +++ b/packages/backend/src/models/entities/follow-request.ts @@ -9,19 +9,19 @@ export class FollowRequest { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the FollowRequest.' + comment: 'The created date of the FollowRequest.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The followee user ID.' + comment: 'The followee user ID.', }) public followeeId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public followee: User | null; @@ -29,56 +29,56 @@ export class FollowRequest { @Index() @Column({ ...id(), - comment: 'The follower user ID.' + comment: 'The follower user ID.', }) public followerId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public follower: User | null; @Column('varchar', { length: 128, nullable: true, - comment: 'id of Follow Activity.' + comment: 'id of Follow Activity.', }) public requestId: string | null; //#region Denormalized fields @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followerHost: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followerInbox: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followerSharedInbox: string | null; @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followeeHost: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followeeInbox: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followeeSharedInbox: string | null; //#endregion diff --git a/packages/backend/src/models/entities/following.ts b/packages/backend/src/models/entities/following.ts index ee3286a1a1..c3631e8501 100644 --- a/packages/backend/src/models/entities/following.ts +++ b/packages/backend/src/models/entities/following.ts @@ -10,19 +10,19 @@ export class Following { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Following.' + comment: 'The created date of the Following.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The followee user ID.' + comment: 'The followee user ID.', }) public followeeId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public followee: User | null; @@ -30,12 +30,12 @@ export class Following { @Index() @Column({ ...id(), - comment: 'The follower user ID.' + comment: 'The follower user ID.', }) public followerId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public follower: User | null; @@ -43,37 +43,37 @@ export class Following { //#region Denormalized fields @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followerHost: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followerInbox: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followerSharedInbox: string | null; @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followeeHost: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followeeInbox: string | null; @Column('varchar', { length: 512, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public followeeSharedInbox: string | null; //#endregion diff --git a/packages/backend/src/models/entities/gallery-like.ts b/packages/backend/src/models/entities/gallery-like.ts index 7d084a2275..41615dcea9 100644 --- a/packages/backend/src/models/entities/gallery-like.ts +++ b/packages/backend/src/models/entities/gallery-like.ts @@ -17,7 +17,7 @@ export class GalleryLike { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -26,7 +26,7 @@ export class GalleryLike { public postId: GalleryPost['id']; @ManyToOne(type => GalleryPost, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public post: GalleryPost | null; diff --git a/packages/backend/src/models/entities/gallery-post.ts b/packages/backend/src/models/entities/gallery-post.ts index f59cd671f3..393603e3d9 100644 --- a/packages/backend/src/models/entities/gallery-post.ts +++ b/packages/backend/src/models/entities/gallery-post.ts @@ -10,13 +10,13 @@ export class GalleryPost { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the GalleryPost.' + comment: 'The created date of the GalleryPost.', }) public createdAt: Date; @Index() @Column('timestamp with time zone', { - comment: 'The updated date of the GalleryPost.' + comment: 'The updated date of the GalleryPost.', }) public updatedAt: Date; @@ -26,19 +26,19 @@ export class GalleryPost { public title: string; @Column('varchar', { - length: 2048, nullable: true + length: 2048, nullable: true, }) public description: string | null; @Index() @Column({ ...id(), - comment: 'The ID of author.' + comment: 'The ID of author.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -46,26 +46,26 @@ export class GalleryPost { @Index() @Column({ ...id(), - array: true, default: '{}' + array: true, default: '{}', }) public fileIds: DriveFile['id'][]; @Index() @Column('boolean', { default: false, - comment: 'Whether the post is sensitive.' + comment: 'Whether the post is sensitive.', }) public isSensitive: boolean; @Index() @Column('integer', { - default: 0 + default: 0, }) public likedCount: number; @Index() @Column('varchar', { - length: 128, array: true, default: '{}' + length: 128, array: true, default: '{}', }) public tags: string[]; diff --git a/packages/backend/src/models/entities/games/reversi/game.ts b/packages/backend/src/models/entities/games/reversi/game.ts index 9deacaf5c6..fe9b8a5ba5 100644 --- a/packages/backend/src/models/entities/games/reversi/game.ts +++ b/packages/backend/src/models/entities/games/reversi/game.ts @@ -9,13 +9,13 @@ export class ReversiGame { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the ReversiGame.' + comment: 'The created date of the ReversiGame.', }) public createdAt: Date; @Column('timestamp with time zone', { nullable: true, - comment: 'The started date of the ReversiGame.' + comment: 'The started date of the ReversiGame.', }) public startedAt: Date | null; @@ -23,7 +23,7 @@ export class ReversiGame { public user1Id: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user1: User | null; @@ -32,7 +32,7 @@ export class ReversiGame { public user2Id: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user2: User | null; @@ -69,13 +69,13 @@ export class ReversiGame { @Column({ ...id(), - nullable: true + nullable: true, }) public winnerId: User['id'] | null; @Column({ ...id(), - nullable: true + nullable: true, }) public surrendered: User['id'] | null; @@ -94,7 +94,7 @@ export class ReversiGame { public map: string[]; @Column('varchar', { - length: 32 + length: 32, }) public bw: string; @@ -127,7 +127,7 @@ export class ReversiGame { * ログのposを文字列としてすべて連結したもののCRC32値 */ @Column('varchar', { - length: 32, nullable: true + length: 32, nullable: true, }) public crc32: string | null; } diff --git a/packages/backend/src/models/entities/games/reversi/matching.ts b/packages/backend/src/models/entities/games/reversi/matching.ts index 477a29316e..70bb555e2f 100644 --- a/packages/backend/src/models/entities/games/reversi/matching.ts +++ b/packages/backend/src/models/entities/games/reversi/matching.ts @@ -9,7 +9,7 @@ export class ReversiMatching { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the ReversiMatching.' + comment: 'The created date of the ReversiMatching.', }) public createdAt: Date; @@ -18,7 +18,7 @@ export class ReversiMatching { public parentId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public parent: User | null; @@ -28,7 +28,7 @@ export class ReversiMatching { public childId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public child: User | null; diff --git a/packages/backend/src/models/entities/hashtag.ts b/packages/backend/src/models/entities/hashtag.ts index 842cdaa562..761974590a 100644 --- a/packages/backend/src/models/entities/hashtag.ts +++ b/packages/backend/src/models/entities/hashtag.ts @@ -9,7 +9,7 @@ export class Hashtag { @Index({ unique: true }) @Column('varchar', { - length: 128 + length: 128, }) public name: string; @@ -21,7 +21,7 @@ export class Hashtag { @Index() @Column('integer', { - default: 0 + default: 0, }) public mentionedUsersCount: number; @@ -33,7 +33,7 @@ export class Hashtag { @Index() @Column('integer', { - default: 0 + default: 0, }) public mentionedLocalUsersCount: number; @@ -45,7 +45,7 @@ export class Hashtag { @Index() @Column('integer', { - default: 0 + default: 0, }) public mentionedRemoteUsersCount: number; @@ -57,7 +57,7 @@ export class Hashtag { @Index() @Column('integer', { - default: 0 + default: 0, }) public attachedUsersCount: number; @@ -69,7 +69,7 @@ export class Hashtag { @Index() @Column('integer', { - default: 0 + default: 0, }) public attachedLocalUsersCount: number; @@ -81,7 +81,7 @@ export class Hashtag { @Index() @Column('integer', { - default: 0 + default: 0, }) public attachedRemoteUsersCount: number; } diff --git a/packages/backend/src/models/entities/instance.ts b/packages/backend/src/models/entities/instance.ts index 7c8719e06a..d1314be178 100644 --- a/packages/backend/src/models/entities/instance.ts +++ b/packages/backend/src/models/entities/instance.ts @@ -11,7 +11,7 @@ export class Instance { */ @Index() @Column('timestamp with time zone', { - comment: 'The caught date of the Instance.' + comment: 'The caught date of the Instance.', }) public caughtAt: Date; @@ -21,7 +21,7 @@ export class Instance { @Index({ unique: true }) @Column('varchar', { length: 128, - comment: 'The host of the Instance.' + comment: 'The host of the Instance.', }) public host: string; @@ -30,7 +30,7 @@ export class Instance { */ @Column('integer', { default: 0, - comment: 'The count of the users of the Instance.' + comment: 'The count of the users of the Instance.', }) public usersCount: number; @@ -39,7 +39,7 @@ export class Instance { */ @Column('integer', { default: 0, - comment: 'The count of the notes of the Instance.' + comment: 'The count of the notes of the Instance.', }) public notesCount: number; @@ -109,7 +109,7 @@ export class Instance { * このインスタンスと不通かどうか */ @Column('boolean', { - default: false + default: false, }) public isNotResponding: boolean; @@ -118,13 +118,13 @@ export class Instance { */ @Index() @Column('boolean', { - default: false + default: false, }) public isSuspended: boolean; @Column('varchar', { length: 64, nullable: true, default: null, - comment: 'The software of the Instance.' + comment: 'The software of the Instance.', }) public softwareName: string | null; diff --git a/packages/backend/src/models/entities/messaging-message.ts b/packages/backend/src/models/entities/messaging-message.ts index ac0764674c..06ae005de9 100644 --- a/packages/backend/src/models/entities/messaging-message.ts +++ b/packages/backend/src/models/entities/messaging-message.ts @@ -11,19 +11,19 @@ export class MessagingMessage { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the MessagingMessage.' + comment: 'The created date of the MessagingMessage.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The sender user ID.' + comment: 'The sender user ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -31,12 +31,12 @@ export class MessagingMessage { @Index() @Column({ ...id(), nullable: true, - comment: 'The recipient user ID.' + comment: 'The recipient user ID.', }) public recipientId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public recipient: User | null; @@ -44,18 +44,18 @@ export class MessagingMessage { @Index() @Column({ ...id(), nullable: true, - comment: 'The recipient group ID.' + comment: 'The recipient group ID.', }) public groupId: UserGroup['id'] | null; @ManyToOne(type => UserGroup, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public group: UserGroup | null; @Column('varchar', { - length: 4096, nullable: true + length: 4096, nullable: true, }) public text: string | null; @@ -71,7 +71,7 @@ export class MessagingMessage { @Column({ ...id(), - array: true, default: '{}' + array: true, default: '{}', }) public reads: User['id'][]; @@ -82,7 +82,7 @@ export class MessagingMessage { public fileId: DriveFile['id'] | null; @ManyToOne(type => DriveFile, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public file: DriveFile | null; diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index 9a1a87c155..c462d5ade6 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -7,17 +7,17 @@ import { Clip } from './clip'; export class Meta { @PrimaryColumn({ type: 'varchar', - length: 32 + length: 32, }) public id: string; @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public name: string | null; @Column('varchar', { - length: 1024, nullable: true + length: 1024, nullable: true, }) public description: string | null; @@ -25,7 +25,7 @@ export class Meta { * メンテナの名前 */ @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public maintainerName: string | null; @@ -33,7 +33,7 @@ export class Meta { * メンテナの連絡先 */ @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public maintainerEmail: string | null; @@ -58,27 +58,27 @@ export class Meta { public useStarForReactionFallback: boolean; @Column('varchar', { - length: 64, array: true, default: '{}' + length: 64, array: true, default: '{}', }) public langs: string[]; @Column('varchar', { - length: 256, array: true, default: '{}' + length: 256, array: true, default: '{}', }) public pinnedUsers: string[]; @Column('varchar', { - length: 256, array: true, default: '{}' + length: 256, array: true, default: '{}', }) public hiddenTags: string[]; @Column('varchar', { - length: 256, array: true, default: '{}' + length: 256, array: true, default: '{}', }) public blockedHosts: string[]; @Column('varchar', { - length: 512, array: true, default: '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}' + length: 512, array: true, default: '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}', }) public pinnedPages: string[]; @@ -91,38 +91,38 @@ export class Meta { @Column('varchar', { length: 512, nullable: true, - default: '/assets/ai.png' + default: '/assets/ai.png', }) public mascotImageUrl: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public bannerUrl: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public backgroundImageUrl: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public logoImageUrl: string | null; @Column('varchar', { length: 512, nullable: true, - default: 'https://xn--931a.moe/aiart/yubitun.png' + default: 'https://xn--931a.moe/aiart/yubitun.png', }) public errorImageUrl: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public iconUrl: string | null; @@ -143,7 +143,7 @@ export class Meta { public proxyAccountId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public proxyAccount: User | null; @@ -160,13 +160,13 @@ export class Meta { @Column('varchar', { length: 64, - nullable: true + nullable: true, }) public hcaptchaSiteKey: string | null; @Column('varchar', { length: 64, - nullable: true + nullable: true, }) public hcaptchaSecretKey: string | null; @@ -177,37 +177,37 @@ export class Meta { @Column('varchar', { length: 64, - nullable: true + nullable: true, }) public recaptchaSiteKey: string | null; @Column('varchar', { length: 64, - nullable: true + nullable: true, }) public recaptchaSecretKey: string | null; @Column('integer', { default: 1024, - comment: 'Drive capacity of a local user (MB)' + comment: 'Drive capacity of a local user (MB)', }) public localDriveCapacityMb: number; @Column('integer', { default: 32, - comment: 'Drive capacity of a remote user (MB)' + comment: 'Drive capacity of a remote user (MB)', }) public remoteDriveCapacityMb: number; @Column('integer', { default: 500, - comment: 'Max allowed note text length in characters' + comment: 'Max allowed note text length in characters', }) public maxNoteTextLength: number; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public summalyProxy: string | null; @@ -218,7 +218,7 @@ export class Meta { @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public email: string | null; @@ -229,24 +229,24 @@ export class Meta { @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public smtpHost: string | null; @Column('integer', { - nullable: true + nullable: true, }) public smtpPort: number | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public smtpUser: string | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public smtpPass: string | null; @@ -257,13 +257,13 @@ export class Meta { @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public swPublicKey: string | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public swPrivateKey: string | null; @@ -274,13 +274,13 @@ export class Meta { @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public twitterConsumerKey: string | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public twitterConsumerSecret: string | null; @@ -291,13 +291,13 @@ export class Meta { @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public githubClientId: string | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public githubClientSecret: string | null; @@ -308,19 +308,19 @@ export class Meta { @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public discordClientId: string | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public discordClientSecret: string | null; @Column('varchar', { length: 128, - nullable: true + nullable: true, }) public deeplAuthKey: string | null; @@ -331,21 +331,21 @@ export class Meta { @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public ToSUrl: string | null; @Column('varchar', { length: 512, default: 'https://github.com/misskey-dev/misskey', - nullable: false + nullable: false, }) public repositoryUrl: string; @Column('varchar', { length: 512, default: 'https://github.com/misskey-dev/misskey/issues/new', - nullable: true + nullable: true, }) public feedbackUrl: string | null; @@ -356,48 +356,48 @@ export class Meta { @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStorageBucket: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStoragePrefix: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStorageBaseUrl: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStorageEndpoint: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStorageRegion: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStorageAccessKey: string | null; @Column('varchar', { length: 512, - nullable: true + nullable: true, }) public objectStorageSecretKey: string | null; @Column('integer', { - nullable: true + nullable: true, }) public objectStoragePort: number | null; diff --git a/packages/backend/src/models/entities/moderation-log.ts b/packages/backend/src/models/entities/moderation-log.ts index 33d3d683ae..fe000e14f2 100644 --- a/packages/backend/src/models/entities/moderation-log.ts +++ b/packages/backend/src/models/entities/moderation-log.ts @@ -8,7 +8,7 @@ export class ModerationLog { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the ModerationLog.' + comment: 'The created date of the ModerationLog.', }) public createdAt: Date; @@ -17,7 +17,7 @@ export class ModerationLog { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/muted-note.ts b/packages/backend/src/models/entities/muted-note.ts index 3cb6c13d3e..b4ffa594df 100644 --- a/packages/backend/src/models/entities/muted-note.ts +++ b/packages/backend/src/models/entities/muted-note.ts @@ -13,12 +13,12 @@ export class MutedNote { @Index() @Column({ ...id(), - comment: 'The note ID.' + comment: 'The note ID.', }) public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @@ -26,12 +26,12 @@ export class MutedNote { @Index() @Column({ ...id(), - comment: 'The user ID.' + comment: 'The user ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -42,7 +42,7 @@ export class MutedNote { @Index() @Column('enum', { enum: mutedNoteReasons, - comment: 'The reason of the MutedNote.' + comment: 'The reason of the MutedNote.', }) public reason: typeof mutedNoteReasons[number]; } diff --git a/packages/backend/src/models/entities/muting.ts b/packages/backend/src/models/entities/muting.ts index 0084213bcc..b9f18a5852 100644 --- a/packages/backend/src/models/entities/muting.ts +++ b/packages/backend/src/models/entities/muting.ts @@ -10,19 +10,19 @@ export class Muting { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Muting.' + comment: 'The created date of the Muting.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The mutee user ID.' + comment: 'The mutee user ID.', }) public muteeId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public mutee: User | null; @@ -30,12 +30,12 @@ export class Muting { @Index() @Column({ ...id(), - comment: 'The muter user ID.' + comment: 'The muter user ID.', }) public muterId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public muter: User | null; diff --git a/packages/backend/src/models/entities/note-favorite.ts b/packages/backend/src/models/entities/note-favorite.ts index 0713c3ae56..69d9b49d13 100644 --- a/packages/backend/src/models/entities/note-favorite.ts +++ b/packages/backend/src/models/entities/note-favorite.ts @@ -10,7 +10,7 @@ export class NoteFavorite { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the NoteFavorite.' + comment: 'The created date of the NoteFavorite.', }) public createdAt: Date; @@ -19,7 +19,7 @@ export class NoteFavorite { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -28,7 +28,7 @@ export class NoteFavorite { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/note-reaction.ts b/packages/backend/src/models/entities/note-reaction.ts index 674dc3639e..369505a6c6 100644 --- a/packages/backend/src/models/entities/note-reaction.ts +++ b/packages/backend/src/models/entities/note-reaction.ts @@ -11,7 +11,7 @@ export class NoteReaction { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the NoteReaction.' + comment: 'The created date of the NoteReaction.', }) public createdAt: Date; @@ -20,7 +20,7 @@ export class NoteReaction { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user?: User | null; @@ -30,7 +30,7 @@ export class NoteReaction { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note?: Note | null; @@ -38,7 +38,7 @@ export class NoteReaction { // TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため) @Column('varchar', { - length: 260 + length: 260, }) public reaction: string; } diff --git a/packages/backend/src/models/entities/note-thread-muting.ts b/packages/backend/src/models/entities/note-thread-muting.ts index b438522a4c..f4a3a48876 100644 --- a/packages/backend/src/models/entities/note-thread-muting.ts +++ b/packages/backend/src/models/entities/note-thread-muting.ts @@ -20,7 +20,7 @@ export class NoteThreadMuting { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/note-unread.ts b/packages/backend/src/models/entities/note-unread.ts index 57dda4fafd..952f71cdaa 100644 --- a/packages/backend/src/models/entities/note-unread.ts +++ b/packages/backend/src/models/entities/note-unread.ts @@ -15,7 +15,7 @@ export class NoteUnread { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -25,7 +25,7 @@ export class NoteUnread { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @@ -48,7 +48,7 @@ export class NoteUnread { @Index() @Column({ ...id(), - comment: '[Denormalized]' + comment: '[Denormalized]', }) public noteUserId: User['id']; @@ -56,7 +56,7 @@ export class NoteUnread { @Column({ ...id(), nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public noteChannelId: Channel['id'] | null; //#endregion diff --git a/packages/backend/src/models/entities/note-watching.ts b/packages/backend/src/models/entities/note-watching.ts index 741a1c0c8b..2758efdc35 100644 --- a/packages/backend/src/models/entities/note-watching.ts +++ b/packages/backend/src/models/entities/note-watching.ts @@ -11,19 +11,19 @@ export class NoteWatching { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the NoteWatching.' + comment: 'The created date of the NoteWatching.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The watcher ID.' + comment: 'The watcher ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -31,12 +31,12 @@ export class NoteWatching { @Index() @Column({ ...id(), - comment: 'The target Note ID.' + comment: 'The target Note ID.', }) public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @@ -45,7 +45,7 @@ export class NoteWatching { @Index() @Column({ ...id(), - comment: '[Denormalized]' + comment: '[Denormalized]', }) public noteUserId: Note['userId']; //#endregion diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index 449c88a4d5..933d3ad01d 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -15,7 +15,7 @@ export class Note { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Note.' + comment: 'The created date of the Note.', }) public createdAt: Date; @@ -23,12 +23,12 @@ export class Note { @Column({ ...id(), nullable: true, - comment: 'The ID of reply target.' + comment: 'The ID of reply target.', }) public replyId: Note['id'] | null; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public reply: Note | null; @@ -37,67 +37,67 @@ export class Note { @Column({ ...id(), nullable: true, - comment: 'The ID of renote target.' + comment: 'The ID of renote target.', }) public renoteId: Note['id'] | null; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public renote: Note | null; @Index() @Column('varchar', { - length: 256, nullable: true + length: 256, nullable: true, }) public threadId: string | null; @Column('varchar', { - length: 8192, nullable: true + length: 8192, nullable: true, }) public text: string | null; @Column('varchar', { - length: 256, nullable: true + length: 256, nullable: true, }) public name: string | null; @Column('varchar', { - length: 512, nullable: true + length: 512, nullable: true, }) public cw: string | null; @Index() @Column({ ...id(), - comment: 'The ID of author.' + comment: 'The ID of author.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @Column('boolean', { - default: false + default: false, }) public localOnly: boolean; @Column('smallint', { - default: 0 + default: 0, }) public renoteCount: number; @Column('smallint', { - default: 0 + default: 0, }) public repliesCount: number; @Column('jsonb', { - default: {} + default: {}, }) public reactions: Record; @@ -113,66 +113,66 @@ export class Note { @Index({ unique: true }) @Column('varchar', { length: 512, nullable: true, - comment: 'The URI of a note. it will be null when the note is local.' + comment: 'The URI of a note. it will be null when the note is local.', }) public uri: string | null; @Column('varchar', { length: 512, nullable: true, - comment: 'The human readable url of a note. it will be null when the note is local.' + comment: 'The human readable url of a note. it will be null when the note is local.', }) public url: string | null; @Column('integer', { - default: 0, select: false + default: 0, select: false, }) public score: number; @Index() @Column({ ...id(), - array: true, default: '{}' + array: true, default: '{}', }) public fileIds: DriveFile['id'][]; @Index() @Column('varchar', { - length: 256, array: true, default: '{}' + length: 256, array: true, default: '{}', }) public attachedFileTypes: string[]; @Index() @Column({ ...id(), - array: true, default: '{}' + array: true, default: '{}', }) public visibleUserIds: User['id'][]; @Index() @Column({ ...id(), - array: true, default: '{}' + array: true, default: '{}', }) public mentions: User['id'][]; @Column('text', { - default: '[]' + default: '[]', }) public mentionedRemoteUsers: string; @Column('varchar', { - length: 128, array: true, default: '{}' + length: 128, array: true, default: '{}', }) public emojis: string[]; @Index() @Column('varchar', { - length: 128, array: true, default: '{}' + length: 128, array: true, default: '{}', }) public tags: string[]; @Column('boolean', { - default: false + default: false, }) public hasPoll: boolean; @@ -180,12 +180,12 @@ export class Note { @Column({ ...id(), nullable: true, default: null, - comment: 'The ID of source channel.' + comment: 'The ID of source channel.', }) public channelId: Channel['id'] | null; @ManyToOne(type => Channel, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public channel: Channel | null; @@ -194,33 +194,33 @@ export class Note { @Index() @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public userHost: string | null; @Column({ ...id(), nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public replyUserId: User['id'] | null; @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public replyUserHost: string | null; @Column({ ...id(), nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public renoteUserId: User['id'] | null; @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public renoteUserHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/notification.ts b/packages/backend/src/models/entities/notification.ts index 47184caacc..9c1d8242fe 100644 --- a/packages/backend/src/models/entities/notification.ts +++ b/packages/backend/src/models/entities/notification.ts @@ -14,7 +14,7 @@ export class Notification { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Notification.' + comment: 'The created date of the Notification.', }) public createdAt: Date; @@ -24,12 +24,12 @@ export class Notification { @Index() @Column({ ...id(), - comment: 'The ID of recipient user of the Notification.' + comment: 'The ID of recipient user of the Notification.', }) public notifieeId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public notifiee: User | null; @@ -41,12 +41,12 @@ export class Notification { @Column({ ...id(), nullable: true, - comment: 'The ID of sender user of the Notification.' + comment: 'The ID of sender user of the Notification.', }) public notifierId: User['id'] | null; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public notifier: User | null; @@ -68,7 +68,7 @@ export class Notification { @Index() @Column('enum', { enum: notificationTypes, - comment: 'The type of the Notification.' + comment: 'The type of the Notification.', }) public type: typeof notificationTypes[number]; @@ -78,53 +78,53 @@ export class Notification { @Index() @Column('boolean', { default: false, - comment: 'Whether the Notification is read.' + comment: 'Whether the Notification is read.', }) public isRead: boolean; @Column({ ...id(), - nullable: true + nullable: true, }) public noteId: Note['id'] | null; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @Column({ ...id(), - nullable: true + nullable: true, }) public followRequestId: FollowRequest['id'] | null; @ManyToOne(type => FollowRequest, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public followRequest: FollowRequest | null; @Column({ ...id(), - nullable: true + nullable: true, }) public userGroupInvitationId: UserGroupInvitation['id'] | null; @ManyToOne(type => UserGroupInvitation, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public userGroupInvitation: UserGroupInvitation | null; @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public reaction: string | null; @Column('integer', { - nullable: true + nullable: true, }) public choice: number | null; @@ -132,7 +132,7 @@ export class Notification { * アプリ通知のbody */ @Column('varchar', { - length: 2048, nullable: true + length: 2048, nullable: true, }) public customBody: string | null; @@ -141,7 +141,7 @@ export class Notification { * (省略時はアプリ名で表示されることを期待) */ @Column('varchar', { - length: 256, nullable: true + length: 256, nullable: true, }) public customHeader: string | null; @@ -150,7 +150,7 @@ export class Notification { * (省略時はアプリアイコンで表示されることを期待) */ @Column('varchar', { - length: 1024, nullable: true + length: 1024, nullable: true, }) public customIcon: string | null; @@ -160,12 +160,12 @@ export class Notification { @Index() @Column({ ...id(), - nullable: true + nullable: true, }) public appAccessTokenId: AccessToken['id'] | null; @ManyToOne(type => AccessToken, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public appAccessToken: AccessToken | null; diff --git a/packages/backend/src/models/entities/page-like.ts b/packages/backend/src/models/entities/page-like.ts index ca84ece8fd..16fb8f172a 100644 --- a/packages/backend/src/models/entities/page-like.ts +++ b/packages/backend/src/models/entities/page-like.ts @@ -17,7 +17,7 @@ export class PageLike { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -26,7 +26,7 @@ export class PageLike { public pageId: Page['id']; @ManyToOne(type => Page, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public page: Page | null; diff --git a/packages/backend/src/models/entities/page.ts b/packages/backend/src/models/entities/page.ts index ed0411a3d0..2b540e1990 100644 --- a/packages/backend/src/models/entities/page.ts +++ b/packages/backend/src/models/entities/page.ts @@ -11,13 +11,13 @@ export class Page { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the Page.' + comment: 'The created date of the Page.', }) public createdAt: Date; @Index() @Column('timestamp with time zone', { - comment: 'The updated date of the Page.' + comment: 'The updated date of the Page.', }) public updatedAt: Date; @@ -33,7 +33,7 @@ export class Page { public name: string; @Column('varchar', { - length: 256, nullable: true + length: 256, nullable: true, }) public summary: string | null; @@ -41,7 +41,7 @@ export class Page { public alignCenter: boolean; @Column('boolean', { - default: false + default: false, }) public hideTitleWhenPinned: boolean; @@ -53,12 +53,12 @@ export class Page { @Index() @Column({ ...id(), - comment: 'The ID of author.' + comment: 'The ID of author.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -70,24 +70,24 @@ export class Page { public eyeCatchingImageId: DriveFile['id'] | null; @ManyToOne(type => DriveFile, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public eyeCatchingImage: DriveFile | null; @Column('jsonb', { - default: [] + default: [], }) public content: Record[]; @Column('jsonb', { - default: [] + default: [], }) public variables: Record[]; @Column('varchar', { length: 16384, - default: '' + default: '', }) public script: string; @@ -102,12 +102,12 @@ export class Page { @Index() @Column({ ...id(), - array: true, default: '{}' + array: true, default: '{}', }) public visibleUserIds: User['id'][]; @Column('integer', { - default: 0 + default: 0, }) public likedCount: number; diff --git a/packages/backend/src/models/entities/password-reset-request.ts b/packages/backend/src/models/entities/password-reset-request.ts index 6d41d38a93..a2db0f1147 100644 --- a/packages/backend/src/models/entities/password-reset-request.ts +++ b/packages/backend/src/models/entities/password-reset-request.ts @@ -23,7 +23,7 @@ export class PasswordResetRequest { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/poll-vote.ts b/packages/backend/src/models/entities/poll-vote.ts index 709376f909..fb44a58e9f 100644 --- a/packages/backend/src/models/entities/poll-vote.ts +++ b/packages/backend/src/models/entities/poll-vote.ts @@ -11,7 +11,7 @@ export class PollVote { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the PollVote.' + comment: 'The created date of the PollVote.', }) public createdAt: Date; @@ -20,7 +20,7 @@ export class PollVote { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -30,7 +30,7 @@ export class PollVote { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/poll.ts b/packages/backend/src/models/entities/poll.ts index f88649b4ea..c6aceed186 100644 --- a/packages/backend/src/models/entities/poll.ts +++ b/packages/backend/src/models/entities/poll.ts @@ -10,13 +10,13 @@ export class Poll { public noteId: Note['id']; @OneToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @Column('timestamp with time zone', { - nullable: true + nullable: true, }) public expiresAt: Date | null; @@ -24,7 +24,7 @@ export class Poll { public multiple: boolean; @Column('varchar', { - length: 128, array: true, default: '{}' + length: 128, array: true, default: '{}', }) public choices: string[]; @@ -36,21 +36,21 @@ export class Poll { //#region Denormalized fields @Column('enum', { enum: noteVisibilities, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public noteVisibility: typeof noteVisibilities[number]; @Index() @Column({ ...id(), - comment: '[Denormalized]' + comment: '[Denormalized]', }) public userId: User['id']; @Index() @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public userHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/promo-note.ts b/packages/backend/src/models/entities/promo-note.ts index 474f1cb235..e3fbab4414 100644 --- a/packages/backend/src/models/entities/promo-note.ts +++ b/packages/backend/src/models/entities/promo-note.ts @@ -9,7 +9,7 @@ export class PromoNote { public noteId: Note['id']; @OneToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; @@ -21,7 +21,7 @@ export class PromoNote { @Index() @Column({ ...id(), - comment: '[Denormalized]' + comment: '[Denormalized]', }) public userId: User['id']; //#endregion diff --git a/packages/backend/src/models/entities/promo-read.ts b/packages/backend/src/models/entities/promo-read.ts index 2e0977b6b5..777ed301ba 100644 --- a/packages/backend/src/models/entities/promo-read.ts +++ b/packages/backend/src/models/entities/promo-read.ts @@ -10,7 +10,7 @@ export class PromoRead { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the PromoRead.' + comment: 'The created date of the PromoRead.', }) public createdAt: Date; @@ -19,7 +19,7 @@ export class PromoRead { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -28,7 +28,7 @@ export class PromoRead { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/registry-item.ts b/packages/backend/src/models/entities/registry-item.ts index 54d2ef2082..6d5f0185db 100644 --- a/packages/backend/src/models/entities/registry-item.ts +++ b/packages/backend/src/models/entities/registry-item.ts @@ -9,50 +9,50 @@ export class RegistryItem { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the RegistryItem.' + comment: 'The created date of the RegistryItem.', }) public createdAt: Date; @Column('timestamp with time zone', { - comment: 'The updated date of the RegistryItem.' + comment: 'The updated date of the RegistryItem.', }) public updatedAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @Column('varchar', { length: 1024, - comment: 'The key of the RegistryItem.' + comment: 'The key of the RegistryItem.', }) public key: string; @Column('jsonb', { default: {}, nullable: true, - comment: 'The value of the RegistryItem.' + comment: 'The value of the RegistryItem.', }) public value: any | null; @Index() @Column('varchar', { - length: 1024, array: true, default: '{}' + length: 1024, array: true, default: '{}', }) public scope: string[]; // サードパーティアプリに開放するときのためのカラム @Index() @Column('varchar', { - length: 512, nullable: true + length: 512, nullable: true, }) public domain: string | null; } diff --git a/packages/backend/src/models/entities/signin.ts b/packages/backend/src/models/entities/signin.ts index 7e047084b1..7f54f2ebf2 100644 --- a/packages/backend/src/models/entities/signin.ts +++ b/packages/backend/src/models/entities/signin.ts @@ -8,7 +8,7 @@ export class Signin { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the Signin.' + comment: 'The created date of the Signin.', }) public createdAt: Date; @@ -17,7 +17,7 @@ export class Signin { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/sw-subscription.ts b/packages/backend/src/models/entities/sw-subscription.ts index 7c3f6f0a6c..2debcf7443 100644 --- a/packages/backend/src/models/entities/sw-subscription.ts +++ b/packages/backend/src/models/entities/sw-subscription.ts @@ -15,7 +15,7 @@ export class SwSubscription { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/user-group-invitation.ts b/packages/backend/src/models/entities/user-group-invitation.ts index 6fe8f20134..479442a135 100644 --- a/packages/backend/src/models/entities/user-group-invitation.ts +++ b/packages/backend/src/models/entities/user-group-invitation.ts @@ -10,19 +10,19 @@ export class UserGroupInvitation { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the UserGroupInvitation.' + comment: 'The created date of the UserGroupInvitation.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The user ID.' + comment: 'The user ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -30,12 +30,12 @@ export class UserGroupInvitation { @Index() @Column({ ...id(), - comment: 'The group ID.' + comment: 'The group ID.', }) public userGroupId: UserGroup['id']; @ManyToOne(type => UserGroup, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public userGroup: UserGroup | null; diff --git a/packages/backend/src/models/entities/user-group-joining.ts b/packages/backend/src/models/entities/user-group-joining.ts index e09c3230f1..81f3358588 100644 --- a/packages/backend/src/models/entities/user-group-joining.ts +++ b/packages/backend/src/models/entities/user-group-joining.ts @@ -10,19 +10,19 @@ export class UserGroupJoining { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the UserGroupJoining.' + comment: 'The created date of the UserGroupJoining.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The user ID.' + comment: 'The user ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -30,12 +30,12 @@ export class UserGroupJoining { @Index() @Column({ ...id(), - comment: 'The group ID.' + comment: 'The group ID.', }) public userGroupId: UserGroup['id']; @ManyToOne(type => UserGroup, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public userGroup: UserGroup | null; diff --git a/packages/backend/src/models/entities/user-group.ts b/packages/backend/src/models/entities/user-group.ts index f4bac03223..1fdb60c40d 100644 --- a/packages/backend/src/models/entities/user-group.ts +++ b/packages/backend/src/models/entities/user-group.ts @@ -9,7 +9,7 @@ export class UserGroup { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the UserGroup.' + comment: 'The created date of the UserGroup.', }) public createdAt: Date; @@ -21,12 +21,12 @@ export class UserGroup { @Index() @Column({ ...id(), - comment: 'The ID of owner.' + comment: 'The ID of owner.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/user-keypair.ts b/packages/backend/src/models/entities/user-keypair.ts index 603321d758..48bff0d104 100644 --- a/packages/backend/src/models/entities/user-keypair.ts +++ b/packages/backend/src/models/entities/user-keypair.ts @@ -8,7 +8,7 @@ export class UserKeypair { public userId: User['id']; @OneToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/user-list-joining.ts b/packages/backend/src/models/entities/user-list-joining.ts index bb7dc40b95..2efa017527 100644 --- a/packages/backend/src/models/entities/user-list-joining.ts +++ b/packages/backend/src/models/entities/user-list-joining.ts @@ -10,19 +10,19 @@ export class UserListJoining { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the UserListJoining.' + comment: 'The created date of the UserListJoining.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The user ID.' + comment: 'The user ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -30,12 +30,12 @@ export class UserListJoining { @Index() @Column({ ...id(), - comment: 'The list ID.' + comment: 'The list ID.', }) public userListId: UserList['id']; @ManyToOne(type => UserList, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public userList: UserList | null; diff --git a/packages/backend/src/models/entities/user-list.ts b/packages/backend/src/models/entities/user-list.ts index 35a83ef8c3..c2896a1dbe 100644 --- a/packages/backend/src/models/entities/user-list.ts +++ b/packages/backend/src/models/entities/user-list.ts @@ -8,26 +8,26 @@ export class UserList { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the UserList.' + comment: 'The created date of the UserList.', }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.' + comment: 'The owner ID.', }) public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @Column('varchar', { length: 128, - comment: 'The name of the UserList.' + comment: 'The name of the UserList.', }) public name: string; } diff --git a/packages/backend/src/models/entities/user-note-pining.ts b/packages/backend/src/models/entities/user-note-pining.ts index 04a6f8f645..b91e02c5cb 100644 --- a/packages/backend/src/models/entities/user-note-pining.ts +++ b/packages/backend/src/models/entities/user-note-pining.ts @@ -10,7 +10,7 @@ export class UserNotePining { public id: string; @Column('timestamp with time zone', { - comment: 'The created date of the UserNotePinings.' + comment: 'The created date of the UserNotePinings.', }) public createdAt: Date; @@ -19,7 +19,7 @@ export class UserNotePining { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -28,7 +28,7 @@ export class UserNotePining { public noteId: Note['id']; @ManyToOne(type => Note, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/user-profile.ts b/packages/backend/src/models/entities/user-profile.ts index 8a8cacfd52..eb8cdadd19 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -12,26 +12,26 @@ export class UserProfile { public userId: User['id']; @OneToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @Column('varchar', { length: 128, nullable: true, - comment: 'The location of the User.' + comment: 'The location of the User.', }) public location: string | null; @Column('char', { length: 10, nullable: true, - comment: 'The birthday (YYYY-MM-DD) of the User.' + comment: 'The birthday (YYYY-MM-DD) of the User.', }) public birthday: string | null; @Column('varchar', { length: 2048, nullable: true, - comment: 'The description (bio) of the User.' + comment: 'The description (bio) of the User.', }) public description: string | null; @@ -50,13 +50,13 @@ export class UserProfile { @Column('varchar', { length: 512, nullable: true, - comment: 'Remote URL of the user.' + comment: 'Remote URL of the user.', }) public url: string | null; @Column('varchar', { length: 128, nullable: true, - comment: 'The email address of the User.' + comment: 'The email address of the User.', }) public email: string | null; @@ -71,7 +71,7 @@ export class UserProfile { public emailVerified: boolean; @Column('jsonb', { - default: ['follow', 'receiveFollowRequest', 'groupInvited'] + default: ['follow', 'receiveFollowRequest', 'groupInvited'], }) public emailNotificationTypes: string[]; @@ -113,20 +113,20 @@ export class UserProfile { @Column('varchar', { length: 128, nullable: true, - comment: 'The password hash of the User. It will be null if the origin of the user is local.' + comment: 'The password hash of the User. It will be null if the origin of the user is local.', }) public password: string | null; // TODO: そのうち消す @Column('jsonb', { default: {}, - comment: 'The client-specific data of the User.' + comment: 'The client-specific data of the User.', }) public clientData: Record; @Column('jsonb', { default: {}, - comment: 'The room data of the User.' + comment: 'The room data of the User.', }) public room: Record; @@ -137,7 +137,7 @@ export class UserProfile { @Column('boolean', { default: false, - comment: 'Whether reject index by crawler.' + comment: 'Whether reject index by crawler.', }) public noCrawle: boolean; @@ -163,18 +163,18 @@ export class UserProfile { @Column({ ...id(), - nullable: true + nullable: true, }) public pinnedPageId: Page['id'] | null; @OneToOne(type => Page, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public pinnedPage: Page | null; @Column('jsonb', { - default: {} + default: {}, }) public integrations: Record; @@ -185,10 +185,15 @@ export class UserProfile { public enableWordMute: boolean; @Column('jsonb', { - default: [] + default: [], }) public mutedWords: string[][]; + @Column('jsonb', { + default: [], + }) + public mutedInstances: string[]; + @Column('enum', { enum: notificationTypes, array: true, @@ -200,7 +205,7 @@ export class UserProfile { @Index() @Column('varchar', { length: 128, nullable: true, - comment: '[Denormalized]' + comment: '[Denormalized]', }) public userHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/user-publickey.ts b/packages/backend/src/models/entities/user-publickey.ts index 21edc3e9e2..128e13510c 100644 --- a/packages/backend/src/models/entities/user-publickey.ts +++ b/packages/backend/src/models/entities/user-publickey.ts @@ -8,7 +8,7 @@ export class UserPublickey { public userId: User['id']; @OneToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/user-security-key.ts b/packages/backend/src/models/entities/user-security-key.ts index d54c728e53..e7b63fb825 100644 --- a/packages/backend/src/models/entities/user-security-key.ts +++ b/packages/backend/src/models/entities/user-security-key.ts @@ -5,7 +5,7 @@ import { id } from '../id'; @Entity() export class UserSecurityKey { @PrimaryColumn('varchar', { - comment: 'Variable-length id given to navigator.credentials.get()' + comment: 'Variable-length id given to navigator.credentials.get()', }) public id: string; @@ -14,7 +14,7 @@ export class UserSecurityKey { public userId: User['id']; @ManyToOne(type => User, { - onDelete: 'CASCADE' + onDelete: 'CASCADE', }) @JoinColumn() public user: User | null; @@ -22,19 +22,19 @@ export class UserSecurityKey { @Index() @Column('varchar', { comment: - 'Variable-length public key used to verify attestations (hex-encoded).' + 'Variable-length public key used to verify attestations (hex-encoded).', }) public publicKey: string; @Column('timestamp with time zone', { comment: - 'The date of the last time the UserSecurityKey was successfully validated.' + 'The date of the last time the UserSecurityKey was successfully validated.', }) public lastUsed: Date; @Column('varchar', { comment: 'User-defined name for this key', - length: 30 + length: 30, }) public name: string; diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts index 65aebd2d1a..0aa01ba00a 100644 --- a/packages/backend/src/models/entities/user.ts +++ b/packages/backend/src/models/entities/user.ts @@ -10,25 +10,25 @@ export class User { @Index() @Column('timestamp with time zone', { - comment: 'The created date of the User.' + comment: 'The created date of the User.', }) public createdAt: Date; @Index() @Column('timestamp with time zone', { nullable: true, - comment: 'The updated date of the User.' + comment: 'The updated date of the User.', }) public updatedAt: Date | null; @Column('timestamp with time zone', { - nullable: true + nullable: true, }) public lastFetchedAt: Date | null; @Index() @Column('timestamp with time zone', { - nullable: true + nullable: true, }) public lastActiveDate: Date | null; @@ -39,50 +39,50 @@ export class User { @Column('varchar', { length: 128, - comment: 'The username of the User.' + comment: 'The username of the User.', }) public username: string; @Index() @Column('varchar', { length: 128, select: false, - comment: 'The username (lowercased) of the User.' + comment: 'The username (lowercased) of the User.', }) public usernameLower: string; @Column('varchar', { length: 128, nullable: true, - comment: 'The name of the User.' + comment: 'The name of the User.', }) public name: string | null; @Column('integer', { default: 0, - comment: 'The count of followers.' + comment: 'The count of followers.', }) public followersCount: number; @Column('integer', { default: 0, - comment: 'The count of following.' + comment: 'The count of following.', }) public followingCount: number; @Column('integer', { default: 0, - comment: 'The count of notes.' + comment: 'The count of notes.', }) public notesCount: number; @Column({ ...id(), nullable: true, - comment: 'The ID of avatar DriveFile.' + comment: 'The ID of avatar DriveFile.', }) public avatarId: DriveFile['id'] | null; @OneToOne(type => DriveFile, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public avatar: DriveFile | null; @@ -90,19 +90,19 @@ export class User { @Column({ ...id(), nullable: true, - comment: 'The ID of banner DriveFile.' + comment: 'The ID of banner DriveFile.', }) public bannerId: DriveFile['id'] | null; @OneToOne(type => DriveFile, { - onDelete: 'SET NULL' + onDelete: 'SET NULL', }) @JoinColumn() public banner: DriveFile | null; @Index() @Column('varchar', { - length: 128, array: true, default: '{}' + length: 128, array: true, default: '{}', }) public tags: string[]; @@ -128,107 +128,107 @@ export class User { @Column('boolean', { default: false, - comment: 'Whether the User is suspended.' + comment: 'Whether the User is suspended.', }) public isSuspended: boolean; @Column('boolean', { default: false, - comment: 'Whether the User is silenced.' + comment: 'Whether the User is silenced.', }) public isSilenced: boolean; @Column('boolean', { default: false, - comment: 'Whether the User is locked.' + comment: 'Whether the User is locked.', }) public isLocked: boolean; @Column('boolean', { default: false, - comment: 'Whether the User is a bot.' + comment: 'Whether the User is a bot.', }) public isBot: boolean; @Column('boolean', { default: false, - comment: 'Whether the User is a cat.' + comment: 'Whether the User is a cat.', }) public isCat: boolean; @Column('boolean', { default: false, - comment: 'Whether the User is the admin.' + comment: 'Whether the User is the admin.', }) public isAdmin: boolean; @Column('boolean', { default: false, - comment: 'Whether the User is a moderator.' + comment: 'Whether the User is a moderator.', }) public isModerator: boolean; @Index() @Column('boolean', { default: true, - comment: 'Whether the User is explorable.' + comment: 'Whether the User is explorable.', }) public isExplorable: boolean; // アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ @Column('boolean', { default: false, - comment: 'Whether the User is deleted.' + comment: 'Whether the User is deleted.', }) public isDeleted: boolean; @Column('varchar', { - length: 128, array: true, default: '{}' + length: 128, array: true, default: '{}', }) public emojis: string[]; @Index() @Column('varchar', { length: 128, nullable: true, - comment: 'The host of the User. It will be null if the origin of the user is local.' + comment: 'The host of the User. It will be null if the origin of the user is local.', }) public host: string | null; @Column('varchar', { length: 512, nullable: true, - comment: 'The inbox URL of the User. It will be null if the origin of the user is local.' + comment: 'The inbox URL of the User. It will be null if the origin of the user is local.', }) public inbox: string | null; @Column('varchar', { length: 512, nullable: true, - comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.' + comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.', }) public sharedInbox: string | null; @Column('varchar', { length: 512, nullable: true, - comment: 'The featured URL of the User. It will be null if the origin of the user is local.' + comment: 'The featured URL of the User. It will be null if the origin of the user is local.', }) public featured: string | null; @Index() @Column('varchar', { length: 512, nullable: true, - comment: 'The URI of the User. It will be null if the origin of the user is local.' + comment: 'The URI of the User. It will be null if the origin of the user is local.', }) public uri: string | null; @Column('varchar', { length: 512, nullable: true, - comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.' + comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.', }) public followersUri: string | null; @Index({ unique: true }) @Column('char', { length: 16, nullable: true, unique: true, - comment: 'The native access token of the User. It will be null if the origin of the user is local.' + comment: 'The native access token of the User. It will be null if the origin of the user is local.', }) public token: string | null; diff --git a/packages/backend/src/models/id.ts b/packages/backend/src/models/id.ts index cdb8259073..d614fc5048 100644 --- a/packages/backend/src/models/id.ts +++ b/packages/backend/src/models/id.ts @@ -1,4 +1,4 @@ export const id = () => ({ type: 'varchar' as const, - length: 32 + length: 32, }); diff --git a/packages/backend/src/models/repositories/abuse-user-report.ts b/packages/backend/src/models/repositories/abuse-user-report.ts index 039a9924d2..5e267b3c2b 100644 --- a/packages/backend/src/models/repositories/abuse-user-report.ts +++ b/packages/backend/src/models/repositories/abuse-user-report.ts @@ -19,13 +19,13 @@ export class AbuseUserReportRepository extends Repository { targetUserId: report.targetUserId, assigneeId: report.assigneeId, reporter: Users.pack(report.reporter || report.reporterId, null, { - detail: true + detail: true, }), targetUser: Users.pack(report.targetUser || report.targetUserId, null, { - detail: true + detail: true, }), assignee: report.assigneeId ? Users.pack(report.assignee || report.assigneeId, null, { - detail: true + detail: true, }) : null, }); } diff --git a/packages/backend/src/models/repositories/antenna.ts b/packages/backend/src/models/repositories/antenna.ts index 657de55581..548f44f1b7 100644 --- a/packages/backend/src/models/repositories/antenna.ts +++ b/packages/backend/src/models/repositories/antenna.ts @@ -27,7 +27,7 @@ export class AntennaRepository extends Repository { notify: antenna.notify, withReplies: antenna.withReplies, withFile: antenna.withFile, - hasUnreadNote + hasUnreadNote, }; } } @@ -39,16 +39,16 @@ export const packedAntennaSchema = { 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', }, name: { type: 'string' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, keywords: { type: 'array' as const, @@ -58,9 +58,9 @@ export const packedAntennaSchema = { 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, + }, + }, }, excludeKeywords: { type: 'array' as const, @@ -70,55 +70,55 @@ export const packedAntennaSchema = { 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, + }, + }, }, src: { type: 'string' as const, optional: false as const, nullable: false as const, - enum: ['home', 'all', 'users', 'list', 'group'] + enum: ['home', 'all', 'users', 'list', 'group'], }, userListId: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'id' + format: 'id', }, userGroupId: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'id' + format: 'id', }, users: { 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, + }, }, caseSensitive: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, notify: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, withReplies: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false + default: false, }, withFile: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, hasUnreadNote: { type: 'boolean' as const, optional: false as const, nullable: false as const, - default: false - } + default: false, + }, }, }; diff --git a/packages/backend/src/models/repositories/app.ts b/packages/backend/src/models/repositories/app.ts index 0226edad11..bec0765ac2 100644 --- a/packages/backend/src/models/repositories/app.ts +++ b/packages/backend/src/models/repositories/app.ts @@ -18,7 +18,7 @@ export class AppRepository extends Repository { const opts = Object.assign({ detail: false, includeSecret: false, - includeProfileImageIds: false + includeProfileImageIds: false, }, options); const app = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -33,8 +33,8 @@ export class AppRepository extends Repository { isAuthorized: await AccessTokens.count({ appId: app.id, userId: me, - }).then(count => count > 0) - } : {}) + }).then(count => count > 0), + } : {}), }; } } @@ -45,31 +45,31 @@ export const packedAppSchema = { 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: true as const + optional: false as const, nullable: true 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: 'boolean' as const, - optional: true as const, nullable: false as const - } - } + optional: true as const, nullable: false as const, + }, + }, }; diff --git a/packages/backend/src/models/repositories/auth-session.ts b/packages/backend/src/models/repositories/auth-session.ts index c8f4c10f2a..6308909c41 100644 --- a/packages/backend/src/models/repositories/auth-session.ts +++ b/packages/backend/src/models/repositories/auth-session.ts @@ -15,7 +15,7 @@ export class AuthSessionRepository extends Repository { return await awaitAll({ id: session.id, app: Apps.pack(session.appId, me), - token: session.token + token: session.token, }); } } diff --git a/packages/backend/src/models/repositories/blocking.ts b/packages/backend/src/models/repositories/blocking.ts index ac60c9a4ce..a6895eabf4 100644 --- a/packages/backend/src/models/repositories/blocking.ts +++ b/packages/backend/src/models/repositories/blocking.ts @@ -18,8 +18,8 @@ export class BlockingRepository extends Repository { createdAt: blocking.createdAt.toISOString(), blockeeId: blocking.blockeeId, blockee: Users.pack(blocking.blockeeId, me, { - detail: true - }) + detail: true, + }), }); } @@ -56,5 +56,5 @@ export const packedBlockingSchema = { optional: false as const, nullable: false as const, ref: 'User' as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/channel.ts b/packages/backend/src/models/repositories/channel.ts index 5c7d095473..0a6b02f495 100644 --- a/packages/backend/src/models/repositories/channel.ts +++ b/packages/backend/src/models/repositories/channel.ts @@ -36,7 +36,7 @@ export class ChannelRepository extends Repository { ...(me ? { isFollowing: following != null, hasUnreadNote, - } : {}) + } : {}), }; } } diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts index f2f0308dc0..79b890aa6e 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -46,7 +46,7 @@ export class DriveFileRepository extends Repository { if (file.uri != null && file.userHost != null && config.mediaProxy != null) { return appendQuery(config.mediaProxy, query({ url: file.uri, - thumbnail: thumbnail ? '1' : undefined + thumbnail: thumbnail ? '1' : undefined, })); } @@ -118,7 +118,7 @@ export class DriveFileRepository extends Repository { ): Promise | null> { const opts = Object.assign({ detail: false, - self: false + self: false, }, options); const file = typeof src === 'object' ? src : await this.findOne(src); @@ -141,10 +141,10 @@ export class DriveFileRepository extends Repository { comment: file.comment, folderId: file.folderId, folder: opts.detail && file.folderId ? DriveFolders.pack(file.folderId, { - detail: true + detail: true, }) : null, userId: opts.withUser ? file.userId : null, - user: (opts.withUser && file.userId) ? Users.pack(file.userId) : null + user: (opts.withUser && file.userId) ? Users.pack(file.userId) : null, }); } @@ -175,23 +175,23 @@ export const packedDriveFileSchema = { 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', }, md5: { type: 'string' as const, optional: false as const, nullable: false as const, format: 'md5', - example: '15eca7fba0480996e2245f5185bf39f2' + example: '15eca7fba0480996e2245f5185bf39f2', }, size: { type: 'number' as const, optional: false as const, nullable: false as const, - example: 51469 + example: 51469, }, isSensitive: { type: 'boolean' as const, @@ -199,7 +199,7 @@ export const packedDriveFileSchema = { }, 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, @@ -208,24 +208,24 @@ export const packedDriveFileSchema = { width: { type: 'number' as const, optional: true as const, nullable: false as const, - example: 1280 + example: 1280, }, height: { type: 'number' as const, optional: true as const, nullable: false as const, - example: 720 + example: 720, }, orientation: { type: 'number' as const, optional: true as const, nullable: false as const, - example: 8 + example: 8, }, avgColor: { type: 'string' as const, optional: true as const, nullable: false as const, - example: 'rgb(40,65,87)' - } - } + example: 'rgb(40,65,87)', + }, + }, }, url: { type: 'string' as const, @@ -239,7 +239,7 @@ export const packedDriveFileSchema = { }, comment: { 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, @@ -262,6 +262,6 @@ export const packedDriveFileSchema = { type: 'object' as const, optional: true as const, nullable: true as const, ref: 'User' as const, - } + }, }, }; diff --git a/packages/backend/src/models/repositories/drive-folder.ts b/packages/backend/src/models/repositories/drive-folder.ts index 8ef6f01b5d..4ee4a68e08 100644 --- a/packages/backend/src/models/repositories/drive-folder.ts +++ b/packages/backend/src/models/repositories/drive-folder.ts @@ -20,7 +20,7 @@ export class DriveFolderRepository extends Repository { } ): Promise> { const opts = Object.assign({ - detail: false + detail: false, }, options); const folder = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -33,18 +33,18 @@ export class DriveFolderRepository extends Repository { ...(opts.detail ? { foldersCount: DriveFolders.count({ - parentId: folder.id + parentId: folder.id, }), filesCount: DriveFiles.count({ - folderId: folder.id + folderId: folder.id, }), ...(folder.parentId ? { parent: this.pack(folder.parentId, { - detail: true - }) - } : {}) - } : {}) + detail: true, + }), + } : {}), + } : {}), }); } } diff --git a/packages/backend/src/models/repositories/emoji.ts b/packages/backend/src/models/repositories/emoji.ts index 7985c27aba..b7529595a9 100644 --- a/packages/backend/src/models/repositories/emoji.ts +++ b/packages/backend/src/models/repositories/emoji.ts @@ -61,5 +61,5 @@ export const packedEmojiSchema = { type: 'string' as const, optional: false as const, nullable: false as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/federation-instance.ts b/packages/backend/src/models/repositories/federation-instance.ts index 4b70971ecf..90dbbaab1c 100644 --- a/packages/backend/src/models/repositories/federation-instance.ts +++ b/packages/backend/src/models/repositories/federation-instance.ts @@ -7,100 +7,100 @@ export const packedFederationInstanceSchema = { id: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' + format: 'id', }, caughtAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, host: { type: 'string' as const, optional: false as const, nullable: false as const, - example: 'misskey.example.com' + example: 'misskey.example.com', }, usersCount: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, notesCount: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, followingCount: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, followersCount: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, driveUsage: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, driveFiles: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, latestRequestSentAt: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'date-time' + format: 'date-time', }, lastCommunicatedAt: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'date-time' + format: 'date-time', }, isNotResponding: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, isSuspended: { type: 'boolean' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, softwareName: { type: 'string' as const, optional: false as const, nullable: true as const, - example: 'misskey' + example: 'misskey', }, softwareVersion: { type: 'string' as const, optional: false as const, nullable: true as const, - example: config.version + example: config.version, }, openRegistrations: { type: 'boolean' as const, optional: false as const, nullable: true as const, - example: true + example: true, }, name: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, description: { type: 'string' as const, - optional: false as const, nullable: true as const + optional: false as const, nullable: true as const, }, 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, }, iconUrl: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'url' + format: 'url', }, infoUpdatedAt: { type: 'string' as const, optional: false as const, nullable: true as const, - format: 'date-time' - } - } + format: 'date-time', + }, + }, }; diff --git a/packages/backend/src/models/repositories/following.ts b/packages/backend/src/models/repositories/following.ts index b1f716069f..1dfaaf908a 100644 --- a/packages/backend/src/models/repositories/following.ts +++ b/packages/backend/src/models/repositories/following.ts @@ -65,10 +65,10 @@ export class FollowingRepository extends Repository { followeeId: following.followeeId, followerId: following.followerId, followee: opts.populateFollowee ? Users.pack(following.followee || following.followeeId, me, { - detail: true + detail: true, }) : undefined, follower: opts.populateFollower ? Users.pack(following.follower || following.followerId, me, { - detail: true + detail: true, }) : undefined, }); } @@ -120,5 +120,5 @@ export const packedFollowingSchema = { optional: true as const, nullable: false as const, ref: 'User' as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/gallery-post.ts b/packages/backend/src/models/repositories/gallery-post.ts index 4f666ff252..6d37e3120e 100644 --- a/packages/backend/src/models/repositories/gallery-post.ts +++ b/packages/backend/src/models/repositories/gallery-post.ts @@ -83,8 +83,8 @@ export const packedGalleryPostSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' - } + format: 'id', + }, }, files: { type: 'array' as const, @@ -93,7 +93,7 @@ export const packedGalleryPostSchema = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFile' as const, - } + }, }, tags: { type: 'array' as const, @@ -101,11 +101,11 @@ export const packedGalleryPostSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } + }, }, isSensitive: { type: 'boolean' as const, optional: false as const, nullable: false as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/games/reversi/game.ts b/packages/backend/src/models/repositories/games/reversi/game.ts index 9adb386fa9..a9e0496760 100644 --- a/packages/backend/src/models/repositories/games/reversi/game.ts +++ b/packages/backend/src/models/repositories/games/reversi/game.ts @@ -14,7 +14,7 @@ export class ReversiGameRepository extends Repository { } ): Promise> { const opts = Object.assign({ - detail: true + detail: true, }, options); const game = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -45,10 +45,10 @@ export class ReversiGameRepository extends Repository { logs: game.logs.map(log => ({ at: log.at.toISOString(), color: log.color, - pos: log.pos + pos: log.pos, })), map: game.map, - } : {}) + } : {}), }; } } @@ -176,8 +176,8 @@ export const packedReversiGameSchema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } - } + }, + }, }, map: { type: 'array' as const, @@ -185,7 +185,7 @@ export const packedReversiGameSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } - } - } + }, + }, + }, }; diff --git a/packages/backend/src/models/repositories/games/reversi/matching.ts b/packages/backend/src/models/repositories/games/reversi/matching.ts index b4515800df..b55f598068 100644 --- a/packages/backend/src/models/repositories/games/reversi/matching.ts +++ b/packages/backend/src/models/repositories/games/reversi/matching.ts @@ -18,12 +18,12 @@ export class ReversiMatchingRepository extends Repository { createdAt: matching.createdAt.toISOString(), parentId: matching.parentId, parent: Users.pack(matching.parentId, me, { - detail: true + detail: true, }), childId: matching.childId, child: Users.pack(matching.childId, me, { - detail: true - }) + detail: true, + }), }); } } @@ -65,5 +65,5 @@ export const packedReversiMatchingSchema = { optional: false as const, nullable: false as const, ref: 'User' as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/hashtag.ts b/packages/backend/src/models/repositories/hashtag.ts index d52f6ba7c6..6e513c7ebb 100644 --- a/packages/backend/src/models/repositories/hashtag.ts +++ b/packages/backend/src/models/repositories/hashtag.ts @@ -58,5 +58,5 @@ export const packedHashtagSchema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/messaging-message.ts b/packages/backend/src/models/repositories/messaging-message.ts index abdff63689..1b2dd3a246 100644 --- a/packages/backend/src/models/repositories/messaging-message.ts +++ b/packages/backend/src/models/repositories/messaging-message.ts @@ -112,8 +112,8 @@ export const packedMessagingMessageSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' - } + format: 'id', + }, }, }, }; diff --git a/packages/backend/src/models/repositories/moderation-logs.ts b/packages/backend/src/models/repositories/moderation-logs.ts index c7df3afdc9..1585d5bfcf 100644 --- a/packages/backend/src/models/repositories/moderation-logs.ts +++ b/packages/backend/src/models/repositories/moderation-logs.ts @@ -17,7 +17,7 @@ export class ModerationLogRepository extends Repository { info: log.info, userId: log.userId, user: Users.pack(log.user || log.userId, null, { - detail: true + detail: true, }), }); } diff --git a/packages/backend/src/models/repositories/muting.ts b/packages/backend/src/models/repositories/muting.ts index 869afd3c4e..b82d1f0daa 100644 --- a/packages/backend/src/models/repositories/muting.ts +++ b/packages/backend/src/models/repositories/muting.ts @@ -18,8 +18,8 @@ export class MutingRepository extends Repository { createdAt: muting.createdAt.toISOString(), muteeId: muting.muteeId, mutee: Users.pack(muting.muteeId, me, { - detail: true - }) + detail: true, + }), }); } @@ -56,5 +56,5 @@ export const packedMutingSchema = { optional: false as const, nullable: false as const, ref: 'User' as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/note-reaction.ts b/packages/backend/src/models/repositories/note-reaction.ts index 5d86065526..dfb25cbea1 100644 --- a/packages/backend/src/models/repositories/note-reaction.ts +++ b/packages/backend/src/models/repositories/note-reaction.ts @@ -27,7 +27,7 @@ export class NoteReactionRepository extends Repository { type: convertLegacyReaction(reaction.reaction), ...(opts.withNote ? { note: await Notes.pack(reaction.noteId, me), - } : {}) + } : {}), }; } } diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index c076cb31e8..96dfad70e9 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -51,7 +51,7 @@ export class NoteRepository extends Repository { // フォロワーかどうか const following = await Followings.findOne({ followeeId: note.userId, - followerId: meId + followerId: meId, }); if (following == null) { @@ -103,7 +103,7 @@ export class NoteRepository extends Repository { // フォロワーかどうか const following = await Followings.findOne({ followeeId: packedNote.userId, - followerId: meId + followerId: meId, }); if (following == null) { @@ -138,7 +138,7 @@ export class NoteRepository extends Repository { ): Promise> { const opts = Object.assign({ detail: true, - skipHide: false + skipHide: false, }, options); const meId = me ? me.id : null; @@ -150,13 +150,13 @@ export class NoteRepository extends Repository { const choices = poll.choices.map(c => ({ text: c, votes: poll.votes[poll.choices.indexOf(c)], - isVoted: false + isVoted: false, })); if (poll.multiple) { const votes = await PollVotes.find({ userId: meId!, - noteId: note.id + noteId: note.id, }); const myChoices = votes.map(v => v.choice); @@ -166,7 +166,7 @@ export class NoteRepository extends Repository { } else { const vote = await PollVotes.findOne({ userId: meId!, - noteId: note.id + noteId: note.id, }); if (vote) { @@ -177,7 +177,7 @@ export class NoteRepository extends Repository { return { multiple: poll.multiple, expiresAt: poll.expiresAt, - choices + choices, }; } @@ -251,20 +251,20 @@ export class NoteRepository extends Repository { ...(opts.detail ? { reply: note.replyId ? this.pack(note.reply || note.replyId, me, { detail: false, - _hint_: options?._hint_ + _hint_: options?._hint_, }) : undefined, renote: note.renoteId ? this.pack(note.renote || note.renoteId, me, { detail: true, - _hint_: options?._hint_ + _hint_: options?._hint_, }) : undefined, poll: note.hasPoll ? populatePoll() : undefined, ...(meId ? { - myReaction: populateMyReaction() - } : {}) - } : {}) + myReaction: populateMyReaction(), + } : {}), + } : {}), }); if (packed.user.isCat && packed.text) { @@ -315,8 +315,8 @@ export class NoteRepository extends Repository { return await Promise.all(notes.map(n => this.pack(n, me, { ...options, _hint_: { - myReactions: myReactionsMap - } + myReactions: myReactionsMap, + }, }))); } } @@ -390,8 +390,8 @@ export const packedNoteSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' - } + format: 'id', + }, }, visibleUserIds: { type: 'array' as const, @@ -399,8 +399,8 @@ export const packedNoteSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' - } + format: 'id', + }, }, fileIds: { type: 'array' as const, @@ -408,8 +408,8 @@ export const packedNoteSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - format: 'id' - } + format: 'id', + }, }, files: { type: 'array' as const, @@ -418,7 +418,7 @@ export const packedNoteSchema = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'DriveFile' as const, - } + }, }, tags: { type: 'array' as const, @@ -426,7 +426,7 @@ export const packedNoteSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } + }, }, poll: { type: 'object' as const, diff --git a/packages/backend/src/models/repositories/notification.ts b/packages/backend/src/models/repositories/notification.ts index d1cf9b087e..47d569ed21 100644 --- a/packages/backend/src/models/repositories/notification.ts +++ b/packages/backend/src/models/repositories/notification.ts @@ -32,40 +32,40 @@ export class NotificationRepository extends Repository { ...(notification.type === 'mention' ? { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, - _hint_: options._hintForEachNotes_ + _hint_: options._hintForEachNotes_, }), } : {}), ...(notification.type === 'reply' ? { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, - _hint_: options._hintForEachNotes_ + _hint_: options._hintForEachNotes_, }), } : {}), ...(notification.type === 'renote' ? { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, - _hint_: options._hintForEachNotes_ + _hint_: options._hintForEachNotes_, }), } : {}), ...(notification.type === 'quote' ? { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, - _hint_: options._hintForEachNotes_ + _hint_: options._hintForEachNotes_, }), } : {}), ...(notification.type === 'reaction' ? { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, - _hint_: options._hintForEachNotes_ + _hint_: options._hintForEachNotes_, }), - reaction: notification.reaction + reaction: notification.reaction, } : {}), ...(notification.type === 'pollVote' ? { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { detail: true, - _hint_: options._hintForEachNotes_ + _hint_: options._hintForEachNotes_, }), - choice: notification.choice + choice: notification.choice, } : {}), ...(notification.type === 'groupInvited' ? { invitation: UserGroupInvitations.pack(notification.userGroupInvitationId!), @@ -102,8 +102,8 @@ export class NotificationRepository extends Repository { return await Promise.all(notifications.map(x => this.pack(x, { _hintForEachNotes_: { - myReactions: myReactionsMap - } + myReactions: myReactionsMap, + }, }))); } } @@ -171,5 +171,5 @@ export const packedNotificationSchema = { type: 'string' as const, optional: true as const, nullable: true as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/page.ts b/packages/backend/src/models/repositories/page.ts index 3a3642d7ec..46b453cad9 100644 --- a/packages/backend/src/models/repositories/page.ts +++ b/packages/backend/src/models/repositories/page.ts @@ -21,7 +21,7 @@ export class PageRepository extends Repository { if (x.type === 'image') { attachedFiles.push(DriveFiles.findOne({ id: x.fileId, - userId: page.userId + userId: page.userId, })); } if (x.children) { @@ -53,7 +53,7 @@ export class PageRepository extends Repository { migrate(page.content); if (migrated) { this.update(page.id, { - content: page.content + content: page.content, }); } @@ -138,5 +138,5 @@ export const packedPageSchema = { ref: 'User' as const, optional: false as const, nullable: false as const, }, - } + }, }; diff --git a/packages/backend/src/models/repositories/queue.ts b/packages/backend/src/models/repositories/queue.ts index 161751ddc8..521c634390 100644 --- a/packages/backend/src/models/repositories/queue.ts +++ b/packages/backend/src/models/repositories/queue.ts @@ -4,27 +4,27 @@ export const packedQueueCountSchema = { properties: { waiting: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, active: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, completed: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, failed: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, delayed: { type: 'number' as const, - optional: false as const, nullable: false as const + optional: false as const, nullable: false as const, }, paused: { type: 'number' as const, - optional: false as const, nullable: false as const - } - } + optional: false as const, nullable: false as const, + }, + }, }; diff --git a/packages/backend/src/models/repositories/user-group.ts b/packages/backend/src/models/repositories/user-group.ts index b38a2fb50d..02a0348885 100644 --- a/packages/backend/src/models/repositories/user-group.ts +++ b/packages/backend/src/models/repositories/user-group.ts @@ -11,7 +11,7 @@ export class UserGroupRepository extends Repository { const userGroup = typeof src === 'object' ? src : await this.findOneOrFail(src); const users = await UserGroupJoinings.find({ - userGroupId: userGroup.id + userGroupId: userGroup.id, }); return { @@ -19,7 +19,7 @@ export class UserGroupRepository extends Repository { createdAt: userGroup.createdAt.toISOString(), name: userGroup.name, ownerId: userGroup.userId, - userIds: users.map(x => x.userId) + userIds: users.map(x => x.userId), }; } } @@ -55,7 +55,7 @@ export const packedUserGroupSchema = { type: 'string' as const, nullable: false as const, optional: false as const, format: 'id', - } + }, }, }, }; diff --git a/packages/backend/src/models/repositories/user-list.ts b/packages/backend/src/models/repositories/user-list.ts index 331c278e6f..792a17cb49 100644 --- a/packages/backend/src/models/repositories/user-list.ts +++ b/packages/backend/src/models/repositories/user-list.ts @@ -11,14 +11,14 @@ export class UserListRepository extends Repository { const userList = typeof src === 'object' ? src : await this.findOneOrFail(src); const users = await UserListJoinings.find({ - userListId: userList.id + userListId: userList.id, }); return { id: userList.id, createdAt: userList.createdAt.toISOString(), name: userList.name, - userIds: users.map(x => x.userId) + userIds: users.map(x => x.userId), }; } } @@ -49,7 +49,7 @@ export const packedUserListSchema = { type: 'string' as const, nullable: false as const, optional: false as const, format: 'id', - } + }, }, }, }; diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 81468d6de2..3dc7c67ec2 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -15,32 +15,32 @@ export class UserRepository extends Repository { const [following1, following2, followReq1, followReq2, toBlocking, fromBlocked, mute] = await Promise.all([ Followings.findOne({ followerId: me, - followeeId: target + followeeId: target, }), Followings.findOne({ followerId: target, - followeeId: me + followeeId: me, }), FollowRequests.findOne({ followerId: me, - followeeId: target + followeeId: target, }), FollowRequests.findOne({ followerId: target, - followeeId: me + followeeId: me, }), Blockings.findOne({ blockerId: me, - blockeeId: target + blockeeId: target, }), Blockings.findOne({ blockerId: target, - blockeeId: me + blockeeId: me, }), Mutings.findOne({ muterId: me, - muteeId: target - }) + muteeId: target, + }), ]); return { @@ -51,13 +51,13 @@ export class UserRepository extends Repository { isFollowed: following2 != null, isBlocking: toBlocking != null, isBlocked: fromBlocked != null, - isMuted: mute != null + isMuted: mute != null, }; } public async getHasUnreadMessagingMessage(userId: User['id']): Promise { const mute = await Mutings.find({ - muterId: userId + muterId: userId, }); const joinings = await UserGroupJoinings.find({ userId: userId }); @@ -76,9 +76,9 @@ export class UserRepository extends Repository { isRead: false, ...(mute.length > 0 ? { userId: Not(In(mute.map(x => x.muteeId))) } : {}), }, - take: 1 + take: 1, }).then(count => count > 0), - groupQs + groupQs, ]); return withUser || withGroups.some(x => x); @@ -86,11 +86,11 @@ export class UserRepository extends Repository { public async getHasUnreadAnnouncement(userId: User['id']): Promise { const reads = await AnnouncementReads.find({ - userId: userId + userId: userId, }); const count = await Announcements.count(reads.length > 0 ? { - id: Not(In(reads.map(read => read.announcementId))) + id: Not(In(reads.map(read => read.announcementId))), } : {}); return count > 0; @@ -101,7 +101,7 @@ export class UserRepository extends Repository { const unread = myAntennas.length > 0 ? await AntennaNotes.findOne({ antennaId: In(myAntennas.map(x => x.id)), - read: false + read: false, }) : null; return unread != null; @@ -120,7 +120,7 @@ export class UserRepository extends Repository { public async getHasUnreadNotification(userId: User['id']): Promise { const mute = await Mutings.find({ - muterId: userId + muterId: userId, }); const mutedUserIds = mute.map(m => m.muteeId); @@ -128,9 +128,9 @@ export class UserRepository extends Repository { where: { notifieeId: userId, ...(mutedUserIds.length > 0 ? { notifierId: Not(In(mutedUserIds)) } : {}), - isRead: false + isRead: false, }, - take: 1 + take: 1, }); return count > 0; @@ -138,7 +138,7 @@ export class UserRepository extends Repository { public async getHasPendingReceivedFollowRequest(userId: User['id']): Promise { const count = await FollowRequests.count({ - followeeId: userId + followeeId: userId, }); return count > 0; @@ -173,7 +173,7 @@ export class UserRepository extends Repository { ): Promise> { const opts = Object.assign({ detail: false, - includeSecrets: false + includeSecrets: false, }, options); const user = typeof src === 'object' ? src : await this.findOneOrFail(src); @@ -245,7 +245,7 @@ export class UserRepository extends Repository { notesCount: user.notesCount, pinnedNoteIds: pins.map(pin => pin.noteId), pinnedNotes: Notes.packMany(pins.map(pin => pin.note!), me, { - detail: true + detail: true, }), pinnedPageId: profile!.pinnedPageId, pinnedPage: profile!.pinnedPageId ? Pages.pack(profile!.pinnedPageId, me) : null, @@ -255,7 +255,7 @@ export class UserRepository extends Repository { usePasswordLessLogin: profile!.usePasswordLessLogin, securityKeys: profile!.twoFactorEnabled ? UserSecurityKeys.count({ - userId: user.id + userId: user.id, }).then(result => result >= 1) : false, } : {}), @@ -274,11 +274,11 @@ export class UserRepository extends Repository { hideOnlineStatus: user.hideOnlineStatus, hasUnreadSpecifiedNotes: NoteUnreads.count({ where: { userId: user.id, isSpecified: true }, - take: 1 + take: 1, }).then(count => count > 0), hasUnreadMentions: NoteUnreads.count({ where: { userId: user.id, isMentioned: true }, - take: 1 + take: 1, }).then(count => count > 0), hasUnreadAnnouncement: this.getHasUnreadAnnouncement(user.id), hasUnreadAntenna: this.getHasUnreadAntenna(user.id), @@ -288,6 +288,7 @@ export class UserRepository extends Repository { hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id), integrations: profile!.integrations, mutedWords: profile!.mutedWords, + mutedInstances: profile!.mutedInstances, mutingNotificationTypes: profile!.mutingNotificationTypes, emailNotificationTypes: profile!.emailNotificationTypes, } : {}), @@ -298,11 +299,11 @@ export class UserRepository extends Repository { securityKeysList: profile!.twoFactorEnabled ? UserSecurityKeys.find({ where: { - userId: user.id + userId: user.id, }, - select: ['id', 'name', 'lastUsed'] + select: ['id', 'name', 'lastUsed'], }) - : [] + : [], } : {}), ...(relation ? { @@ -313,7 +314,7 @@ export class UserRepository extends Repository { isBlocking: relation.isBlocking, isBlocked: relation.isBlocked, isMuted: relation.isMuted, - } : {}) + } : {}), }; return await awaitAll(packed); @@ -365,17 +366,17 @@ export const packedUserSchema = { name: { type: 'string' as const, nullable: true as const, optional: false as const, - example: '藍' + example: '藍', }, username: { type: 'string' as const, nullable: false as const, optional: false as const, - example: 'ai' + example: 'ai', }, host: { type: 'string' as const, nullable: true as const, optional: false as const, - example: 'misskey.example.com' + example: 'misskey.example.com', }, avatarUrl: { type: 'string' as const, @@ -389,17 +390,17 @@ export const packedUserSchema = { avatarColor: { type: 'any' as const, nullable: true as const, optional: false as const, - default: null + default: null, }, isAdmin: { type: 'boolean' as const, nullable: false as const, optional: true as const, - default: false + default: false, }, isModerator: { type: 'boolean' as const, nullable: false as const, optional: true as const, - default: false + default: false, }, isBot: { type: 'boolean' as const, @@ -418,15 +419,15 @@ export const packedUserSchema = { properties: { name: { type: 'string' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, url: { type: 'string' as const, nullable: false as const, optional: false as const, - format: 'url' + format: 'url', }, - } - } + }, + }, }, url: { type: 'string' as const, @@ -455,7 +456,7 @@ export const packedUserSchema = { bannerColor: { type: 'any' as const, nullable: true as const, optional: true as const, - default: null + default: null, }, isLocked: { type: 'boolean' as const, @@ -464,12 +465,12 @@ export const packedUserSchema = { isSuspended: { type: 'boolean' as const, nullable: false as const, optional: true as const, - example: false + example: false, }, description: { type: 'string' as const, nullable: true as const, optional: true as const, - example: 'Hi masters, I am Ai!' + example: 'Hi masters, I am Ai!', }, location: { type: 'string' as const, @@ -478,7 +479,7 @@ export const packedUserSchema = { birthday: { type: 'string' as const, nullable: true as const, optional: true as const, - example: '2018-03-12' + example: '2018-03-12', }, fields: { type: 'array' as const, @@ -489,15 +490,15 @@ export const packedUserSchema = { properties: { name: { type: 'string' as const, - nullable: false as const, optional: false as const + nullable: false as const, optional: false as const, }, value: { type: 'string' as const, - nullable: false as const, optional: false as const - } + nullable: false as const, optional: false as const, + }, }, - maxLength: 4 - } + maxLength: 4, + }, }, followersCount: { type: 'number' as const, @@ -518,7 +519,7 @@ export const packedUserSchema = { type: 'string' as const, nullable: false as const, optional: false as const, format: 'id', - } + }, }, pinnedNotes: { type: 'array' as const, @@ -527,11 +528,11 @@ export const packedUserSchema = { type: 'object' as const, nullable: false as const, optional: false as const, ref: 'Note' as const, - } + }, }, pinnedPageId: { type: 'string' as const, - nullable: true as const, optional: true as const + nullable: true as const, optional: true as const, }, pinnedPage: { type: 'object' as const, @@ -541,47 +542,47 @@ export const packedUserSchema = { twoFactorEnabled: { type: 'boolean' as const, nullable: false as const, optional: true as const, - default: false + default: false, }, usePasswordLessLogin: { type: 'boolean' as const, nullable: false as const, optional: true as const, - default: false + default: false, }, securityKeys: { type: 'boolean' as const, nullable: false as const, optional: true as const, - default: false + default: false, }, avatarId: { type: 'string' as const, nullable: true as const, optional: true as const, - format: 'id' + format: 'id', }, bannerId: { type: 'string' as const, nullable: true as const, optional: true as const, - format: 'id' + format: 'id', }, autoWatch: { type: 'boolean' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, injectFeaturedNote: { type: 'boolean' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, alwaysMarkNsfw: { type: 'boolean' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, carefulBot: { type: 'boolean' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, autoAcceptFollowed: { type: 'boolean' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, hasUnreadSpecifiedNotes: { type: 'boolean' as const, @@ -617,43 +618,47 @@ export const packedUserSchema = { }, integrations: { type: 'object' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, mutedWords: { type: 'array' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, + }, + mutedInstances: { + type: 'array' as const, + nullable: false as const, optional: true as const, }, mutingNotificationTypes: { type: 'array' as const, - nullable: false as const, optional: true as const + nullable: false as const, optional: true as const, }, isFollowing: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, hasPendingFollowRequestFromYou: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, hasPendingFollowRequestToYou: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, isFollowed: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, isBlocking: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, isBlocked: { type: 'boolean' as const, - optional: true as const, nullable: false as const + optional: true as const, nullable: false as const, }, isMuted: { type: 'boolean' as const, - optional: true as const, nullable: false as const - } + optional: true as const, nullable: false as const, + }, }, }; diff --git a/packages/backend/src/prelude/maybe.ts b/packages/backend/src/prelude/maybe.ts index 0b4b543ca5..df7c4ed52a 100644 --- a/packages/backend/src/prelude/maybe.ts +++ b/packages/backend/src/prelude/maybe.ts @@ -9,7 +9,7 @@ export interface IJust extends IMaybe { export function just(value: T): IJust { return { isJust: () => true, - get: () => value + get: () => value, }; } diff --git a/packages/backend/src/prelude/xml.ts b/packages/backend/src/prelude/xml.ts index 0773f75d47..b4469a1d8d 100644 --- a/packages/backend/src/prelude/xml.ts +++ b/packages/backend/src/prelude/xml.ts @@ -3,7 +3,7 @@ const map: Record = { '<': '<', '>': '>', '"': '"', - '\'': ''' + '\'': ''', }; const beginingOfCDATA = '(name: string, limitPerSec = -1) { prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue', limiter: limitPerSec > 0 ? { max: limitPerSec, - duration: 1000 + duration: 1000, } : undefined, settings: { backoffStrategies: { - apBackoff - } - } + apBackoff, + }, + }, }); } diff --git a/packages/backend/src/queue/processors/db/delete-account.ts b/packages/backend/src/queue/processors/db/delete-account.ts index e54f38e35e..4b620842a4 100644 --- a/packages/backend/src/queue/processors/db/delete-account.ts +++ b/packages/backend/src/queue/processors/db/delete-account.ts @@ -25,12 +25,12 @@ export async function deleteAccount(job: Bull.Job): Promise const notes = await Notes.find({ where: { userId: user.id, - ...(cursor ? { id: MoreThan(cursor) } : {}) + ...(cursor ? { id: MoreThan(cursor) } : {}), }, take: 100, order: { - id: 1 - } + id: 1, + }, }); if (notes.length === 0) { @@ -52,12 +52,12 @@ export async function deleteAccount(job: Bull.Job): Promise const files = await DriveFiles.find({ where: { userId: user.id, - ...(cursor ? { id: MoreThan(cursor) } : {}) + ...(cursor ? { id: MoreThan(cursor) } : {}), }, take: 10, order: { - id: 1 - } + id: 1, + }, }); if (files.length === 0) { diff --git a/packages/backend/src/queue/processors/db/delete-drive-files.ts b/packages/backend/src/queue/processors/db/delete-drive-files.ts index 8a28468b0d..d26f5a47c4 100644 --- a/packages/backend/src/queue/processors/db/delete-drive-files.ts +++ b/packages/backend/src/queue/processors/db/delete-drive-files.ts @@ -24,12 +24,12 @@ export async function deleteDriveFiles(job: Bull.Job, done: any): const files = await DriveFiles.find({ where: { userId: user.id, - ...(cursor ? { id: MoreThan(cursor) } : {}) + ...(cursor ? { id: MoreThan(cursor) } : {}), }, take: 100, order: { - id: 1 - } + id: 1, + }, }); if (files.length === 0) { diff --git a/packages/backend/src/queue/processors/db/export-blocking.ts b/packages/backend/src/queue/processors/db/export-blocking.ts index 8b8aa259d4..8c886d3b4e 100644 --- a/packages/backend/src/queue/processors/db/export-blocking.ts +++ b/packages/backend/src/queue/processors/db/export-blocking.ts @@ -40,12 +40,12 @@ export async function exportBlocking(job: Bull.Job, done: any): P const blockings = await Blockings.find({ where: { blockerId: user.id, - ...(cursor ? { id: MoreThan(cursor) } : {}) + ...(cursor ? { id: MoreThan(cursor) } : {}), }, take: 100, order: { - id: 1 - } + id: 1, + }, }); if (blockings.length === 0) { diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts new file mode 100644 index 0000000000..ed0ad249a5 --- /dev/null +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -0,0 +1,131 @@ +import * as Bull from 'bull'; +import * as tmp from 'tmp'; +import * as fs from 'fs'; + +import { ulid } from 'ulid'; +const mime = require('mime-types'); +const archiver = require('archiver'); +import { queueLogger } from '../../logger'; +import addFile from '@/services/drive/add-file'; +import * as dateFormat from 'dateformat'; +import { Users, Emojis } from '@/models/index'; +import { } from '@/queue/types'; +import { downloadUrl } from '@/misc/download-url'; + +const logger = queueLogger.createSubLogger('export-custom-emojis'); + +export async function exportCustomEmojis(job: Bull.Job, done: () => void): Promise { + logger.info(`Exporting custom emojis ...`); + + const user = await Users.findOne(job.data.user.id); + if (user == null) { + done(); + return; + } + + // Create temp dir + const [path, cleanup] = await new Promise<[string, () => void]>((res, rej) => { + tmp.dir((e, path, cleanup) => { + if (e) return rej(e); + res([path, cleanup]); + }); + }); + + logger.info(`Temp dir is ${path}`); + + const metaPath = path + '/meta.json'; + + fs.writeFileSync(metaPath, '', 'utf-8'); + + const metaStream = fs.createWriteStream(metaPath, { flags: 'a' }); + + await new Promise((res, rej) => { + metaStream.write('[', err => { + if (err) { + logger.error(err); + rej(err); + } else { + res(); + } + }); + }); + + const customEmojis = await Emojis.find({ + where: { + host: null, + }, + order: { + id: 'ASC', + }, + }); + + for (const emoji of customEmojis) { + const exportId = ulid().toLowerCase(); + const emojiPath = path + '/' + exportId + '.' + mime.extension(emoji.type); + fs.writeFileSync(emojiPath, '', 'binary'); + let downloaded = false; + + try { + await downloadUrl(emoji.url, emojiPath); + downloaded = true; + } catch (e) { // TODO: 何度か再試行 + logger.error(e); + } + + await new Promise((res, rej) => { + const content = JSON.stringify({ + id: exportId, + downloaded: downloaded, + emoji: emoji, + }); + const isFirst = customEmojis.indexOf(emoji) === 0; + metaStream.write(isFirst ? content : ',\n' + content, err => { + if (err) { + logger.error(err); + rej(err); + } else { + res(); + } + }); + }); + } + + await new Promise((res, rej) => { + metaStream.write(']', err => { + if (err) { + logger.error(err); + rej(err); + } else { + res(); + } + }); + }); + + metaStream.end(); + + // Create archive + const [archivePath, archiveCleanup] = await new Promise<[string, () => void]>((res, rej) => { + tmp.file((e, path, fd, cleanup) => { + if (e) return rej(e); + res([path, cleanup]); + }); + }); + const archiveStream = fs.createWriteStream(archivePath); + const archive = archiver('zip', { + zlib: { level: 0 }, + }); + archiveStream.on('close', async () => { + logger.succ(`Exported to: ${archivePath}`); + + const fileName = 'custom-emojis-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.zip'; + const driveFile = await addFile(user, archivePath, fileName, null, null, true); + + logger.succ(`Exported to: ${driveFile.id}`); + cleanup(); + archiveCleanup(); + done(); + }); + archive.pipe(archiveStream); + archive.directory(path, false); + archive.finalize(); +} diff --git a/packages/backend/src/queue/processors/db/export-following.ts b/packages/backend/src/queue/processors/db/export-following.ts index a0ecf5f560..fbb9e25247 100644 --- a/packages/backend/src/queue/processors/db/export-following.ts +++ b/packages/backend/src/queue/processors/db/export-following.ts @@ -6,13 +6,14 @@ import { queueLogger } from '../../logger'; import addFile from '@/services/drive/add-file'; import * as dateFormat from 'dateformat'; import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Followings } from '@/models/index'; -import { MoreThan } from 'typeorm'; +import { Users, Followings, Mutings } from '@/models/index'; +import { In, MoreThan, Not } from 'typeorm'; import { DbUserJobData } from '@/queue/types'; +import { Following } from '@/models/entities/following'; const logger = queueLogger.createSubLogger('export-following'); -export async function exportFollowing(job: Bull.Job, done: any): Promise { +export async function exportFollowing(job: Bull.Job, done: () => void): Promise { logger.info(`Exporting following of ${job.data.user.id} ...`); const user = await Users.findOne(job.data.user.id); @@ -22,7 +23,7 @@ export async function exportFollowing(job: Bull.Job, done: any): } // Create temp file - const [path, cleanup] = await new Promise<[string, any]>((res, rej) => { + const [path, cleanup] = await new Promise<[string, () => void]>((res, rej) => { tmp.file((e, path, fd, cleanup) => { if (e) return rej(e); res([path, cleanup]); @@ -33,23 +34,26 @@ export async function exportFollowing(job: Bull.Job, done: any): const stream = fs.createWriteStream(path, { flags: 'a' }); - let exportedCount = 0; - let cursor: any = null; + let cursor: Following['id'] | null = null; + + const mutings = job.data.excludeMuting ? await Mutings.find({ + muterId: user.id, + }) : []; while (true) { const followings = await Followings.find({ where: { followerId: user.id, - ...(cursor ? { id: MoreThan(cursor) } : {}) + ...(mutings.length > 0 ? { followeeId: Not(In(mutings.map(x => x.muteeId))) } : {}), + ...(cursor ? { id: MoreThan(cursor) } : {}), }, take: 100, order: { - id: 1 - } + id: 1, + }, }); if (followings.length === 0) { - job.progress(100); break; } @@ -58,7 +62,11 @@ export async function exportFollowing(job: Bull.Job, done: any): for (const following of followings) { const u = await Users.findOne({ id: following.followeeId }); if (u == null) { - exportedCount++; continue; + continue; + } + + if (job.data.excludeInactive && u.updatedAt && (Date.now() - u.updatedAt.getTime() > 1000 * 60 * 60 * 24 * 90)) { + continue; } const content = getFullApAccount(u.username, u.host); @@ -72,14 +80,7 @@ export async function exportFollowing(job: Bull.Job, done: any): } }); }); - exportedCount++; } - - const total = await Followings.count({ - followerId: user.id, - }); - - job.progress(exportedCount / total); } stream.end(); diff --git a/packages/backend/src/queue/processors/db/export-mute.ts b/packages/backend/src/queue/processors/db/export-mute.ts index d5976f7d56..0b1fd24fe0 100644 --- a/packages/backend/src/queue/processors/db/export-mute.ts +++ b/packages/backend/src/queue/processors/db/export-mute.ts @@ -40,12 +40,12 @@ export async function exportMute(job: Bull.Job, done: any): Promi const mutes = await Mutings.find({ where: { muterId: user.id, - ...(cursor ? { id: MoreThan(cursor) } : {}) + ...(cursor ? { id: MoreThan(cursor) } : {}), }, take: 100, order: { - id: 1 - } + id: 1, + }, }); if (mutes.length === 0) { diff --git a/packages/backend/src/queue/processors/db/export-notes.ts b/packages/backend/src/queue/processors/db/export-notes.ts index 761f4d827b..7220455edc 100644 --- a/packages/backend/src/queue/processors/db/export-notes.ts +++ b/packages/backend/src/queue/processors/db/export-notes.ts @@ -74,7 +74,8 @@ export async function exportNotes(job: Bull.Job, done: any): Prom } const content = JSON.stringify(serialize(note, poll)); await new Promise((res, rej) => { - stream.write(exportedNotesCount === 0 ? content : ',\n' + content, err => { + const isFirst = exportedNotesCount === 0; + stream.write(isFirst ? content : ',\n' + content, err => { if (err) { logger.error(err); rej(err); diff --git a/packages/backend/src/queue/processors/db/export-user-lists.ts b/packages/backend/src/queue/processors/db/export-user-lists.ts index 8a86c4df5d..44a8f9f671 100644 --- a/packages/backend/src/queue/processors/db/export-user-lists.ts +++ b/packages/backend/src/queue/processors/db/export-user-lists.ts @@ -22,7 +22,7 @@ export async function exportUserLists(job: Bull.Job, done: any): } const lists = await UserLists.find({ - userId: user.id + userId: user.id, }); // Create temp file @@ -40,7 +40,7 @@ export async function exportUserLists(job: Bull.Job, done: any): for (const list of lists) { const joinings = await UserListJoinings.find({ userListId: list.id }); const users = await Users.find({ - id: In(joinings.map(j => j.userId)) + id: In(joinings.map(j => j.userId)), }); for (const u of users) { diff --git a/packages/backend/src/queue/processors/db/import-blocking.ts b/packages/backend/src/queue/processors/db/import-blocking.ts index 2e77107034..42c3cd0a40 100644 --- a/packages/backend/src/queue/processors/db/import-blocking.ts +++ b/packages/backend/src/queue/processors/db/import-blocking.ts @@ -21,7 +21,7 @@ export async function importBlocking(job: Bull.Job, done: a } const file = await DriveFiles.findOne({ - id: job.data.fileId + id: job.data.fileId, }); if (file == null) { done(); @@ -41,10 +41,10 @@ export async function importBlocking(job: Bull.Job, done: a let target = isSelfHost(host!) ? await Users.findOne({ host: null, - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }) : await Users.findOne({ host: toPuny(host!), - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }); if (host == null && target == null) continue; diff --git a/packages/backend/src/queue/processors/db/import-following.ts b/packages/backend/src/queue/processors/db/import-following.ts index 2bd079e4bc..f19296832e 100644 --- a/packages/backend/src/queue/processors/db/import-following.ts +++ b/packages/backend/src/queue/processors/db/import-following.ts @@ -21,7 +21,7 @@ export async function importFollowing(job: Bull.Job, done: } const file = await DriveFiles.findOne({ - id: job.data.fileId + id: job.data.fileId, }); if (file == null) { done(); @@ -41,10 +41,10 @@ export async function importFollowing(job: Bull.Job, done: let target = isSelfHost(host!) ? await Users.findOne({ host: null, - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }) : await Users.findOne({ host: toPuny(host!), - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }); if (host == null && target == null) continue; diff --git a/packages/backend/src/queue/processors/db/import-muting.ts b/packages/backend/src/queue/processors/db/import-muting.ts index 8060980625..189740c292 100644 --- a/packages/backend/src/queue/processors/db/import-muting.ts +++ b/packages/backend/src/queue/processors/db/import-muting.ts @@ -22,7 +22,7 @@ export async function importMuting(job: Bull.Job, done: any } const file = await DriveFiles.findOne({ - id: job.data.fileId + id: job.data.fileId, }); if (file == null) { done(); @@ -42,10 +42,10 @@ export async function importMuting(job: Bull.Job, done: any let target = isSelfHost(host!) ? await Users.findOne({ host: null, - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }) : await Users.findOne({ host: toPuny(host!), - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }); if (host == null && target == null) continue; diff --git a/packages/backend/src/queue/processors/db/import-user-lists.ts b/packages/backend/src/queue/processors/db/import-user-lists.ts index 46b728b387..8245010de0 100644 --- a/packages/backend/src/queue/processors/db/import-user-lists.ts +++ b/packages/backend/src/queue/processors/db/import-user-lists.ts @@ -22,7 +22,7 @@ export async function importUserLists(job: Bull.Job, done: } const file = await DriveFiles.findOne({ - id: job.data.fileId + id: job.data.fileId, }); if (file == null) { done(); @@ -42,7 +42,7 @@ export async function importUserLists(job: Bull.Job, done: let list = await UserLists.findOne({ userId: user.id, - name: listName + name: listName, }); if (list == null) { @@ -51,16 +51,16 @@ export async function importUserLists(job: Bull.Job, done: createdAt: new Date(), userId: user.id, name: listName, - userIds: [] + userIds: [], }); } let target = isSelfHost(host!) ? await Users.findOne({ host: null, - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }) : await Users.findOne({ host: toPuny(host!), - usernameLower: username.toLowerCase() + usernameLower: username.toLowerCase(), }); if (target == null) { diff --git a/packages/backend/src/queue/processors/db/index.ts b/packages/backend/src/queue/processors/db/index.ts index 97087642b7..1542f401ef 100644 --- a/packages/backend/src/queue/processors/db/index.ts +++ b/packages/backend/src/queue/processors/db/index.ts @@ -1,6 +1,7 @@ import * as Bull from 'bull'; import { DbJobData } from '@/queue/types'; import { deleteDriveFiles } from './delete-drive-files'; +import { exportCustomEmojis } from './export-custom-emojis'; import { exportNotes } from './export-notes'; import { exportFollowing } from './export-following'; import { exportMute } from './export-mute'; @@ -14,6 +15,7 @@ import { importBlocking } from './import-blocking'; const jobs = { deleteDriveFiles, + exportCustomEmojis, exportNotes, exportFollowing, exportMute, diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index 3c61896a2f..46aeb8cb7e 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -33,7 +33,7 @@ export default async (job: Bull.Job) => { if (suspendedHosts == null) { suspendedHosts = await Instances.find({ where: { - isSuspended: true + isSuspended: true, }, }); suspendedHostsCache.set(null, suspendedHosts); @@ -55,7 +55,7 @@ export default async (job: Bull.Job) => { latestRequestSentAt: new Date(), latestStatus: 200, lastCommunicatedAt: new Date(), - isNotResponding: false + isNotResponding: false, }); fetchInstanceMetadata(i); @@ -70,7 +70,7 @@ export default async (job: Bull.Job) => { Instances.update(i.id, { latestRequestSentAt: new Date(), latestStatus: res instanceof StatusError ? res.statusCode : null, - isNotResponding: true + isNotResponding: true, }); instanceChart.requestSent(i.host, false); diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index 4032ce8653..bfdebc0077 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -135,7 +135,7 @@ export default async (job: Bull.Job): Promise => { Instances.update(i.id, { latestRequestReceivedAt: new Date(), lastCommunicatedAt: new Date(), - isNotResponding: false + isNotResponding: false, }); fetchInstanceMetadata(i); diff --git a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts index a094c39d5d..788383a0a3 100644 --- a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts +++ b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts @@ -18,12 +18,12 @@ export default async function cleanRemoteFiles(job: Bull.Job { const key = await UserPublickeys.findOne({ - keyId + keyId, }); if (key == null) return null; @@ -86,7 +86,7 @@ export default class DbResolver { return { user, - key + key, }; } @@ -102,7 +102,7 @@ export default class DbResolver { return { user, - key + key, }; } @@ -115,11 +115,11 @@ export default class DbResolver { if (matchLocal) { return { type: matchLocal[1], - id: matchLocal[2] + id: matchLocal[2], }; } else { return { - uri + uri, }; } } diff --git a/packages/backend/src/remote/activitypub/deliver-manager.ts b/packages/backend/src/remote/activitypub/deliver-manager.ts index d37f97a447..b16f907693 100644 --- a/packages/backend/src/remote/activitypub/deliver-manager.ts +++ b/packages/backend/src/remote/activitypub/deliver-manager.ts @@ -43,7 +43,7 @@ export default class DeliverManager { */ public addFollowersRecipe() { const deliver = { - type: 'Followers' + type: 'Followers', } as IFollowersRecipe; this.addRecipe(deliver); @@ -56,7 +56,7 @@ export default class DeliverManager { public addDirectRecipe(to: IRemoteUser) { const recipe = { type: 'Direct', - to + to, } as IDirectRecipe; this.addRecipe(recipe); @@ -83,7 +83,7 @@ export default class DeliverManager { if (isFollowers(recipe)) { // followers deliver const followers = await Followings.find({ - followeeId: this.actor.id + followeeId: this.actor.id, }); for (const following of followers) { diff --git a/packages/backend/src/remote/activitypub/kernel/announce/note.ts b/packages/backend/src/remote/activitypub/kernel/announce/note.ts index 5230867f24..e9158f7752 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/note.ts @@ -59,7 +59,7 @@ export default async function(resolver: Resolver, actor: IRemoteUser, activity: renote, visibility: activityAudience.visibility, visibleUsers: activityAudience.visibleUsers, - uri + uri, }); } finally { unlock(); diff --git a/packages/backend/src/remote/activitypub/kernel/flag/index.ts b/packages/backend/src/remote/activitypub/kernel/flag/index.ts index 7abfd694cd..aec6d2daaa 100644 --- a/packages/backend/src/remote/activitypub/kernel/flag/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/flag/index.ts @@ -12,7 +12,7 @@ export default async (actor: IRemoteUser, activity: IFlag): Promise => { const userIds = uris.filter(uri => uri.startsWith(config.url + '/users/')).map(uri => uri.split('/').pop()); const users = await Users.find({ - id: In(userIds) + id: In(userIds), }); if (users.length < 1) return `skip`; @@ -23,7 +23,7 @@ export default async (actor: IRemoteUser, activity: IFlag): Promise => { targetUserHost: users[0].host, reporterId: actor.id, reporterHost: actor.host, - comment: `${activity.content}\n${JSON.stringify(uris, null, 2)}` + comment: `${activity.content}\n${JSON.stringify(uris, null, 2)}`, }); return `ok`; diff --git a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts index 5112d1d4ea..10c8a9c9d9 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts @@ -15,7 +15,7 @@ export default async (actor: IRemoteUser, activity: IAccept): Promise => const following = await Followings.findOne({ followerId: follower.id, - followeeId: actor.id + followeeId: actor.id, }); if (following) { diff --git a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts index 7bb9d7fcad..7f302a616d 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts @@ -7,7 +7,7 @@ export const undoAnnounce = async (actor: IRemoteUser, activity: IAnnounce): Pro const uri = getApId(activity); const note = await Notes.findOne({ - uri + uri, }); if (!note) return 'skip: no such Announce'; diff --git a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts index d85c7e4a71..783e5acf15 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts @@ -19,12 +19,12 @@ export default async (actor: IRemoteUser, activity: IFollow): Promise => const req = await FollowRequests.findOne({ followerId: actor.id, - followeeId: followee.id + followeeId: followee.id, }); const following = await Followings.findOne({ followerId: actor.id, - followeeId: followee.id + followeeId: followee.id, }); if (req) { diff --git a/packages/backend/src/remote/activitypub/misc/ld-signature.ts b/packages/backend/src/remote/activitypub/misc/ld-signature.ts index dec07ea81b..946914bfaa 100644 --- a/packages/backend/src/remote/activitypub/misc/ld-signature.ts +++ b/packages/backend/src/remote/activitypub/misc/ld-signature.ts @@ -20,7 +20,7 @@ export class LdSignature { creator, domain, nonce: crypto.randomBytes(16).toString('hex'), - created: (created || new Date()).toISOString() + created: (created || new Date()).toISOString(), } as { type: string; creator: string; @@ -45,8 +45,8 @@ export class LdSignature { ...data, signature: { ...options, - signatureValue: signature.toString('base64') - } + signatureValue: signature.toString('base64'), + }, }; } @@ -60,7 +60,7 @@ export class LdSignature { public async createVerifyData(data: any, options: any) { const transformedOptions = { ...options, - '@context': 'https://w3id.org/identity/v1' + '@context': 'https://w3id.org/identity/v1', }; delete transformedOptions['type']; delete transformedOptions['id']; @@ -79,7 +79,7 @@ export class LdSignature { public async normalize(data: any) { const customLoader = this.getLoader(); return await jsonld.normalize(data, { - documentLoader: customLoader + documentLoader: customLoader, }); } @@ -93,7 +93,7 @@ export class LdSignature { return { contextUrl: null, document: CONTEXTS[url], - documentUrl: url + documentUrl: url, }; } } @@ -103,7 +103,7 @@ export class LdSignature { return { contextUrl: null, document: document, - documentUrl: url + documentUrl: url, }; }; } diff --git a/packages/backend/src/remote/activitypub/models/image.ts b/packages/backend/src/remote/activitypub/models/image.ts index d0a96e4313..902eb36a17 100644 --- a/packages/backend/src/remote/activitypub/models/image.ts +++ b/packages/backend/src/remote/activitypub/models/image.ts @@ -38,7 +38,7 @@ export async function createImage(actor: IRemoteUser, value: any): Promise); })); } diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 9e9cb3a96a..19a7a70903 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -238,7 +238,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise ({ userId, screenName }), 'misskey:authentication:github': (id, login) => ({ id, login }), - 'misskey:authentication:discord': (id, name) => $discord(id, name) + 'misskey:authentication:discord': (id, name) => $discord(id, name), }; const $discord = (id: string, name: string) => { diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index 79f93c3a30..3e48e598e6 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -1,6 +1,6 @@ import config from '@/config/index'; import Resolver from '../resolver'; -import { IObject, IQuestion, isQuestion, } from '../type'; +import { IObject, IQuestion, isQuestion } from '../type'; import { apLogger } from '../logger'; import { Notes, Polls } from '@/models/index'; import { IPoll } from '@/models/entities/poll'; @@ -31,7 +31,7 @@ export async function extractPollFromQuestion(source: string | IObject, resolver choices, votes, multiple, - expiresAt + expiresAt, }; } @@ -76,7 +76,7 @@ export async function updateQuestion(value: any) { } await Polls.update({ noteId: note.id }, { - votes: poll.votes + votes: poll.votes, }); return changed; diff --git a/packages/backend/src/remote/activitypub/renderer/accept.ts b/packages/backend/src/remote/activitypub/renderer/accept.ts index f1e61f4c6a..3bce2165cd 100644 --- a/packages/backend/src/remote/activitypub/renderer/accept.ts +++ b/packages/backend/src/remote/activitypub/renderer/accept.ts @@ -4,5 +4,5 @@ import { User } from '@/models/entities/user'; export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Accept', actor: `${config.url}/users/${user.id}`, - object + object, }); diff --git a/packages/backend/src/remote/activitypub/renderer/add.ts b/packages/backend/src/remote/activitypub/renderer/add.ts index 21414a9380..960daf8424 100644 --- a/packages/backend/src/remote/activitypub/renderer/add.ts +++ b/packages/backend/src/remote/activitypub/renderer/add.ts @@ -5,5 +5,5 @@ export default (user: ILocalUser, target: any, object: any) => ({ type: 'Add', actor: `${config.url}/users/${user.id}`, target, - object + object, }); diff --git a/packages/backend/src/remote/activitypub/renderer/announce.ts b/packages/backend/src/remote/activitypub/renderer/announce.ts index 7bf90922be..ab113b48e6 100644 --- a/packages/backend/src/remote/activitypub/renderer/announce.ts +++ b/packages/backend/src/remote/activitypub/renderer/announce.ts @@ -24,6 +24,6 @@ export default (object: any, note: Note) => { published: note.createdAt.toISOString(), to, cc, - object + object, }; }; diff --git a/packages/backend/src/remote/activitypub/renderer/block.ts b/packages/backend/src/remote/activitypub/renderer/block.ts index bb3d74295a..bfb831daa8 100644 --- a/packages/backend/src/remote/activitypub/renderer/block.ts +++ b/packages/backend/src/remote/activitypub/renderer/block.ts @@ -4,5 +4,5 @@ import { ILocalUser, IRemoteUser } from '@/models/entities/user'; export default (blocker: ILocalUser, blockee: IRemoteUser) => ({ type: 'Block', actor: `${config.url}/users/${blocker.id}`, - object: blockee.uri + object: blockee.uri, }); diff --git a/packages/backend/src/remote/activitypub/renderer/create.ts b/packages/backend/src/remote/activitypub/renderer/create.ts index 04aa993a91..ac9e69af20 100644 --- a/packages/backend/src/remote/activitypub/renderer/create.ts +++ b/packages/backend/src/remote/activitypub/renderer/create.ts @@ -7,7 +7,7 @@ export default (object: any, note: Note) => { actor: `${config.url}/users/${note.userId}`, type: 'Create', published: note.createdAt.toISOString(), - object + object, } as any; if (object.to) activity.to = object.to; diff --git a/packages/backend/src/remote/activitypub/renderer/emoji.ts b/packages/backend/src/remote/activitypub/renderer/emoji.ts index ca514c56b5..9d08c8ba81 100644 --- a/packages/backend/src/remote/activitypub/renderer/emoji.ts +++ b/packages/backend/src/remote/activitypub/renderer/emoji.ts @@ -9,6 +9,6 @@ export default (emoji: Emoji) => ({ icon: { type: 'Image', mediaType: emoji.type || 'image/png', - url: emoji.url - } + url: emoji.url, + }, }); diff --git a/packages/backend/src/remote/activitypub/renderer/follow-relay.ts b/packages/backend/src/remote/activitypub/renderer/follow-relay.ts index 984c3c7639..38800267bf 100644 --- a/packages/backend/src/remote/activitypub/renderer/follow-relay.ts +++ b/packages/backend/src/remote/activitypub/renderer/follow-relay.ts @@ -7,7 +7,7 @@ export function renderFollowRelay(relay: Relay, relayActor: ILocalUser) { id: `${config.url}/activities/follow-relay/${relay.id}`, type: 'Follow', actor: `${config.url}/users/${relayActor.id}`, - object: 'https://www.w3.org/ns/activitystreams#Public' + object: 'https://www.w3.org/ns/activitystreams#Public', }; return follow; diff --git a/packages/backend/src/remote/activitypub/renderer/follow.ts b/packages/backend/src/remote/activitypub/renderer/follow.ts index c8a7946799..5258df7e97 100644 --- a/packages/backend/src/remote/activitypub/renderer/follow.ts +++ b/packages/backend/src/remote/activitypub/renderer/follow.ts @@ -6,7 +6,7 @@ export default (follower: { id: User['id']; host: User['host']; uri: User['host' const follow = { type: 'Follow', actor: Users.isLocalUser(follower) ? `${config.url}/users/${follower.id}` : follower.uri, - object: Users.isLocalUser(followee) ? `${config.url}/users/${followee.id}` : followee.uri + object: Users.isLocalUser(followee) ? `${config.url}/users/${followee.id}` : followee.uri, } as any; if (requestId) follow.id = requestId; diff --git a/packages/backend/src/remote/activitypub/renderer/hashtag.ts b/packages/backend/src/remote/activitypub/renderer/hashtag.ts index 290c74c7fe..d83a8e68b1 100644 --- a/packages/backend/src/remote/activitypub/renderer/hashtag.ts +++ b/packages/backend/src/remote/activitypub/renderer/hashtag.ts @@ -3,5 +3,5 @@ import config from '@/config/index'; export default (tag: string) => ({ type: 'Hashtag', href: `${config.url}/tags/${encodeURIComponent(tag)}`, - name: `#${tag}` + name: `#${tag}`, }); diff --git a/packages/backend/src/remote/activitypub/renderer/image.ts b/packages/backend/src/remote/activitypub/renderer/image.ts index 0cb3d6ed65..ee3860be8c 100644 --- a/packages/backend/src/remote/activitypub/renderer/image.ts +++ b/packages/backend/src/remote/activitypub/renderer/image.ts @@ -5,5 +5,5 @@ export default (file: DriveFile) => ({ type: 'Image', url: DriveFiles.getPublicUrl(file), sensitive: file.isSensitive, - name: file.comment + name: file.comment, }); diff --git a/packages/backend/src/remote/activitypub/renderer/index.ts b/packages/backend/src/remote/activitypub/renderer/index.ts index f6ec6583d0..911118e4c9 100644 --- a/packages/backend/src/remote/activitypub/renderer/index.ts +++ b/packages/backend/src/remote/activitypub/renderer/index.ts @@ -41,8 +41,8 @@ export const renderActivity = (x: any): IActivity | null => { 'isCat': 'misskey:isCat', // vcard vcard: 'http://www.w3.org/2006/vcard/ns#', - } - ] + }, + ], }, x); }; diff --git a/packages/backend/src/remote/activitypub/renderer/key.ts b/packages/backend/src/remote/activitypub/renderer/key.ts index 992f98d79a..51bc888dd7 100644 --- a/packages/backend/src/remote/activitypub/renderer/key.ts +++ b/packages/backend/src/remote/activitypub/renderer/key.ts @@ -9,6 +9,6 @@ export default (user: ILocalUser, key: UserKeypair, postfix?: string) => ({ owner: `${config.url}/users/${user.id}`, publicKeyPem: createPublicKey(key.publicKey).export({ type: 'spki', - format: 'pem' - }) + format: 'pem', + }), }); diff --git a/packages/backend/src/remote/activitypub/renderer/like.ts b/packages/backend/src/remote/activitypub/renderer/like.ts index a7e79a176f..2e4da9d26f 100644 --- a/packages/backend/src/remote/activitypub/renderer/like.ts +++ b/packages/backend/src/remote/activitypub/renderer/like.ts @@ -13,14 +13,14 @@ export const renderLike = async (noteReaction: NoteReaction, note: Note) => { actor: `${config.url}/users/${noteReaction.userId}`, object: note.uri ? note.uri : `${config.url}/notes/${noteReaction.noteId}`, content: reaction, - _misskey_reaction: reaction + _misskey_reaction: reaction, } as any; if (reaction.startsWith(':')) { const name = reaction.replace(/:/g, ''); const emoji = await Emojis.findOne({ name, - host: null + host: null, }); if (emoji) object.tag = [ renderEmoji(emoji) ]; diff --git a/packages/backend/src/remote/activitypub/renderer/note.ts b/packages/backend/src/remote/activitypub/renderer/note.ts index 84a1786784..4f9a372b2f 100644 --- a/packages/backend/src/remote/activitypub/renderer/note.ts +++ b/packages/backend/src/remote/activitypub/renderer/note.ts @@ -76,7 +76,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false } const mentionedUsers = note.mentions.length > 0 ? await Users.find({ - id: In(note.mentions) + id: In(note.mentions), }) : []; const hashtagTags = (note.tags || []).map(tag => renderHashtag(tag)); @@ -101,7 +101,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false const summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw; const content = toHtml(Object.assign({}, note, { - text: apText + text: apText, })); const emojis = await getEmojis(note.emojis); @@ -116,7 +116,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false const asPoll = poll ? { type: 'Question', content: toHtml(Object.assign({}, note, { - text: text + text: text, })), [poll.expiresAt && poll.expiresAt < new Date() ? 'closed' : 'endTime']: poll.expiresAt, [poll.multiple ? 'anyOf' : 'oneOf']: poll.choices.map((text, i) => ({ @@ -124,13 +124,13 @@ export default async function renderNote(note: Note, dive = true, isTalk = false name: text, replies: { type: 'Collection', - totalItems: poll!.votes[i] - } - })) + totalItems: poll!.votes[i], + }, + })), } : {}; const asTalk = isTalk ? { - _misskey_talk: true + _misskey_talk: true, } : {}; return { @@ -150,7 +150,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false sensitive: note.cw != null || files.some(file => file.isSensitive), tag, ...asPoll, - ...asTalk + ...asTalk, }; } @@ -160,7 +160,7 @@ export async function getEmojis(names: string[]): Promise { const emojis = await Promise.all( names.map(name => Emojis.findOne({ name, - host: null + host: null, })) ); diff --git a/packages/backend/src/remote/activitypub/renderer/ordered-collection-page.ts b/packages/backend/src/remote/activitypub/renderer/ordered-collection-page.ts index 2433358646..c5e25f577b 100644 --- a/packages/backend/src/remote/activitypub/renderer/ordered-collection-page.ts +++ b/packages/backend/src/remote/activitypub/renderer/ordered-collection-page.ts @@ -13,7 +13,7 @@ export default function(id: string, totalItems: any, orderedItems: any, partOf: partOf, type: 'OrderedCollectionPage', totalItems, - orderedItems + orderedItems, } as any; if (prev) page.prev = prev; diff --git a/packages/backend/src/remote/activitypub/renderer/person.ts b/packages/backend/src/remote/activitypub/renderer/person.ts index f2a283a870..d1c4c0040b 100644 --- a/packages/backend/src/remote/activitypub/renderer/person.ts +++ b/packages/backend/src/remote/activitypub/renderer/person.ts @@ -19,7 +19,7 @@ export async function renderPerson(user: ILocalUser) { const [avatar, banner, profile] = await Promise.all([ user.avatarId ? DriveFiles.findOne(user.avatarId) : Promise.resolve(undefined), user.bannerId ? DriveFiles.findOne(user.bannerId) : Promise.resolve(undefined), - UserProfiles.findOneOrFail(user.id) + UserProfiles.findOneOrFail(user.id), ]); const attachment: { @@ -36,7 +36,7 @@ export async function renderPerson(user: ILocalUser) { name: field.name, value: (field.value != null && field.value.match(/^https?:/)) ? `${new URL(field.value).href}` - : field.value + : field.value, }); } } @@ -74,7 +74,7 @@ export async function renderPerson(user: ILocalUser) { discoverable: !!user.isExplorable, publicKey: renderKey(user, keypair, `#main-key`), isCat: user.isCat, - attachment: attachment.length ? attachment : undefined + attachment: attachment.length ? attachment : undefined, } as any; if (profile?.birthday) { diff --git a/packages/backend/src/remote/activitypub/renderer/question.ts b/packages/backend/src/remote/activitypub/renderer/question.ts index c800e73a5b..3cbff33abc 100644 --- a/packages/backend/src/remote/activitypub/renderer/question.ts +++ b/packages/backend/src/remote/activitypub/renderer/question.ts @@ -14,9 +14,9 @@ export default async function renderQuestion(user: { id: User['id'] }, note: Not _misskey_votes: poll.votes[i], replies: { type: 'Collection', - totalItems: poll.votes[i] - } - })) + totalItems: poll.votes[i], + }, + })), }; return question; diff --git a/packages/backend/src/remote/activitypub/renderer/read.ts b/packages/backend/src/remote/activitypub/renderer/read.ts index 95357f64d3..2fe3b8e5e0 100644 --- a/packages/backend/src/remote/activitypub/renderer/read.ts +++ b/packages/backend/src/remote/activitypub/renderer/read.ts @@ -5,5 +5,5 @@ import { MessagingMessage } from '@/models/entities/messaging-message'; export const renderReadActivity = (user: { id: User['id'] }, message: MessagingMessage) => ({ type: 'Read', actor: `${config.url}/users/${user.id}`, - object: message.uri + object: message.uri, }); diff --git a/packages/backend/src/remote/activitypub/renderer/reject.ts b/packages/backend/src/remote/activitypub/renderer/reject.ts index 42beffecf2..575ef52ab8 100644 --- a/packages/backend/src/remote/activitypub/renderer/reject.ts +++ b/packages/backend/src/remote/activitypub/renderer/reject.ts @@ -4,5 +4,5 @@ import { User } from '@/models/entities/user'; export default (object: any, user: { id: User['id'] }) => ({ type: 'Reject', actor: `${config.url}/users/${user.id}`, - object + object, }); diff --git a/packages/backend/src/remote/activitypub/renderer/remove.ts b/packages/backend/src/remote/activitypub/renderer/remove.ts index 79d60edbaa..8afaf199cc 100644 --- a/packages/backend/src/remote/activitypub/renderer/remove.ts +++ b/packages/backend/src/remote/activitypub/renderer/remove.ts @@ -5,5 +5,5 @@ export default (user: { id: User['id'] }, target: any, object: any) => ({ type: 'Remove', actor: `${config.url}/users/${user.id}`, target, - object + object, }); diff --git a/packages/backend/src/remote/activitypub/renderer/tombstone.ts b/packages/backend/src/remote/activitypub/renderer/tombstone.ts index 553406b93b..313ca74e9d 100644 --- a/packages/backend/src/remote/activitypub/renderer/tombstone.ts +++ b/packages/backend/src/remote/activitypub/renderer/tombstone.ts @@ -1,4 +1,4 @@ export default (id: string) => ({ id, - type: 'Tombstone' + type: 'Tombstone', }); diff --git a/packages/backend/src/remote/activitypub/renderer/vote.ts b/packages/backend/src/remote/activitypub/renderer/vote.ts index ff038070f7..fd7bc9dbed 100644 --- a/packages/backend/src/remote/activitypub/renderer/vote.ts +++ b/packages/backend/src/remote/activitypub/renderer/vote.ts @@ -17,7 +17,7 @@ export default async function renderVote(user: { id: User['id'] }, vote: PollVot attributedTo: `${config.url}/users/${user.id}`, to: [pollOwner.uri], inReplyTo: note.uri, - name: poll.choices[vote.choice] - } + name: poll.choices[vote.choice], + }, }; } diff --git a/packages/backend/src/remote/activitypub/request.ts b/packages/backend/src/remote/activitypub/request.ts index d6ced630c1..715937e2a7 100644 --- a/packages/backend/src/remote/activitypub/request.ts +++ b/packages/backend/src/remote/activitypub/request.ts @@ -12,13 +12,13 @@ export default async (user: { id: User['id'] }, url: string, object: any) => { const req = createSignedPost({ key: { privateKeyPem: keypair.privateKey, - keyId: `${config.url}/users/${user.id}#main-key` + keyId: `${config.url}/users/${user.id}#main-key`, }, url, body, additionalHeaders: { 'User-Agent': config.userAgent, - } + }, }); await getResponse({ @@ -40,18 +40,18 @@ export async function signedGet(url: string, user: { id: User['id'] }) { const req = createSignedGet({ key: { privateKeyPem: keypair.privateKey, - keyId: `${config.url}/users/${user.id}#main-key` + keyId: `${config.url}/users/${user.id}#main-key`, }, url, additionalHeaders: { 'User-Agent': config.userAgent, - } + }, }); const res = await getResponse({ url, method: req.request.method, - headers: req.request.headers + headers: req.request.headers, }); return await res.json(); diff --git a/packages/backend/src/remote/resolve-user.ts b/packages/backend/src/remote/resolve-user.ts index a12396abc8..df6226cc50 100644 --- a/packages/backend/src/remote/resolve-user.ts +++ b/packages/backend/src/remote/resolve-user.ts @@ -71,9 +71,9 @@ export async function resolveUser(username: string, host: string | null, option? await Users.update({ usernameLower, - host: host + host: host, }, { - uri: self.href + uri: self.href, }); } else { logger.info(`uri is fine: ${acctLower}`); diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index eabe681136..da6a00e58e 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -68,7 +68,7 @@ router.get('/notes/:note', async (ctx, next) => { const note = await Notes.findOne({ id: ctx.params.note, visibility: In(['public', 'home']), - localOnly: false + localOnly: false, }); if (note == null) { @@ -97,7 +97,7 @@ router.get('/notes/:note/activity', async ctx => { id: ctx.params.note, userHost: null, visibility: In(['public', 'home']), - localOnly: false + localOnly: false, }); if (note == null) { @@ -128,7 +128,7 @@ router.get('/users/:user/publickey', async ctx => { const user = await Users.findOne({ id: userId, - host: null + host: null, }); if (user == null) { @@ -167,7 +167,7 @@ router.get('/users/:user', async (ctx, next) => { const user = await Users.findOne({ id: userId, host: null, - isSuspended: false + isSuspended: false, }); await userInfo(ctx, user); @@ -179,7 +179,7 @@ router.get('/@:user', async (ctx, next) => { const user = await Users.findOne({ usernameLower: ctx.params.user.toLowerCase(), host: null, - isSuspended: false + isSuspended: false, }); await userInfo(ctx, user); @@ -190,7 +190,7 @@ router.get('/@:user', async (ctx, next) => { router.get('/emojis/:emoji', async ctx => { const emoji = await Emojis.findOne({ host: null, - name: ctx.params.emoji + name: ctx.params.emoji, }); if (emoji == null) { diff --git a/packages/backend/src/server/activitypub/featured.ts b/packages/backend/src/server/activitypub/featured.ts index 1598cc680f..40b8d8cc81 100644 --- a/packages/backend/src/server/activitypub/featured.ts +++ b/packages/backend/src/server/activitypub/featured.ts @@ -12,7 +12,7 @@ export default async (ctx: Router.RouterContext) => { // Verify user const user = await Users.findOne({ id: userId, - host: null + host: null, }); if (user == null) { @@ -22,7 +22,7 @@ export default async (ctx: Router.RouterContext) => { const pinings = await UserNotePinings.find({ where: { userId: user.id }, - order: { id: 'DESC' } + order: { id: 'DESC' }, }); const pinnedNotes = await Promise.all(pinings.map(pining => diff --git a/packages/backend/src/server/activitypub/followers.ts b/packages/backend/src/server/activitypub/followers.ts index baf2d23460..927fb5d18a 100644 --- a/packages/backend/src/server/activitypub/followers.ts +++ b/packages/backend/src/server/activitypub/followers.ts @@ -30,7 +30,7 @@ export default async (ctx: Router.RouterContext) => { // Verify user const user = await Users.findOne({ id: userId, - host: null + host: null, }); if (user == null) { @@ -57,7 +57,7 @@ export default async (ctx: Router.RouterContext) => { if (page) { const query = { - followeeId: user.id + followeeId: user.id, } as any; // カーソルが指定されている場合 @@ -69,7 +69,7 @@ export default async (ctx: Router.RouterContext) => { const followings = await Followings.find({ where: query, take: limit + 1, - order: { id: -1 } + order: { id: -1 }, }); // 「次のページ」があるかどうか @@ -80,13 +80,13 @@ export default async (ctx: Router.RouterContext) => { const rendered = renderOrderedCollectionPage( `${partOf}?${url.query({ page: 'true', - cursor + cursor, })}`, user.followersCount, renderedFollowers, partOf, undefined, inStock ? `${partOf}?${url.query({ page: 'true', - cursor: followings[followings.length - 1].id + cursor: followings[followings.length - 1].id, })}` : undefined ); diff --git a/packages/backend/src/server/activitypub/following.ts b/packages/backend/src/server/activitypub/following.ts index b9eb806c3c..a3237582ad 100644 --- a/packages/backend/src/server/activitypub/following.ts +++ b/packages/backend/src/server/activitypub/following.ts @@ -31,7 +31,7 @@ export default async (ctx: Router.RouterContext) => { // Verify user const user = await Users.findOne({ id: userId, - host: null + host: null, }); if (user == null) { @@ -58,7 +58,7 @@ export default async (ctx: Router.RouterContext) => { if (page) { const query = { - followerId: user.id + followerId: user.id, } as FindConditions; // カーソルが指定されている場合 @@ -70,7 +70,7 @@ export default async (ctx: Router.RouterContext) => { const followings = await Followings.find({ where: query, take: limit + 1, - order: { id: -1 } + order: { id: -1 }, }); // 「次のページ」があるかどうか @@ -81,13 +81,13 @@ export default async (ctx: Router.RouterContext) => { const rendered = renderOrderedCollectionPage( `${partOf}?${url.query({ page: 'true', - cursor + cursor, })}`, user.followingCount, renderedFollowees, partOf, undefined, inStock ? `${partOf}?${url.query({ page: 'true', - cursor: followings[followings.length - 1].id + cursor: followings[followings.length - 1].id, })}` : undefined ); diff --git a/packages/backend/src/server/activitypub/outbox.ts b/packages/backend/src/server/activitypub/outbox.ts index df528e8b5a..ba6b46a0cc 100644 --- a/packages/backend/src/server/activitypub/outbox.ts +++ b/packages/backend/src/server/activitypub/outbox.ts @@ -38,7 +38,7 @@ export default async (ctx: Router.RouterContext) => { // Verify user const user = await Users.findOne({ id: userId, - host: null + host: null, }); if (user == null) { @@ -67,16 +67,16 @@ export default async (ctx: Router.RouterContext) => { `${partOf}?${url.query({ page: 'true', since_id: sinceId, - until_id: untilId + until_id: untilId, })}`, user.notesCount, activities, partOf, notes.length ? `${partOf}?${url.query({ page: 'true', - since_id: notes[0].id + since_id: notes[0].id, })}` : undefined, notes.length ? `${partOf}?${url.query({ page: 'true', - until_id: notes[notes.length - 1].id + until_id: notes[notes.length - 1].id, })}` : undefined ); 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/generate-muted-instance-query.ts b/packages/backend/src/server/api/common/generate-muted-instance-query.ts new file mode 100644 index 0000000000..dbc9fc98f1 --- /dev/null +++ b/packages/backend/src/server/api/common/generate-muted-instance-query.ts @@ -0,0 +1,40 @@ +import { User } from '@/models/entities/user'; +import { id } from '@/models/id'; +import { UserProfiles } from '@/models/index'; +import { SelectQueryBuilder, Brackets } from 'typeorm'; + +function createMutesQuery(id: string) { + return UserProfiles.createQueryBuilder('user_profile') + .select('user_profile.mutedInstances') + .where('user_profile.userId = :muterId', { muterId: id }); +} + +export function generateMutedInstanceQuery(q: SelectQueryBuilder, me: { id: User['id'] }) { + const mutingQuery = createMutesQuery(me.id); + + q + .andWhere(new Brackets(qb => { qb + .andWhere('note.userHost IS NULL') + .orWhere(`NOT((${ mutingQuery.getQuery() })::jsonb ? note.userHost)`); + })) + .andWhere(new Brackets(qb => { qb + .where(`note.replyUserHost IS NULL`) + .orWhere(`NOT ((${ mutingQuery.getQuery() })::jsonb ? note.replyUserHost)`); + })) + .andWhere(new Brackets(qb => { qb + .where(`note.renoteUserHost IS NULL`) + .orWhere(`NOT ((${ mutingQuery.getQuery() })::jsonb ? note.renoteUserHost)`); + })); + q.setParameters(mutingQuery.getParameters()); +} + +export function generateMutedInstanceNotificationQuery(q: SelectQueryBuilder, me: { id: User['id'] }) { + const mutingQuery = createMutesQuery(me.id); + + q.andWhere(new Brackets(qb => { qb + .andWhere('notifier.host IS NULL') + .orWhere(`NOT (( ${mutingQuery.getQuery()} )::jsonb ? notifier.host)`); + })); + + q.setParameters(mutingQuery.getParameters()); +} 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 35ff4e4693..ea96582c92 100644 --- a/packages/backend/src/server/api/common/read-messaging-message.ts +++ b/packages/backend/src/server/api/common/read-messaging-message.ts @@ -25,7 +25,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) { @@ -39,9 +39,9 @@ export async function readUserMessagingMessage( id: In(messageIds), userId: otherpartyId, recipientId: userId, - isRead: false + isRead: false, }, { - isRead: true + isRead: true, }); // Publish event @@ -82,7 +82,7 @@ export async function readGroupMessagingMessage( // check joined const joining = await UserGroupJoinings.findOne({ userId: userId, - userGroupId: groupId + userGroupId: groupId, }); if (joining == null) { @@ -90,7 +90,7 @@ export async function readGroupMessagingMessage( } const messages = await MessagingMessages.find({ - id: In(messageIds) + id: In(messageIds), }); const reads: MessagingMessage['id'][] = []; @@ -102,7 +102,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(); @@ -113,7 +113,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 089f90fdab..a2d0fa9067 100644 --- a/packages/backend/src/server/api/common/read-notification.ts +++ b/packages/backend/src/server/api/common/read-notification.ts @@ -12,9 +12,9 @@ export async function readNotification( // Update documents await Notifications.update({ id: In(notificationIds), - isRead: false + isRead: false, }, { - isRead: true + isRead: true, }); if (!await Users.getHasUnreadNotification(userId)) return postReadAllNotifications(userId); @@ -28,7 +28,7 @@ export async function readNotificationByQuery( const notificationIds = await Notifications.find({ ...query, notifieeId: userId, - isRead: false + isRead: false, }).then(notifications => notifications.map(notification => notification.id)); return readNotification(userId, notificationIds); 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(defs: T, params: any): [Params, 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: '' - } - } - } + default: '', + }, + }, + }, }; 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 { // 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/export-custom-emojis.ts b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts new file mode 100644 index 0000000000..92738c8288 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts @@ -0,0 +1,17 @@ +import $ from 'cafy'; +import define from '../define'; +import { createExportCustomEmojisJob } from '@/queue/index'; +import ms from 'ms'; + +export const meta = { + secure: true, + requireCredential: true as const, + limit: { + duration: ms('1hour'), + max: 1, + }, +}; + +export default define(meta, async (ps, user) => { + createExportCustomEmojisJob(user); +}); 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); 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/export-following.ts b/packages/backend/src/server/api/endpoints/i/export-following.ts index a351161111..15c09941e8 100644 --- a/packages/backend/src/server/api/endpoints/i/export-following.ts +++ b/packages/backend/src/server/api/endpoints/i/export-following.ts @@ -1,3 +1,4 @@ +import $ from 'cafy'; import define from '../../define'; import { createExportFollowingJob } from '@/queue/index'; import ms from 'ms'; @@ -9,8 +10,18 @@ export const meta = { duration: ms('1hour'), max: 1, }, + params: { + excludeMuting: { + validator: $.optional.bool, + default: false, + }, + excludeInactive: { + validator: $.optional.bool, + default: false, + }, + }, }; export default define(meta, async (ps, user) => { - createExportFollowingJob(user); + createExportFollowingJob(user, ps.excludeMuting, ps.excludeInactive); }); 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 56668d03b7..9083aefacd 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -3,6 +3,7 @@ import { ID } from '@/misc/cafy-id'; import { readNotification } from '../../common/read-notification'; import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; +import { generateMutedInstanceNotificationQuery } from '../../common/generate-muted-instance-query'; import { Notifications, Followings, Mutings, Users } from '@/models/index'; import { notificationTypes } from '@/types'; import read from '@/services/note/read'; @@ -18,7 +19,7 @@ export const meta = { params: { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -31,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: { @@ -50,7 +51,7 @@ export const meta = { excludeTypes: { validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])), - } + }, }, res: { @@ -60,7 +61,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Notification', - } + }, }, }; @@ -101,6 +102,8 @@ export default define(meta, async (ps, user) => { })); query.setParameters(mutingQuery.getParameters()); + generateMutedInstanceNotificationQuery(query, user); + query.andWhere(new Brackets(qb => { qb .where(`notification.notifierId NOT IN (${ suspendedQuery.getQuery() })`) .orWhere('notification.notifierId IS NULL'); 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 d0f201ab60..5a62b39377 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -113,15 +113,19 @@ export const meta = { }, mutedWords: { - validator: $.optional.arr($.arr($.str)) + validator: $.optional.arr($.arr($.str)), + }, + + mutedInstances: { + 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), }, }, @@ -129,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) => { @@ -185,6 +189,7 @@ export default define(meta, async (ps, _user, token) => { profileUpdates.mutedWords = ps.mutedWords; profileUpdates.enableWordMute = ps.mutedWords.length > 0; } + if (ps.mutedInstances !== undefined) profileUpdates.mutedInstances = ps.mutedInstances; if (ps.mutingNotificationTypes !== undefined) profileUpdates.mutingNotificationTypes = ps.mutingNotificationTypes as typeof notificationTypes[number][]; if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked; if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable; @@ -275,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 68881fda9e..acd9d6f7e4 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -7,6 +7,7 @@ import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; import { Brackets } from 'typeorm'; import { Notes } from '@/models/index'; import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query'; export const meta = { tags: ['notes'], @@ -20,7 +21,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -39,7 +40,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; @@ -65,6 +66,7 @@ export default define(meta, async (ps, user) => { generateVisibilityQuery(query, user); if (user) generateMutedUserQuery(query, user); if (user) generateBlockedUserQuery(query, user); + if (user) generateMutedInstanceQuery(query, user); const notes = await query.take(ps.limit!).getMany(); 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 f01eb4c82b..51f49d57ff 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 5902c0415c..c3be042bfb 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -6,6 +6,7 @@ import { ApiError } from '../../error'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notes } from '@/models/index'; import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query'; import { activeUsersChart } from '@/services/chart/index'; import { generateRepliesQuery } from '../../common/generate-replies-query'; import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; @@ -21,7 +22,7 @@ export const meta = { limit: { validator: $.optional.num.range(1, 100), - default: 10 + default: 10, }, sinceId: { @@ -33,11 +34,11 @@ export const meta = { }, sinceDate: { - validator: $.optional.num + validator: $.optional.num, }, untilDate: { - validator: $.optional.num + validator: $.optional.num, }, }, @@ -48,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) => { @@ -83,6 +84,7 @@ export default define(meta, async (ps, user) => { if (user) generateMutedUserQuery(query, user); if (user) generateMutedNoteQuery(query, user); if (user) generateBlockedUserQuery(query, user); + if (user) generateMutedInstanceQuery(query, user); if (ps.withFiles) { query.andWhere('note.fileIds != \'{}\''); 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 47f08f208b..4a0b9d49d7 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -8,6 +8,7 @@ import { Followings, Notes } from '@/models/index'; import { Brackets } from 'typeorm'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query'; import { activeUsersChart } from '@/services/chart/index'; import { generateRepliesQuery } from '../../common/generate-replies-query'; import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; @@ -68,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) => { @@ -108,6 +109,7 @@ export default define(meta, async (ps, user) => { generateRepliesQuery(query, user); generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); + generateMutedInstanceQuery(query, user); generateMutedNoteQuery(query, user); generateBlockedUserQuery(query, 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; 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 1bd0e57d34..211b8d4f40 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -5,6 +5,7 @@ import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notes, Followings } from '@/models/index'; import { generateVisibilityQuery } from '../../common/generate-visibility-query'; import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query'; import { activeUsersChart } from '@/services/chart/index'; import { Brackets } from 'typeorm'; import { generateRepliesQuery } from '../../common/generate-replies-query'; @@ -66,7 +67,7 @@ export const meta = { type: 'object' as const, optional: false as const, nullable: false as const, ref: 'Note', - } + }, }, }; @@ -75,7 +76,7 @@ export default define(meta, async (ps, user) => { where: { followerId: user.id, }, - take: 1 + take: 1, })) !== 0; //#region Construct query @@ -100,6 +101,7 @@ export default define(meta, async (ps, user) => { generateRepliesQuery(query, user); generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); + generateMutedInstanceQuery(query, user); generateMutedNoteQuery(query, user); generateBlockedUserQuery(query, user); 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 2e9b56bfad..4e98793f01 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 @@ -8,7 +8,7 @@ export const meta = { requireCredential: true as const, - kind: 'write:notifications' + kind: 'write:notifications', }; export default define(meta, async (ps, user) => { @@ -17,7 +17,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 c2c6c439a9..b0bd2f3325 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -33,14 +33,6 @@ export const meta = { } } }, - - errors: { - noNotificationRequested: { - message: 'You requested no notification.', - code: 'NO_NOTIFICATION_REQUESTED', - id: '1dee2109-b88b-21cf-3935-607dad60f5b0' - }, - }, }; export default define(meta, async (ps, user) => { 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 0afbad9d04..da8e858119 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -9,6 +9,7 @@ import { Notes } from '@/models/index'; import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; import { Brackets } from 'typeorm'; import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query'; export const meta = { tags: ['users', 'notes'], @@ -71,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) => { @@ -102,6 +103,7 @@ export default define(meta, async (ps, me) => { generateVisibilityQuery(query, me); if (me) generateMutedUserQuery(query, me, user); if (me) generateBlockedUserQuery(query, me); + if (me) generateMutedInstanceQuery(query, me); if (ps.withFiles) { query.andWhere('note.fileIds != \'{}\''); 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((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((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((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((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((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 f5983ab472..f14f597aac 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -5,6 +5,7 @@ import { fetchMeta } from '@/misc/fetch-meta'; import { Notes } from '@/models/index'; import { checkWordMute } from '@/misc/check-word-mute'; import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isInstanceMuted } from '@/misc/is-instance-muted'; import { Packed } from '@/misc/schema'; export default class extends Channel { @@ -31,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, }); } @@ -48,6 +49,9 @@ export default class extends Channel { if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; } + // Ignore notes from instances the user has muted + if (isInstanceMuted(note, new Set(this.userProfile?.mutedInstances ?? []))) return; + // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (isMutedUserRelated(note, this.muting)) return; // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する 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 52e9aec250..3bd491421d 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -4,6 +4,7 @@ import Channel from '../channel'; import { Notes } from '@/models/index'; import { checkWordMute } from '@/misc/check-word-mute'; import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isInstanceMuted } from '@/misc/is-instance-muted'; import { Packed } from '@/misc/schema'; export default class extends Channel { @@ -26,9 +27,12 @@ export default class extends Channel { if ((this.user!.id !== note.userId) && !this.following.has(note.userId)) return; } + // Ignore notes from instances the user has muted + if (isInstanceMuted(note, new Set(this.userProfile?.mutedInstances ?? []))) return; + if (['followers', 'specified'].includes(note.visibility)) { note = await Notes.pack(note.id, this.user!, { - detail: true + detail: true, }); if (note.isHidden) { @@ -38,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 51f95fc0cd..0ae19aa7ce 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -5,6 +5,7 @@ import { fetchMeta } from '@/misc/fetch-meta'; import { Notes } from '@/models/index'; import { checkWordMute } from '@/misc/check-word-mute'; import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isInstanceMuted } from '@/misc/is-instance-muted'; import { Packed } from '@/misc/schema'; export default class extends Channel { @@ -36,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) { @@ -46,17 +47,20 @@ 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, }); } } + // Ignore notes from instances the user has muted + if (isInstanceMuted(note, new Set(this.userProfile?.mutedInstances ?? []))) return; + // 関係ない返信は除外 if (note.reply) { const reply = note.reply; 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 131ac30472..b41eae7c71 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -1,6 +1,7 @@ import autobind from 'autobind-decorator'; import Channel from '../channel'; import { Notes } from '@/models/index'; +import { isInstanceMuted, isUserFromMutedInstance } from '@/misc/is-instance-muted'; export default class extends Channel { public readonly chName = 'main'; @@ -13,11 +14,13 @@ export default class extends Channel { this.subscriber.on(`mainStream:${this.user!.id}`, async data => { switch (data.type) { case 'notification': { + // Ignore notifications from instances the user has muted + if (isUserFromMutedInstance(data.body, new Set(this.userProfile?.mutedInstances ?? []))) return; if (data.body.userId && this.muting.has(data.body.userId)) return; 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; @@ -25,10 +28,12 @@ export default class extends Channel { break; } case 'mention': { + if (isInstanceMuted(data.body, new Set(this.userProfile?.mutedInstances ?? []))) return; + 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(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(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(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(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) => { diff --git a/packages/backend/src/server/file/send-drive-file.ts b/packages/backend/src/server/file/send-drive-file.ts index 1908c969a5..8bb5655b4f 100644 --- a/packages/backend/src/server/file/send-drive-file.ts +++ b/packages/backend/src/server/file/send-drive-file.ts @@ -108,7 +108,7 @@ export default async function(ctx: Koa.Context) { const { mime, ext } = await detectType(InternalStorage.resolvePath(key)); const filename = rename(file.name, { suffix: isThumbnail ? '-thumb' : '-web', - extname: ext ? `.${ext}` : undefined + extname: ext ? `.${ext}` : undefined, }).toString(); ctx.body = InternalStorage.read(key); diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 507178a46c..85fe21accb 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -43,7 +43,7 @@ if (!['production', 'test'].includes(process.env.NODE_ENV || '')) { // Delay if (envOption.slow) { app.use(slow({ - delay: 3000 + delay: 3000, })); } } @@ -74,7 +74,7 @@ router.get('/avatar/@:acct', async ctx => { const user = await Users.findOne({ usernameLower: username.toLowerCase(), host: host === config.host ? null : host, - isSuspended: false + isSuspended: false, }); if (user) { @@ -93,7 +93,7 @@ router.get('/random-avatar/:x', async ctx => { router.get('/verify-email/:code', async ctx => { const profile = await UserProfiles.findOne({ - emailVerifyCode: ctx.params.code + emailVerifyCode: ctx.params.code, }); if (profile != null) { @@ -102,12 +102,12 @@ router.get('/verify-email/:code', async ctx => { await UserProfiles.update({ userId: profile.userId }, { emailVerified: true, - emailVerifyCode: null + emailVerifyCode: null, }); publishMainStream(profile.userId, 'meUpdated', await Users.pack(profile.userId, { id: profile.userId }, { detail: true, - includeSecrets: true + includeSecrets: true, })); } else { ctx.status = 404; diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 6a864fcc52..097c6c664d 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -15,7 +15,7 @@ export const links = [/* (awaiting release) { href: config.url + nodeinfo2_1path }, */{ rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0', - href: config.url + nodeinfo2_0path + href: config.url + nodeinfo2_0path, }]; const nodeinfo2 = async () => { @@ -46,11 +46,11 @@ const nodeinfo2 = async () => { protocols: ['activitypub'], services: { inbound: [] as string[], - outbound: ['atom1.0', 'rss2.0'] + outbound: ['atom1.0', 'rss2.0'], }, openRegistrations: !meta.disableRegistration, usage: { - users: {} // { total, activeHalfyear, activeMonth }, + users: {}, // { total, activeHalfyear, activeMonth }, // localPosts, // localComments }, @@ -59,7 +59,7 @@ const nodeinfo2 = async () => { nodeDescription: meta.description, maintainer: { name: meta.maintainerName, - email: meta.maintainerEmail + email: meta.maintainerEmail, }, langs: meta.langs, tosUrl: meta.ToSUrl, @@ -78,7 +78,7 @@ const nodeinfo2 = async () => { enableEmail: meta.enableEmail, enableServiceWorker: meta.enableServiceWorker, proxyAccountName: proxyAccount ? proxyAccount.username : null, - } + }, }; }; diff --git a/packages/backend/src/server/web/feed.ts b/packages/backend/src/server/web/feed.ts index 1d4c47dafb..db589e086b 100644 --- a/packages/backend/src/server/web/feed.ts +++ b/packages/backend/src/server/web/feed.ts @@ -7,7 +7,7 @@ import { In } from 'typeorm'; export default async function(user: User) { const author = { link: `${config.url}/@${user.username}`, - name: user.name || user.username + name: user.name || user.username, }; const profile = await UserProfiles.findOneOrFail(user.id); @@ -16,10 +16,10 @@ export default async function(user: User) { where: { userId: user.id, renoteId: null, - visibility: In(['public', 'home']) + visibility: In(['public', 'home']), }, order: { createdAt: -1 }, - take: 20 + take: 20, }); const feed = new Feed({ @@ -35,12 +35,12 @@ export default async function(user: User) { atom: `${author.link}.atom`, }, author, - copyright: user.name || user.username + copyright: user.name || user.username, }); for (const note of notes) { const files = note.fileIds.length > 0 ? await DriveFiles.find({ - id: In(note.fileIds) + id: In(note.fileIds), }) : []; const file = files.find(file => file.type.startsWith('image/')); @@ -50,7 +50,7 @@ export default async function(user: User) { date: note.createdAt, description: note.cw || undefined, content: note.text || undefined, - image: file ? DriveFiles.getPublicUrl(file) || undefined : undefined + image: file ? DriveFiles.getPublicUrl(file) || undefined : undefined, }); } diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index c9d0bac630..75735badb5 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -35,8 +35,8 @@ app.use(views(_dirname + '/views', { extension: 'pug', options: { version: config.version, - config - } + config, + }, })); // Serve favicon @@ -78,7 +78,7 @@ router.get('/assets/(.*)', async ctx => { // Apple touch icon router.get('/apple-touch-icon.png', async ctx => { await send(ctx as any, '/apple-touch-icon.png', { - root: staticAssets + root: staticAssets, }); }); @@ -101,12 +101,12 @@ router.get('/twemoji/(.*)', async ctx => { // ServiceWorker router.get('/sw.js', async ctx => { await send(ctx as any, `/sw.js`, { - root: swAssets + root: swAssets, }); }); router.get(`/sw-lib.${config.version}.js`, async ctx => { await send(ctx as any, `/sw-lib.js`, { - root: swAssets + root: swAssets, }); }); @@ -115,7 +115,7 @@ router.get('/manifest.json', require('./manifest')); router.get('/robots.txt', async ctx => { await send(ctx as any, '/robots.txt', { - root: staticAssets + root: staticAssets, }); }); @@ -124,7 +124,7 @@ router.get('/robots.txt', async ctx => { // Docs router.get('/api-doc', async ctx => { await send(ctx as any, '/redoc.html', { - root: staticAssets + root: staticAssets, }); }); @@ -140,7 +140,7 @@ const getFeed = async (acct: string) => { const user = await Users.findOne({ usernameLower: username.toLowerCase(), host, - isSuspended: false + isSuspended: false, }); return user && await packFeed(user); @@ -189,7 +189,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => { const user = await Users.findOne({ usernameLower: username.toLowerCase(), host, - isSuspended: false + isSuspended: false, }); if (user != null) { @@ -205,7 +205,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => { user, profile, me, sub: ctx.params.sub, instanceName: meta.name || 'Misskey', - icon: meta.iconUrl + icon: meta.iconUrl, }); ctx.set('Cache-Control', 'public, max-age=30'); } else { @@ -219,7 +219,7 @@ router.get('/users/:user', async ctx => { const user = await Users.findOne({ id: ctx.params.user, host: null, - isSuspended: false + isSuspended: false, }); if (user == null) { @@ -244,7 +244,7 @@ router.get('/notes/:note', async (ctx, next) => { // TODO: Let locale changeable by instance setting summary: getNoteSummary(_note), instanceName: meta.name || 'Misskey', - icon: meta.iconUrl + icon: meta.iconUrl, }); if (['public', 'home'].includes(note.visibility)) { @@ -264,14 +264,14 @@ router.get('/@:user/pages/:page', async (ctx, next) => { const { username, host } = Acct.parse(ctx.params.user); const user = await Users.findOne({ usernameLower: username.toLowerCase(), - host + host, }); if (user == null) return; const page = await Pages.findOne({ name: ctx.params.page, - userId: user.id + userId: user.id, }); if (page) { @@ -281,7 +281,7 @@ router.get('/@:user/pages/:page', async (ctx, next) => { await ctx.render('page', { page: _page, profile, - instanceName: meta.name || 'Misskey' + instanceName: meta.name || 'Misskey', }); if (['public'].includes(page.visibility)) { @@ -310,7 +310,7 @@ router.get('/clips/:clip', async (ctx, next) => { await ctx.render('clip', { clip: _clip, profile, - instanceName: meta.name || 'Misskey' + instanceName: meta.name || 'Misskey', }); ctx.set('Cache-Control', 'public, max-age=180'); @@ -333,7 +333,7 @@ router.get('/gallery/:post', async (ctx, next) => { post: _post, profile, instanceName: meta.name || 'Misskey', - icon: meta.iconUrl + icon: meta.iconUrl, }); ctx.set('Cache-Control', 'public, max-age=180'); @@ -355,7 +355,7 @@ router.get('/channels/:channel', async (ctx, next) => { const meta = await fetchMeta(); await ctx.render('channel', { channel: _channel, - instanceName: meta.name || 'Misskey' + instanceName: meta.name || 'Misskey', }); ctx.set('Cache-Control', 'public, max-age=180'); @@ -377,7 +377,7 @@ router.get('/_info_card_', async ctx => { host: config.host, meta: meta, originalUsersCount: await Users.count({ host: null }), - originalNotesCount: await Notes.count({ userHost: null }) + originalNotesCount: await Notes.count({ userHost: null }), }); }); @@ -417,7 +417,7 @@ router.get('(.*)', async ctx => { title: meta.name || 'Misskey', instanceName: meta.name || 'Misskey', desc: meta.description, - icon: meta.iconUrl + icon: meta.iconUrl, }); ctx.set('Cache-Control', 'public, max-age=300'); }); diff --git a/packages/backend/src/server/web/url-preview.ts b/packages/backend/src/server/web/url-preview.ts index 1375420c0a..71465c8083 100644 --- a/packages/backend/src/server/web/url-preview.ts +++ b/packages/backend/src/server/web/url-preview.ts @@ -18,10 +18,10 @@ module.exports = async (ctx: Koa.Context) => { try { const summary = meta.summalyProxy ? await getJson(`${meta.summalyProxy}?${query({ url: ctx.query.url, - lang: ctx.query.lang || 'ja-JP' + lang: ctx.query.lang || 'ja-JP', })}`) : await summaly(ctx.query.url, { followRedirects: false, - lang: ctx.query.lang || 'ja-JP' + lang: ctx.query.lang || 'ja-JP', }); logger.succ(`Got preview of ${ctx.query.url}: ${summary.title}`); @@ -46,7 +46,7 @@ function wrap(url?: string): string | null { ? url.match(/^https?:\/\//) ? `${config.url}/proxy/preview.jpg?${query({ url, - preview: '1' + preview: '1', })}` : url : null; diff --git a/packages/backend/src/server/well-known.ts b/packages/backend/src/server/well-known.ts index 0f65f6e58c..d1f13b70bb 100644 --- a/packages/backend/src/server/well-known.ts +++ b/packages/backend/src/server/well-known.ts @@ -69,7 +69,7 @@ router.get(webFingerPath, async ctx => { const fromId = (id: User['id']): Record => ({ id, host: null, - isSuspended: false + isSuspended: false, }); const generateQuery = (resource: string) => @@ -84,7 +84,7 @@ router.get(webFingerPath, async ctx => { !acct.host || acct.host === config.host.toLowerCase() ? { usernameLower: acct.username, host: null, - isSuspended: false + isSuspended: false, } : 422; if (typeof ctx.query.resource !== 'string') { @@ -110,16 +110,16 @@ router.get(webFingerPath, async ctx => { const self = { rel: 'self', type: 'application/activity+json', - href: `${config.url}/users/${user.id}` + href: `${config.url}/users/${user.id}`, }; const profilePage = { rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', - href: `${config.url}/@${user.username}` + href: `${config.url}/@${user.username}`, }; const subscribe = { rel: 'http://ostatus.org/schema/1.0/subscribe', - template: `${config.url}/authorize-follow?acct={uri}` + template: `${config.url}/authorize-follow?acct={uri}`, }; if (ctx.accepts(jrd, xrd) === xrd) { @@ -132,7 +132,7 @@ router.get(webFingerPath, async ctx => { } else { ctx.body = { subject, - links: [self, profilePage, subscribe] + links: [self, profilePage, subscribe], }; ctx.type = jrd; } diff --git a/packages/backend/src/services/add-note-to-antenna.ts b/packages/backend/src/services/add-note-to-antenna.ts index 3aedbd2c32..168e3a614d 100644 --- a/packages/backend/src/services/add-note-to-antenna.ts +++ b/packages/backend/src/services/add-note-to-antenna.ts @@ -22,14 +22,14 @@ export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { if (!read) { const mutings = await Mutings.find({ where: { - muterId: antenna.userId + muterId: antenna.userId, }, - select: ['muteeId'] + select: ['muteeId'], }); // Copy const _note: Note = { - ...note + ...note, }; if (note.replyId != null) { diff --git a/packages/backend/src/services/blocking/create.ts b/packages/backend/src/services/blocking/create.ts index 6aadc847a9..907e4c3116 100644 --- a/packages/backend/src/services/blocking/create.ts +++ b/packages/backend/src/services/blocking/create.ts @@ -36,7 +36,7 @@ export default async function(blocker: User, blockee: User) { async function cancelRequest(follower: User, followee: User) { const request = await FollowRequests.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (request == null) { @@ -45,18 +45,18 @@ async function cancelRequest(follower: User, followee: User) { await FollowRequests.delete({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (Users.isLocalUser(followee)) { Users.pack(followee, followee, { - detail: true + detail: true, }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); } if (Users.isLocalUser(follower)) { Users.pack(followee, follower, { - detail: true + detail: true, }).then(packed => { publishUserEvent(follower.id, 'unfollow', packed); publishMainStream(follower.id, 'unfollow', packed); @@ -79,7 +79,7 @@ async function cancelRequest(follower: User, followee: User) { async function unFollow(follower: User, followee: User) { const following = await Followings.findOne({ followerId: follower.id, - followeeId: followee.id + followeeId: followee.id, }); if (following == null) { @@ -101,7 +101,7 @@ async function unFollow(follower: User, followee: User) { // Publish unfollow event if (Users.isLocalUser(follower)) { Users.pack(followee, follower, { - detail: true + detail: true, }).then(packed => { publishUserEvent(follower.id, 'unfollow', packed); publishMainStream(follower.id, 'unfollow', packed); diff --git a/packages/backend/src/services/blocking/delete.ts b/packages/backend/src/services/blocking/delete.ts index de7efb1558..271bf4854a 100644 --- a/packages/backend/src/services/blocking/delete.ts +++ b/packages/backend/src/services/blocking/delete.ts @@ -11,7 +11,7 @@ const logger = new Logger('blocking/delete'); export default async function(blocker: User, blockee: User) { const blocking = await Blockings.findOne({ blockerId: blocker.id, - blockeeId: blockee.id + blockeeId: blockee.id, }); if (blocking == null) { diff --git a/packages/backend/src/services/chart/charts/classes/active-users.ts b/packages/backend/src/services/chart/charts/classes/active-users.ts index f80d8a3322..029e93a391 100644 --- a/packages/backend/src/services/chart/charts/classes/active-users.ts +++ b/packages/backend/src/services/chart/charts/classes/active-users.ts @@ -37,11 +37,11 @@ export default class ActiveUsersChart extends Chart { @autobind public async update(user: { id: User['id'], host: User['host'] }) { const update: Obj = { - users: [user.id] + users: [user.id], }; await this.inc({ - [Users.isLocalUser(user) ? 'local' : 'remote']: update + [Users.isLocalUser(user) ? 'local' : 'remote']: update, }); } } diff --git a/packages/backend/src/services/chart/charts/classes/drive.ts b/packages/backend/src/services/chart/charts/classes/drive.ts index 93eabf3096..2ed8e7fad1 100644 --- a/packages/backend/src/services/chart/charts/classes/drive.ts +++ b/packages/backend/src/services/chart/charts/classes/drive.ts @@ -23,7 +23,7 @@ export default class DriveChart extends Chart { remote: { totalCount: latest.remote.totalCount, totalSize: latest.remote.totalSize, - } + }, }; } @@ -55,7 +55,7 @@ export default class DriveChart extends Chart { DriveFiles.count({ userHost: null }), DriveFiles.count({ userHost: Not(IsNull()) }), DriveFiles.calcDriveUsageOfLocal(), - DriveFiles.calcDriveUsageOfRemote() + DriveFiles.calcDriveUsageOfRemote(), ]); return { @@ -66,7 +66,7 @@ export default class DriveChart extends Chart { remote: { totalCount: remoteCount, totalSize: remoteSize, - } + }, }; } @@ -85,7 +85,7 @@ export default class DriveChart extends Chart { } await this.inc({ - [file.userHost === null ? 'local' : 'remote']: update + [file.userHost === null ? 'local' : 'remote']: update, }); } } diff --git a/packages/backend/src/services/chart/charts/classes/federation.ts b/packages/backend/src/services/chart/charts/classes/federation.ts index 5f918b294f..9f8b7ec0ae 100644 --- a/packages/backend/src/services/chart/charts/classes/federation.ts +++ b/packages/backend/src/services/chart/charts/classes/federation.ts @@ -16,7 +16,7 @@ export default class FederationChart extends Chart { return { instance: { total: latest.instance.total, - } + }, }; } @@ -34,13 +34,13 @@ export default class FederationChart extends Chart { @autobind protected async fetchActual(): Promise> { const [total] = await Promise.all([ - Instances.count({}) + Instances.count({}), ]); return { instance: { total: total, - } + }, }; } @@ -56,7 +56,7 @@ export default class FederationChart extends Chart { } await this.inc({ - instance: update + instance: update, }); } } diff --git a/packages/backend/src/services/chart/charts/classes/hashtag.ts b/packages/backend/src/services/chart/charts/classes/hashtag.ts index f7f5e17dec..53774e566d 100644 --- a/packages/backend/src/services/chart/charts/classes/hashtag.ts +++ b/packages/backend/src/services/chart/charts/classes/hashtag.ts @@ -37,11 +37,11 @@ export default class HashtagChart extends Chart { @autobind public async update(hashtag: string, user: { id: User['id'], host: User['host'] }) { const update: Obj = { - users: [user.id] + users: [user.id], }; await this.inc({ - [Users.isLocalUser(user) ? 'local' : 'remote']: update + [Users.isLocalUser(user) ? 'local' : 'remote']: update, }, hashtag); } } diff --git a/packages/backend/src/services/chart/charts/classes/instance.ts b/packages/backend/src/services/chart/charts/classes/instance.ts index 1032de7bc0..8e7902d163 100644 --- a/packages/backend/src/services/chart/charts/classes/instance.ts +++ b/packages/backend/src/services/chart/charts/classes/instance.ts @@ -32,7 +32,7 @@ export default class InstanceChart extends Chart { drive: { totalFiles: latest.drive.totalFiles, totalUsage: latest.drive.totalUsage, - } + }, }; } @@ -114,7 +114,7 @@ export default class InstanceChart extends Chart { drive: { totalFiles: driveFiles, totalUsage: driveUsage, - } + }, }; } @@ -122,8 +122,8 @@ export default class InstanceChart extends Chart { public async requestReceived(host: string) { await this.inc({ requests: { - received: 1 - } + received: 1, + }, }, toPuny(host)); } @@ -138,7 +138,7 @@ export default class InstanceChart extends Chart { } await this.inc({ - requests: update + requests: update, }, toPuny(host)); } @@ -147,8 +147,8 @@ export default class InstanceChart extends Chart { await this.inc({ users: { total: 1, - inc: 1 - } + inc: 1, + }, }, toPuny(host)); } @@ -169,8 +169,8 @@ export default class InstanceChart extends Chart { total: isAdditional ? 1 : -1, inc: isAdditional ? 1 : 0, dec: isAdditional ? 0 : 1, - diffs: diffs - } + diffs: diffs, + }, }, toPuny(host)); } @@ -181,7 +181,7 @@ export default class InstanceChart extends Chart { total: isAdditional ? 1 : -1, inc: isAdditional ? 1 : 0, dec: isAdditional ? 0 : 1, - } + }, }, toPuny(host)); } @@ -192,7 +192,7 @@ export default class InstanceChart extends Chart { total: isAdditional ? 1 : -1, inc: isAdditional ? 1 : 0, dec: isAdditional ? 0 : 1, - } + }, }, toPuny(host)); } @@ -211,7 +211,7 @@ export default class InstanceChart extends Chart { } await this.inc({ - drive: update + drive: update, }, file.userHost); } } diff --git a/packages/backend/src/services/chart/charts/classes/network.ts b/packages/backend/src/services/chart/charts/classes/network.ts index 2ce75e0b34..838eec4916 100644 --- a/packages/backend/src/services/chart/charts/classes/network.ts +++ b/packages/backend/src/services/chart/charts/classes/network.ts @@ -37,7 +37,7 @@ export default class NetworkChart extends Chart { incomingRequests: incomingRequests, totalTime: time, incomingBytes: incomingBytes, - outgoingBytes: outgoingBytes + outgoingBytes: outgoingBytes, }; await this.inc(inc); diff --git a/packages/backend/src/services/chart/charts/classes/notes.ts b/packages/backend/src/services/chart/charts/classes/notes.ts index 0675d346d1..f8a580b3c0 100644 --- a/packages/backend/src/services/chart/charts/classes/notes.ts +++ b/packages/backend/src/services/chart/charts/classes/notes.ts @@ -21,7 +21,7 @@ export default class NotesChart extends Chart { }, remote: { total: latest.remote.total, - } + }, }; } @@ -55,7 +55,7 @@ export default class NotesChart extends Chart { protected async fetchActual(): Promise> { const [localCount, remoteCount] = await Promise.all([ Notes.count({ userHost: null }), - Notes.count({ userHost: Not(IsNull()) }) + Notes.count({ userHost: Not(IsNull()) }), ]); return { @@ -64,14 +64,14 @@ export default class NotesChart extends Chart { }, remote: { total: remoteCount, - } + }, }; } @autobind public async update(note: Note, isAdditional: boolean) { const update: Obj = { - diffs: {} + diffs: {}, }; update.total = isAdditional ? 1 : -1; @@ -91,7 +91,7 @@ export default class NotesChart extends Chart { } await this.inc({ - [note.userHost === null ? 'local' : 'remote']: update + [note.userHost === null ? 'local' : 'remote']: update, }); } } diff --git a/packages/backend/src/services/chart/charts/classes/per-user-drive.ts b/packages/backend/src/services/chart/charts/classes/per-user-drive.ts index f28987191b..33d49d9ebb 100644 --- a/packages/backend/src/services/chart/charts/classes/per-user-drive.ts +++ b/packages/backend/src/services/chart/charts/classes/per-user-drive.ts @@ -36,7 +36,7 @@ export default class PerUserDriveChart extends Chart { protected async fetchActual(group: string): Promise> { const [count, size] = await Promise.all([ DriveFiles.count({ userId: group }), - DriveFiles.calcDriveUsageOf(group) + DriveFiles.calcDriveUsageOf(group), ]); return { diff --git a/packages/backend/src/services/chart/charts/classes/per-user-following.ts b/packages/backend/src/services/chart/charts/classes/per-user-following.ts index 08a9ad1d2b..67b623057d 100644 --- a/packages/backend/src/services/chart/charts/classes/per-user-following.ts +++ b/packages/backend/src/services/chart/charts/classes/per-user-following.ts @@ -22,7 +22,7 @@ export default class PerUserFollowingChart extends Chart { }, followers: { total: latest.local.followers.total, - } + }, }, remote: { followings: { @@ -30,8 +30,8 @@ export default class PerUserFollowingChart extends Chart { }, followers: { total: latest.remote.followers.total, - } - } + }, + }, }; } @@ -71,12 +71,12 @@ export default class PerUserFollowingChart extends Chart { localFollowingsCount, localFollowersCount, remoteFollowingsCount, - remoteFollowersCount + remoteFollowersCount, ] = await Promise.all([ Followings.count({ followerId: group, followeeHost: null }), Followings.count({ followeeId: group, followerHost: null }), Followings.count({ followerId: group, followeeHost: Not(IsNull()) }), - Followings.count({ followeeId: group, followerHost: Not(IsNull()) }) + Followings.count({ followeeId: group, followerHost: Not(IsNull()) }), ]); return { @@ -86,7 +86,7 @@ export default class PerUserFollowingChart extends Chart { }, followers: { total: localFollowersCount, - } + }, }, remote: { followings: { @@ -94,8 +94,8 @@ export default class PerUserFollowingChart extends Chart { }, followers: { total: remoteFollowersCount, - } - } + }, + }, }; } @@ -112,10 +112,10 @@ export default class PerUserFollowingChart extends Chart { } this.inc({ - [Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update } + [Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update }, }, follower.id); this.inc({ - [Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update } + [Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update }, }, followee.id); } } diff --git a/packages/backend/src/services/chart/charts/classes/per-user-notes.ts b/packages/backend/src/services/chart/charts/classes/per-user-notes.ts index 0e808766f5..94760c0492 100644 --- a/packages/backend/src/services/chart/charts/classes/per-user-notes.ts +++ b/packages/backend/src/services/chart/charts/classes/per-user-notes.ts @@ -48,7 +48,7 @@ export default class PerUserNotesChart extends Chart { @autobind public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean) { const update: Obj = { - diffs: {} + diffs: {}, }; update.total = isAdditional ? 1 : -1; diff --git a/packages/backend/src/services/chart/charts/classes/per-user-reactions.ts b/packages/backend/src/services/chart/charts/classes/per-user-reactions.ts index e71bcb71c4..62508eacdf 100644 --- a/packages/backend/src/services/chart/charts/classes/per-user-reactions.ts +++ b/packages/backend/src/services/chart/charts/classes/per-user-reactions.ts @@ -38,7 +38,7 @@ export default class PerUserReactionsChart extends Chart { @autobind public async update(user: { id: User['id'], host: User['host'] }, note: Note) { this.inc({ - [Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 } + [Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 }, }, note.userId); } } diff --git a/packages/backend/src/services/chart/charts/classes/test-grouped.ts b/packages/backend/src/services/chart/charts/classes/test-grouped.ts index 84e6d5e33f..2b11930af2 100644 --- a/packages/backend/src/services/chart/charts/classes/test-grouped.ts +++ b/packages/backend/src/services/chart/charts/classes/test-grouped.ts @@ -52,7 +52,7 @@ export default class TestGroupedChart extends Chart { this.total[group]++; await this.inc({ - foo: update + foo: update, }, group); } } diff --git a/packages/backend/src/services/chart/charts/classes/test-unique.ts b/packages/backend/src/services/chart/charts/classes/test-unique.ts index 559fda13c9..f8655804d4 100644 --- a/packages/backend/src/services/chart/charts/classes/test-unique.ts +++ b/packages/backend/src/services/chart/charts/classes/test-unique.ts @@ -30,7 +30,7 @@ export default class TestUniqueChart extends Chart { @autobind public async uniqueIncrement(key: string) { await this.inc({ - foo: [key] + foo: [key], }); } } diff --git a/packages/backend/src/services/chart/charts/classes/test.ts b/packages/backend/src/services/chart/charts/classes/test.ts index a91d5e1895..b3f6b76a44 100644 --- a/packages/backend/src/services/chart/charts/classes/test.ts +++ b/packages/backend/src/services/chart/charts/classes/test.ts @@ -50,7 +50,7 @@ export default class TestChart extends Chart { this.total++; await this.inc({ - foo: update + foo: update, }); } @@ -63,7 +63,7 @@ export default class TestChart extends Chart { this.total--; await this.inc({ - foo: update + foo: update, }); } } diff --git a/packages/backend/src/services/chart/charts/classes/users.ts b/packages/backend/src/services/chart/charts/classes/users.ts index 89b480ef77..6762410abf 100644 --- a/packages/backend/src/services/chart/charts/classes/users.ts +++ b/packages/backend/src/services/chart/charts/classes/users.ts @@ -21,7 +21,7 @@ export default class UsersChart extends Chart { }, remote: { total: latest.remote.total, - } + }, }; } @@ -45,7 +45,7 @@ export default class UsersChart extends Chart { protected async fetchActual(): Promise> { const [localCount, remoteCount] = await Promise.all([ Users.count({ host: null }), - Users.count({ host: Not(IsNull()) }) + Users.count({ host: Not(IsNull()) }), ]); return { @@ -54,7 +54,7 @@ export default class UsersChart extends Chart { }, remote: { total: remoteCount, - } + }, }; } @@ -70,7 +70,7 @@ export default class UsersChart extends Chart { } await this.inc({ - [Users.isLocalUser(user) ? 'local' : 'remote']: update + [Users.isLocalUser(user) ? 'local' : 'remote']: update, }); } } diff --git a/packages/backend/src/services/chart/charts/schemas/active-users.ts b/packages/backend/src/services/chart/charts/schemas/active-users.ts index 1d65f280b0..322fdb8691 100644 --- a/packages/backend/src/services/chart/charts/schemas/active-users.ts +++ b/packages/backend/src/services/chart/charts/schemas/active-users.ts @@ -8,7 +8,7 @@ export const logSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } + }, }, }; @@ -22,14 +22,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'activeUsers'; diff --git a/packages/backend/src/services/chart/charts/schemas/drive.ts b/packages/backend/src/services/chart/charts/schemas/drive.ts index 133b47846a..e7d3267931 100644 --- a/packages/backend/src/services/chart/charts/schemas/drive.ts +++ b/packages/backend/src/services/chart/charts/schemas/drive.ts @@ -55,14 +55,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'drive'; diff --git a/packages/backend/src/services/chart/charts/schemas/federation.ts b/packages/backend/src/services/chart/charts/schemas/federation.ts index dca4587cac..1b8bbce0a8 100644 --- a/packages/backend/src/services/chart/charts/schemas/federation.ts +++ b/packages/backend/src/services/chart/charts/schemas/federation.ts @@ -21,9 +21,9 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } - } - } + }, + }, + }, }; export const name = 'federation'; diff --git a/packages/backend/src/services/chart/charts/schemas/hashtag.ts b/packages/backend/src/services/chart/charts/schemas/hashtag.ts index 4e7c542bbc..6b4eca2978 100644 --- a/packages/backend/src/services/chart/charts/schemas/hashtag.ts +++ b/packages/backend/src/services/chart/charts/schemas/hashtag.ts @@ -8,7 +8,7 @@ export const logSchema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } + }, }, }; @@ -22,14 +22,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'hashtag'; diff --git a/packages/backend/src/services/chart/charts/schemas/instance.ts b/packages/backend/src/services/chart/charts/schemas/instance.ts index 785d6ae7ce..5f17ac0d11 100644 --- a/packages/backend/src/services/chart/charts/schemas/instance.ts +++ b/packages/backend/src/services/chart/charts/schemas/instance.ts @@ -21,7 +21,7 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, notes: { @@ -59,9 +59,9 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, - } + }, }, users: { @@ -80,7 +80,7 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, following: { @@ -99,7 +99,7 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, followers: { @@ -118,7 +118,7 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, drive: { @@ -149,9 +149,9 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, - } + }, }; export const name = 'instance'; diff --git a/packages/backend/src/services/chart/charts/schemas/network.ts b/packages/backend/src/services/chart/charts/schemas/network.ts index 49a364debc..1aeb2a8ad5 100644 --- a/packages/backend/src/services/chart/charts/schemas/network.ts +++ b/packages/backend/src/services/chart/charts/schemas/network.ts @@ -25,7 +25,7 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }; export const name = 'network'; diff --git a/packages/backend/src/services/chart/charts/schemas/notes.ts b/packages/backend/src/services/chart/charts/schemas/notes.ts index 2b5105348c..a33e7aa8b9 100644 --- a/packages/backend/src/services/chart/charts/schemas/notes.ts +++ b/packages/backend/src/services/chart/charts/schemas/notes.ts @@ -32,7 +32,7 @@ const logSchema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, }; @@ -43,14 +43,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'notes'; diff --git a/packages/backend/src/services/chart/charts/schemas/per-user-drive.ts b/packages/backend/src/services/chart/charts/schemas/per-user-drive.ts index 856f1e0439..1c7c57afda 100644 --- a/packages/backend/src/services/chart/charts/schemas/per-user-drive.ts +++ b/packages/backend/src/services/chart/charts/schemas/per-user-drive.ts @@ -49,7 +49,7 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }; export const name = 'perUserDrive'; diff --git a/packages/backend/src/services/chart/charts/schemas/per-user-following.ts b/packages/backend/src/services/chart/charts/schemas/per-user-following.ts index eaf74aaf77..9e7e71f3bb 100644 --- a/packages/backend/src/services/chart/charts/schemas/per-user-following.ts +++ b/packages/backend/src/services/chart/charts/schemas/per-user-following.ts @@ -29,7 +29,7 @@ export const logSchema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, /** @@ -62,7 +62,7 @@ export const logSchema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, }; @@ -73,14 +73,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'perUserFollowing'; diff --git a/packages/backend/src/services/chart/charts/schemas/per-user-notes.ts b/packages/backend/src/services/chart/charts/schemas/per-user-notes.ts index 72b3ff0210..55b4ff40c0 100644 --- a/packages/backend/src/services/chart/charts/schemas/per-user-notes.ts +++ b/packages/backend/src/services/chart/charts/schemas/per-user-notes.ts @@ -35,9 +35,9 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } + }, }, - } + }, }; export const name = 'perUserNotes'; diff --git a/packages/backend/src/services/chart/charts/schemas/per-user-reactions.ts b/packages/backend/src/services/chart/charts/schemas/per-user-reactions.ts index 2a8520db37..9af6c3cd54 100644 --- a/packages/backend/src/services/chart/charts/schemas/per-user-reactions.ts +++ b/packages/backend/src/services/chart/charts/schemas/per-user-reactions.ts @@ -18,14 +18,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'perUserReaction'; diff --git a/packages/backend/src/services/chart/charts/schemas/test-grouped.ts b/packages/backend/src/services/chart/charts/schemas/test-grouped.ts index f8c8250e79..c2f2e7e886 100644 --- a/packages/backend/src/services/chart/charts/schemas/test-grouped.ts +++ b/packages/backend/src/services/chart/charts/schemas/test-grouped.ts @@ -20,9 +20,9 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } - } - } + }, + }, + }, }; export const name = 'testGrouped'; diff --git a/packages/backend/src/services/chart/charts/schemas/test-unique.ts b/packages/backend/src/services/chart/charts/schemas/test-unique.ts index 51280400ac..b8da60dc53 100644 --- a/packages/backend/src/services/chart/charts/schemas/test-unique.ts +++ b/packages/backend/src/services/chart/charts/schemas/test-unique.ts @@ -8,9 +8,9 @@ export const schema = { items: { type: 'string' as const, optional: false as const, nullable: false as const, - } + }, }, - } + }, }; export const name = 'testUnique'; diff --git a/packages/backend/src/services/chart/charts/schemas/test.ts b/packages/backend/src/services/chart/charts/schemas/test.ts index 4b48d4d417..19c732fece 100644 --- a/packages/backend/src/services/chart/charts/schemas/test.ts +++ b/packages/backend/src/services/chart/charts/schemas/test.ts @@ -20,9 +20,9 @@ export const schema = { type: 'number' as const, optional: false as const, nullable: false as const, }, - } - } - } + }, + }, + }, }; export const name = 'test'; diff --git a/packages/backend/src/services/chart/charts/schemas/users.ts b/packages/backend/src/services/chart/charts/schemas/users.ts index 2bf9d3c50f..47e7791974 100644 --- a/packages/backend/src/services/chart/charts/schemas/users.ts +++ b/packages/backend/src/services/chart/charts/schemas/users.ts @@ -31,14 +31,14 @@ export const schema = { local: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, remote: { type: 'object' as const, optional: false as const, nullable: false as const, - properties: logSchema + properties: logSchema, }, - } + }, }; export const name = 'users'; diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index 78b7dd1359..59149dbc08 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -188,7 +188,7 @@ export default abstract class Chart> { id: { type: 'integer', primary: true, - generated: true + generated: true, }, date: { type: 'integer', @@ -196,9 +196,9 @@ export default abstract class Chart> { group: { type: 'varchar', length: 128, - nullable: true + nullable: true, }, - ...Chart.convertSchemaToFlatColumnDefinitions(schema) + ...Chart.convertSchemaToFlatColumnDefinitions(schema), }, indices: [{ columns: ['date', 'group'], @@ -206,8 +206,8 @@ export default abstract class Chart> { }, { // groupにnullが含まれると↑のuniqueは機能しないので↓の部分インデックスでカバー columns: ['date'], unique: true, - where: '"group" IS NULL' - }] + where: '"group" IS NULL', + }], }); } @@ -220,7 +220,7 @@ export default abstract class Chart> { if (grouped) keys.push('group'); entity.options.uniques = [{ - columns: keys + columns: keys, }]; this.repository = getRepository(entity); @@ -252,8 +252,8 @@ export default abstract class Chart> { group: group, }, { order: { - date: -1 - } + date: -1, + }, }).then(x => x || null); } @@ -266,7 +266,7 @@ export default abstract class Chart> { // 現在(=今のHour)のログ const currentLog = await this.repository.findOne({ date: Chart.dateToTimestamp(current), - ...(group ? { group: group } : {}) + ...(group ? { group: group } : {}), }); // ログがあればそれを返して終了 @@ -308,7 +308,7 @@ export default abstract class Chart> { // ロック内でもう1回チェックする const currentLog = await this.repository.findOne({ date: date, - ...(group ? { group: group } : {}) + ...(group ? { group: group } : {}), }); // ログがあればそれを返して終了 @@ -318,7 +318,7 @@ export default abstract class Chart> { log = await this.repository.insert({ group: group, date: date, - ...Chart.convertObjectToFlattenColumns(data) + ...Chart.convertObjectToFlattenColumns(data), }).then(x => this.repository.findOneOrFail(x.identifiers[0])); logger.info(`${this.name + (group ? `:${group}` : '')}: New commit created`); @@ -424,10 +424,10 @@ export default abstract class Chart> { let logs = await this.repository.find({ where: { group: group, - date: Between(Chart.dateToTimestamp(gt), Chart.dateToTimestamp(lt)) + date: Between(Chart.dateToTimestamp(gt), Chart.dateToTimestamp(lt)), }, order: { - date: -1 + date: -1, }, }); @@ -439,7 +439,7 @@ export default abstract class Chart> { group: group, }, { order: { - date: -1 + date: -1, }, }); @@ -453,10 +453,10 @@ export default abstract class Chart> { // (隙間埋めできないため) const outdatedLog = await this.repository.findOne({ group: group, - date: LessThan(Chart.dateToTimestamp(gt)) + date: LessThan(Chart.dateToTimestamp(gt)), }, { order: { - date: -1 + date: -1, }, }); diff --git a/packages/backend/src/services/chart/entities.ts b/packages/backend/src/services/chart/entities.ts index 23a97607eb..9d96a8a7ee 100644 --- a/packages/backend/src/services/chart/entities.ts +++ b/packages/backend/src/services/chart/entities.ts @@ -11,5 +11,5 @@ export const entities = Object.values(require('require-all')({ filter: /^.+\.[jt]s$/, resolve: (x: any) => { return Chart.schemaToEntity(x.name, x.schema); - } + }, })); diff --git a/packages/backend/src/services/create-notification.ts b/packages/backend/src/services/create-notification.ts index 9c50bacde7..72e3d03752 100644 --- a/packages/backend/src/services/create-notification.ts +++ b/packages/backend/src/services/create-notification.ts @@ -27,7 +27,7 @@ export async function createNotification( type: type, // 相手がこの通知をミュートしているようなら、既読を予めつけておく isRead: isMuted, - ...data + ...data, } as Partial); const packed = await Notifications.pack(notification, {}); @@ -43,7 +43,7 @@ export async function createNotification( //#region ただしミュートしているユーザーからの通知なら無視 const mutings = await Mutings.find({ - muterId: notifieeId + muterId: notifieeId, }); if (data.notifierId && mutings.map(m => m.muteeId).includes(data.notifierId)) { return; diff --git a/packages/backend/src/services/create-system-user.ts b/packages/backend/src/services/create-system-user.ts index 71be8d4abf..82130dd593 100644 --- a/packages/backend/src/services/create-system-user.ts +++ b/packages/backend/src/services/create-system-user.ts @@ -27,7 +27,7 @@ export async function createSystemUser(username: string) { await getConnection().transaction(async transactionalEntityManager => { const exist = await transactionalEntityManager.findOne(User, { usernameLower: username.toLowerCase(), - host: null + host: null, }); if (exist) throw new Error('the user is already exists'); @@ -48,7 +48,7 @@ export async function createSystemUser(username: string) { await transactionalEntityManager.insert(UserKeypair, { publicKey: keyPair.publicKey, privateKey: keyPair.privateKey, - userId: account.id + userId: account.id, }); await transactionalEntityManager.insert(UserProfile, { diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index a57f9cf068..ee4d51a96d 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -66,7 +66,7 @@ async function save(file: DriveFile, path: string, name: string, type: string, h //#region Uploads logger.info(`uploading original: ${key}`); const uploads = [ - upload(key, fs.createReadStream(path), type, name) + upload(key, fs.createReadStream(path), type, name), ]; if (alts.webpublic) { @@ -149,13 +149,13 @@ export async function generateAlts(path: string, type: string, generateWeb: bool const thumbnail = await GenerateVideoThumbnail(path); return { webpublic: null, - thumbnail + thumbnail, }; } catch (e) { logger.warn(`GenerateVideoThumbnail failed: ${e}`); return { webpublic: null, - thumbnail: null + thumbnail: null, }; } } @@ -164,7 +164,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool logger.debug(`web image and thumbnail not created (not an required file)`); return { webpublic: null, - thumbnail: null + thumbnail: null, }; } @@ -179,14 +179,14 @@ export async function generateAlts(path: string, type: string, generateWeb: bool if (isAnimated) { return { webpublic: null, - thumbnail: null + thumbnail: null, }; } } catch (e) { logger.warn(`sharp failed: ${e}`); return { webpublic: null, - thumbnail: null + thumbnail: null, }; } @@ -258,7 +258,7 @@ async function upload(key: string, stream: fs.ReadStream | Buffer, type: string, const s3 = getS3(meta); const upload = s3.upload(params, { - partSize: s3.endpoint?.hostname === 'storage.googleapis.com' ? 500 * 1024 * 1024 : 8 * 1024 * 1024 + partSize: s3.endpoint?.hostname === 'storage.googleapis.com' ? 500 * 1024 * 1024 : 8 * 1024 * 1024, }); const result = await upload.promise(); @@ -361,7 +361,7 @@ export default async function( const driveFolder = await DriveFolders.findOne({ id: folderId, - userId: user ? user.id : null + userId: user ? user.id : null, }); if (driveFolder == null) throw new Error('folder-not-found'); @@ -436,7 +436,7 @@ export default async function( file = await DriveFiles.findOne({ uri: file.uri, - userId: user ? user.id : null + userId: user ? user.id : null, }) as DriveFile; } else { logger.error(e); diff --git a/packages/backend/src/services/drive/delete-file.ts b/packages/backend/src/services/drive/delete-file.ts index 2ac11b8295..5cda32c7d5 100644 --- a/packages/backend/src/services/drive/delete-file.ts +++ b/packages/backend/src/services/drive/delete-file.ts @@ -98,6 +98,6 @@ export async function deleteObjectStorageFile(key: string) { await s3.deleteObject({ Bucket: meta.objectStorageBucket!, - Key: key + Key: key, }).promise(); } diff --git a/packages/backend/src/services/drive/generate-video-thumbnail.ts b/packages/backend/src/services/drive/generate-video-thumbnail.ts index f0adc7c338..e8cc952b9a 100644 --- a/packages/backend/src/services/drive/generate-video-thumbnail.ts +++ b/packages/backend/src/services/drive/generate-video-thumbnail.ts @@ -13,7 +13,7 @@ export async function GenerateVideoThumbnail(path: string): Promise { await new Promise((res, rej) => { FFmpeg({ - source: path + source: path, }) .on('end', res) .on('error', rej) @@ -21,7 +21,7 @@ export async function GenerateVideoThumbnail(path: string): Promise { folder: outDir, filename: 'output.png', count: 1, - timestamps: ['5%'] + timestamps: ['5%'], }); }); diff --git a/packages/backend/src/services/drive/image-processor.ts b/packages/backend/src/services/drive/image-processor.ts index 493bf5c1cc..f3c4a2abd9 100644 --- a/packages/backend/src/services/drive/image-processor.ts +++ b/packages/backend/src/services/drive/image-processor.ts @@ -18,19 +18,19 @@ export async function convertSharpToJpeg(sharp: sharp.Sharp, width: number, heig const data = await sharp .resize(width, height, { fit: 'inside', - withoutEnlargement: true + withoutEnlargement: true, }) .rotate() .jpeg({ quality: 85, - progressive: true + progressive: true, }) .toBuffer(); return { data, ext: 'jpg', - type: 'image/jpeg' + type: 'image/jpeg', }; } @@ -46,18 +46,18 @@ export async function convertSharpToWebp(sharp: sharp.Sharp, width: number, heig const data = await sharp .resize(width, height, { fit: 'inside', - withoutEnlargement: true + withoutEnlargement: true, }) .rotate() .webp({ - quality: 85 + quality: 85, }) .toBuffer(); return { data, ext: 'webp', - type: 'image/webp' + type: 'image/webp', }; } @@ -73,7 +73,7 @@ export async function convertSharpToPng(sharp: sharp.Sharp, width: number, heigh const data = await sharp .resize(width, height, { fit: 'inside', - withoutEnlargement: true + withoutEnlargement: true, }) .rotate() .png() @@ -82,7 +82,7 @@ export async function convertSharpToPng(sharp: sharp.Sharp, width: number, heigh return { data, ext: 'png', - type: 'image/png' + type: 'image/png', }; } diff --git a/packages/backend/src/services/drive/s3.ts b/packages/backend/src/services/drive/s3.ts index f473c4a203..42bf6e187c 100644 --- a/packages/backend/src/services/drive/s3.ts +++ b/packages/backend/src/services/drive/s3.ts @@ -18,7 +18,7 @@ export function getS3(meta: Meta) { ? false : meta.objectStorageS3ForcePathStyle, httpOptions: { - agent: getAgentByUrl(new URL(u), !meta.objectStorageUseProxy) - } + agent: getAgentByUrl(new URL(u), !meta.objectStorageUseProxy), + }, }); } diff --git a/packages/backend/src/services/drive/upload-from-url.ts b/packages/backend/src/services/drive/upload-from-url.ts index 29788c4af4..28f42bc344 100644 --- a/packages/backend/src/services/drive/upload-from-url.ts +++ b/packages/backend/src/services/drive/upload-from-url.ts @@ -47,7 +47,7 @@ export default async ( error = e; logger.error(`Failed to create drive file: ${e}`, { url: url, - e: e + e: e, }); } diff --git a/packages/backend/src/services/following/create.ts b/packages/backend/src/services/following/create.ts index 4d0754b504..45bd226588 100644 --- a/packages/backend/src/services/following/create.ts +++ b/packages/backend/src/services/following/create.ts @@ -34,7 +34,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[ followerSharedInbox: Users.isRemoteUser(follower) ? follower.sharedInbox : null, followeeHost: followee.host, followeeInbox: Users.isRemoteUser(followee) ? followee.inbox : null, - followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : null + followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : null, }).catch(e => { if (isDuplicateKeyValueError(e) && Users.isRemoteUser(follower) && Users.isLocalUser(followee)) { logger.info(`Insert duplicated ignore. ${follower.id} => ${followee.id}`); @@ -46,13 +46,13 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[ const req = await FollowRequests.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (req) { await FollowRequests.delete({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); // 通知を作成 @@ -87,7 +87,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[ // Publish follow event if (Users.isLocalUser(follower)) { Users.pack(followee.id, follower, { - detail: true + detail: true, }).then(packed => { publishUserEvent(follower.id, 'follow', packed); publishMainStream(follower.id, 'follow', packed); @@ -100,7 +100,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[ // 通知を作成 createNotification(followee.id, 'follow', { - notifierId: follower.id + notifierId: follower.id, }); } } @@ -108,7 +108,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[ export default async function(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string) { const [follower, followee] = await Promise.all([ Users.findOneOrFail(_follower.id), - Users.findOneOrFail(_followee.id) + Users.findOneOrFail(_followee.id), ]); // check blocking @@ -120,7 +120,7 @@ export default async function(_follower: { id: User['id'] }, _followee: { id: Us Blockings.findOne({ blockerId: followee.id, blockeeId: follower.id, - }) + }), ]); if (Users.isRemoteUser(follower) && Users.isLocalUser(followee) && blocked) { @@ -159,7 +159,7 @@ export default async function(_follower: { id: User['id'] }, _followee: { id: Us if (!autoAccept && (Users.isLocalUser(followee) && followeeProfile.autoAcceptFollowed)) { const followed = await Followings.findOne({ followerId: followee.id, - followeeId: follower.id + followeeId: follower.id, }); if (followed) autoAccept = true; diff --git a/packages/backend/src/services/following/delete.ts b/packages/backend/src/services/following/delete.ts index ea612147df..9b7d72e86d 100644 --- a/packages/backend/src/services/following/delete.ts +++ b/packages/backend/src/services/following/delete.ts @@ -15,7 +15,7 @@ const logger = new Logger('following/delete'); export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, silent = false) { const following = await Followings.findOne({ followerId: follower.id, - followeeId: followee.id + followeeId: followee.id, }); if (following == null) { @@ -30,7 +30,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur // Publish unfollow event if (!silent && Users.isLocalUser(follower)) { Users.pack(followee.id, follower, { - detail: true + detail: true, }).then(packed => { publishUserEvent(follower.id, 'unfollow', packed); publishMainStream(follower.id, 'unfollow', packed); diff --git a/packages/backend/src/services/following/reject.ts b/packages/backend/src/services/following/reject.ts index 0ec4d7d00c..1deabea4f8 100644 --- a/packages/backend/src/services/following/reject.ts +++ b/packages/backend/src/services/following/reject.ts @@ -56,7 +56,7 @@ export async function remoteReject(actor: Remote, follower: Local) { async function removeFollowRequest(followee: Both, follower: Both) { const request = await FollowRequests.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (!request) return; @@ -70,7 +70,7 @@ async function removeFollowRequest(followee: Both, follower: Both) { async function removeFollow(followee: Both, follower: Both) { const following = await Followings.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (!following) return; @@ -85,7 +85,7 @@ async function removeFollow(followee: Both, follower: Both) { async function deliverReject(followee: Local, follower: Remote) { const request = await FollowRequests.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); const content = renderActivity(renderReject(renderFollow(follower, followee, request?.requestId || undefined), followee)); @@ -97,7 +97,7 @@ async function deliverReject(followee: Local, follower: Remote) { */ async function publishUnfollow(followee: Both, follower: Local) { const packedFollowee = await Users.pack(followee.id, follower, { - detail: true + detail: true, }); publishUserEvent(follower.id, 'unfollow', packedFollowee); diff --git a/packages/backend/src/services/following/requests/accept-all.ts b/packages/backend/src/services/following/requests/accept-all.ts index 23b4fd0a46..06ff835c02 100644 --- a/packages/backend/src/services/following/requests/accept-all.ts +++ b/packages/backend/src/services/following/requests/accept-all.ts @@ -8,7 +8,7 @@ import { FollowRequests, Users } from '@/models/index'; */ export default async function(user: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }) { const requests = await FollowRequests.find({ - followeeId: user.id + followeeId: user.id, }); for (const request of requests) { diff --git a/packages/backend/src/services/following/requests/accept.ts b/packages/backend/src/services/following/requests/accept.ts index 316a6f1c12..fcda49758e 100644 --- a/packages/backend/src/services/following/requests/accept.ts +++ b/packages/backend/src/services/following/requests/accept.ts @@ -11,7 +11,7 @@ import { IdentifiableError } from '@/misc/identifiable-error'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: User) { const request = await FollowRequests.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (request == null) { @@ -26,6 +26,6 @@ export default async function(followee: { id: User['id']; host: User['host']; ur } Users.pack(followee.id, followee, { - detail: true + detail: true, }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); } diff --git a/packages/backend/src/services/following/requests/cancel.ts b/packages/backend/src/services/following/requests/cancel.ts index 8895849857..53e54f2a1b 100644 --- a/packages/backend/src/services/following/requests/cancel.ts +++ b/packages/backend/src/services/following/requests/cancel.ts @@ -18,7 +18,7 @@ export default async function(followee: { id: User['id']; host: User['host']; ur const request = await FollowRequests.findOne({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); if (request == null) { @@ -27,10 +27,10 @@ export default async function(followee: { id: User['id']; host: User['host']; ur await FollowRequests.delete({ followeeId: followee.id, - followerId: follower.id + followerId: follower.id, }); Users.pack(followee.id, followee, { - detail: true + detail: true, }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); } diff --git a/packages/backend/src/services/following/requests/create.ts b/packages/backend/src/services/following/requests/create.ts index 507cb2b7d1..cc1abcce19 100644 --- a/packages/backend/src/services/following/requests/create.ts +++ b/packages/backend/src/services/following/requests/create.ts @@ -19,7 +19,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur Blockings.findOne({ blockerId: followee.id, blockeeId: follower.id, - }) + }), ]); if (blocking != null) throw new Error('blocking'); @@ -38,7 +38,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur followerSharedInbox: Users.isRemoteUser(follower) ? follower.sharedInbox : undefined, followeeHost: followee.host, followeeInbox: Users.isRemoteUser(followee) ? followee.inbox : undefined, - followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : undefined + followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : undefined, }); // Publish receiveRequest event @@ -46,13 +46,13 @@ export default async function(follower: { id: User['id']; host: User['host']; ur Users.pack(follower.id, followee).then(packed => publishMainStream(followee.id, 'receiveFollowRequest', packed)); Users.pack(followee.id, followee, { - detail: true + detail: true, }).then(packed => publishMainStream(followee.id, 'meUpdated', packed)); // 通知を作成 createNotification(followee.id, 'receiveFollowRequest', { notifierId: follower.id, - followRequestId: followRequest.id + followRequestId: followRequest.id, }); } diff --git a/packages/backend/src/services/i/pin.ts b/packages/backend/src/services/i/pin.ts index b31beb6e1a..167dfc10c1 100644 --- a/packages/backend/src/services/i/pin.ts +++ b/packages/backend/src/services/i/pin.ts @@ -20,7 +20,7 @@ export async function addPinned(user: { id: User['id']; host: User['host']; }, n // Fetch pinee const note = await Notes.findOne({ id: noteId, - userId: user.id + userId: user.id, }); if (note == null) { @@ -41,7 +41,7 @@ export async function addPinned(user: { id: User['id']; host: User['host']; }, n id: genId(), createdAt: new Date(), userId: user.id, - noteId: note.id + noteId: note.id, } as UserNotePining); // Deliver to remote followers @@ -59,7 +59,7 @@ export async function removePinned(user: { id: User['id']; host: User['host']; } // Fetch unpinee const note = await Notes.findOne({ id: noteId, - userId: user.id + userId: user.id, }); if (note == null) { @@ -68,7 +68,7 @@ export async function removePinned(user: { id: User['id']; host: User['host']; } UserNotePinings.delete({ userId: user.id, - noteId: note.id + noteId: note.id, }); // Deliver to remote followers diff --git a/packages/backend/src/services/insert-moderation-log.ts b/packages/backend/src/services/insert-moderation-log.ts index 00397652ee..affed4095f 100644 --- a/packages/backend/src/services/insert-moderation-log.ts +++ b/packages/backend/src/services/insert-moderation-log.ts @@ -8,6 +8,6 @@ export async function insertModerationLog(moderator: { id: User['id'] }, type: s createdAt: new Date(), userId: moderator.id, type: type, - info: info || {} + info: info || {}, }); } diff --git a/packages/backend/src/services/instance-actor.ts b/packages/backend/src/services/instance-actor.ts index b3625226c3..6f2e32667a 100644 --- a/packages/backend/src/services/instance-actor.ts +++ b/packages/backend/src/services/instance-actor.ts @@ -13,7 +13,7 @@ export async function getInstanceActor(): Promise { const user = await Users.findOne({ host: null, - username: ACTOR_USERNAME + username: ACTOR_USERNAME, }) as ILocalUser | undefined; if (user) { diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index 709b9bae5c..626cc6b44c 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -36,7 +36,7 @@ export default class Logger { server: { target: config.syslog.host, port: config.syslog.port, - } + }, }); } } diff --git a/packages/backend/src/services/messages/create.ts b/packages/backend/src/services/messages/create.ts index 348b29ec62..7b4ae138d9 100644 --- a/packages/backend/src/services/messages/create.ts +++ b/packages/backend/src/services/messages/create.ts @@ -24,7 +24,7 @@ export async function createMessage(user: { id: User['id']; host: User['host']; userId: user.id, isRead: false, reads: [] as any[], - uri + uri, } as MessagingMessage; await MessagingMessages.insert(message); @@ -96,7 +96,7 @@ export async function createMessage(user: { id: User['id']; host: User['host']; mentionedRemoteUsers: JSON.stringify([ recipientUser ].map(u => ({ uri: u.uri, username: u.username, - host: u.host + host: u.host, }))), } as Note; diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index 8f6c2fe3a5..fb22bd6593 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -65,7 +65,7 @@ class NotificationManager { } else { this.queue.push({ reason: reason, - target: notifiee + target: notifiee, }); } } @@ -74,7 +74,7 @@ class NotificationManager { for (const x of this.queue) { // ミュート情報を取得 const mentioneeMutes = await Mutings.find({ - muterId: x.target + muterId: x.target, }); const mentioneesMutedUserIds = mentioneeMutes.map(m => m.muteeId); @@ -83,7 +83,7 @@ class NotificationManager { if (!mentioneesMutedUserIds.includes(this.notifier.id)) { createNotification(x.target, x.reason, { notifierId: this.notifier.id, - noteId: this.note.id + noteId: this.note.id, }); } } @@ -242,7 +242,7 @@ export default async (user: { id: User['id']; username: User['username']; host: // Word mute // TODO: cache UserProfiles.find({ - enableWordMute: true + enableWordMute: true, }).then(us => { for (const u of us) { checkWordMute(note, { id: u.userId }, u.mutedWords).then(shouldMute => { @@ -450,7 +450,7 @@ function incRenoteCount(renote: Note) { Notes.createQueryBuilder().update() .set({ renoteCount: () => '"renoteCount" + 1', - score: () => '"score" + 1' + score: () => '"score" + 1', }) .where('id = :id', { id: renote.id }) .execute(); @@ -508,7 +508,7 @@ async function insertNote(user: { id: User['id']; host: User['host']; }, data: O uri: u.uri, url: url == null ? undefined : url, username: u.username, - host: u.host + host: u.host, } as IMentionedRemoteUsers[0]; })); } @@ -528,7 +528,7 @@ async function insertNote(user: { id: User['id']; host: User['host']; }, data: O votes: new Array(data.poll!.choices.length).fill(0), noteVisibility: insert.visibility, userId: user.id, - userHost: user.host + userHost: user.host, }); await transactionalEntityManager.insert(Poll, poll); @@ -561,15 +561,15 @@ function index(note: Note) { body: { text: normalizeForSearch(note.text), userId: note.userId, - userHost: note.userHost - } + userHost: note.userHost, + }, }); } async function notifyToWatchersOfRenotee(renote: Note, user: { id: User['id']; }, nm: NotificationManager, type: NotificationType) { const watchers = await NoteWatchings.find({ noteId: renote.id, - userId: Not(user.id) + userId: Not(user.id), }); for (const watcher of watchers) { @@ -580,7 +580,7 @@ async function notifyToWatchersOfRenotee(renote: Note, user: { id: User['id']; } async function notifyToWatchersOfReplyee(reply: Note, user: { id: User['id']; }, nm: NotificationManager) { const watchers = await NoteWatchings.find({ noteId: reply.id, - userId: Not(user.id) + userId: Not(user.id), }); for (const watcher of watchers) { @@ -600,7 +600,7 @@ async function createMentionedEvents(mentionedUsers: User[], note: Note, nm: Not } const detailPackedNote = await Notes.pack(note, u, { - detail: true + detail: true, }); publishMainStream(u.id, 'mention', detailPackedNote); @@ -618,7 +618,7 @@ function incNotesCountOfUser(user: { id: User['id']; }) { Users.createQueryBuilder().update() .set({ updatedAt: new Date(), - notesCount: () => '"notesCount" + 1' + notesCount: () => '"notesCount" + 1', }) .where('id = :id', { id: user.id }) .execute(); diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index a14d84e7b2..64383ee928 100644 --- a/packages/backend/src/services/note/delete.ts +++ b/packages/backend/src/services/note/delete.ts @@ -31,7 +31,7 @@ export default async function(user: User, note: Note, quiet = false) { if (!quiet) { publishNoteStream(note.id, 'deleted', { - deletedAt: deletedAt + deletedAt: deletedAt, }); //#region ローカルの投稿なら削除アクティビティを配送 @@ -41,7 +41,7 @@ export default async function(user: User, note: Note, quiet = false) { // if deletd note is renote if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length == 0)) { renote = await Notes.findOne({ - id: note.renoteId + id: note.renoteId, }); } @@ -76,7 +76,7 @@ export default async function(user: User, note: Note, quiet = false) { await Notes.delete({ id: note.id, - userId: user.id + userId: user.id, }); } @@ -116,14 +116,14 @@ async function getMentionedRemoteUsers(note: Note) { // renote / quote if (note.renoteUserId) { where.push({ - id: note.renoteUserId + id: note.renoteUserId, }); } if (where.length === 0) return []; return await Users.find({ - where + where, }) as IRemoteUser[]; } diff --git a/packages/backend/src/services/note/polls/vote.ts b/packages/backend/src/services/note/polls/vote.ts index 886a09dde9..25c62f3e3d 100644 --- a/packages/backend/src/services/note/polls/vote.ts +++ b/packages/backend/src/services/note/polls/vote.ts @@ -28,7 +28,7 @@ export default async function(user: User, note: Note, choice: number) { // if already voted const exist = await PollVotes.find({ noteId: note.id, - userId: user.id + userId: user.id, }); if (poll.multiple) { @@ -45,7 +45,7 @@ export default async function(user: User, note: Note, choice: number) { createdAt: new Date(), noteId: note.id, userId: user.id, - choice: choice + choice: choice, }); // Increment votes count @@ -54,14 +54,14 @@ export default async function(user: User, note: Note, choice: number) { publishNoteStream(note.id, 'pollVoted', { choice: choice, - userId: user.id + userId: user.id, }); // Notify createNotification(note.userId, 'pollVote', { notifierId: user.id, noteId: note.id, - choice: choice + choice: choice, }); // Fetch watchers @@ -74,7 +74,7 @@ export default async function(user: User, note: Note, choice: number) { createNotification(watcher.userId, 'pollVote', { notifierId: user.id, noteId: note.id, - choice: choice + choice: choice, }); } }); diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index 308bd4dff7..e0baa6a096 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -35,7 +35,7 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, createdAt: new Date(), noteId: note.id, userId: user.id, - reaction + reaction, }; // Create reaction @@ -66,7 +66,7 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, await Notes.createQueryBuilder().update() .set({ reactions: () => sql, - score: () => '"score" + 1' + score: () => '"score" + 1', }) .where('id = :id', { id: note.id }) .execute(); @@ -79,22 +79,22 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, let emoji = await Emojis.findOne({ where: { name: decodedReaction.name, - host: decodedReaction.host + host: decodedReaction.host, }, - select: ['name', 'host', 'url'] + select: ['name', 'host', 'url'], }); if (emoji) { emoji = { name: emoji.host ? `${emoji.name}@${emoji.host}` : `${emoji.name}@.`, - url: emoji.url + url: emoji.url, } as any; } publishNoteStream(note.id, 'reacted', { reaction: decodedReaction.reaction, emoji: emoji, - userId: user.id + userId: user.id, }); // リアクションされたユーザーがローカルユーザーなら通知を作成 @@ -102,20 +102,20 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, createNotification(note.userId, 'reaction', { notifierId: user.id, noteId: note.id, - reaction: reaction + reaction: reaction, }); } // Fetch watchers NoteWatchings.find({ noteId: note.id, - userId: Not(user.id) + userId: Not(user.id), }).then(watchers => { for (const watcher of watchers) { createNotification(watcher.userId, 'reaction', { notifierId: user.id, noteId: note.id, - reaction: reaction + reaction: reaction, }); } }); diff --git a/packages/backend/src/services/note/reaction/delete.ts b/packages/backend/src/services/note/reaction/delete.ts index 062dbad6f1..21af819532 100644 --- a/packages/backend/src/services/note/reaction/delete.ts +++ b/packages/backend/src/services/note/reaction/delete.ts @@ -40,7 +40,7 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note) publishNoteStream(note.id, 'unreacted', { reaction: decodeReaction(exist.reaction).reaction, - userId: user.id + userId: user.id, }); //#region 配信 diff --git a/packages/backend/src/services/note/read.ts b/packages/backend/src/services/note/read.ts index f25f86da9c..aaf1c5ed71 100644 --- a/packages/backend/src/services/note/read.ts +++ b/packages/backend/src/services/note/read.ts @@ -22,15 +22,15 @@ export default async function( ) { const following = info?.following ? info.following : new Set((await Followings.find({ where: { - followerId: userId + followerId: userId, }, - select: ['followeeId'] + select: ['followeeId'], })).map(x => x.followeeId)); const followingChannels = info?.followingChannels ? info.followingChannels : new Set((await ChannelFollowings.find({ where: { - followerId: userId + followerId: userId, }, - select: ['followeeId'] + select: ['followeeId'], })).map(x => x.followeeId)); const myAntennas = (await getAntennas()).filter(a => a.userId === userId); @@ -70,7 +70,7 @@ export default async function( NoteUnreads.count({ userId: userId, - isMentioned: true + isMentioned: true, }).then(mentionsCount => { if (mentionsCount === 0) { // 全て既読になったイベントを発行 @@ -80,7 +80,7 @@ export default async function( NoteUnreads.count({ userId: userId, - isSpecified: true + isSpecified: true, }).then(specifiedCount => { if (specifiedCount === 0) { // 全て既読になったイベントを発行 @@ -90,7 +90,7 @@ export default async function( NoteUnreads.count({ userId: userId, - noteChannelId: Not(IsNull()) + noteChannelId: Not(IsNull()), }).then(channelNoteCount => { if (channelNoteCount === 0) { // 全て既読になったイベントを発行 @@ -106,16 +106,16 @@ export default async function( if (readAntennaNotes.length > 0) { await AntennaNotes.update({ antennaId: In(myAntennas.map(a => a.id)), - noteId: In(readAntennaNotes.map(n => n.id)) + noteId: In(readAntennaNotes.map(n => n.id)), }, { - read: true + read: true, }); // TODO: まとめてクエリしたい for (const antenna of myAntennas) { const count = await AntennaNotes.count({ antennaId: antenna.id, - read: false + read: false, }); if (count === 0) { diff --git a/packages/backend/src/services/note/unread.ts b/packages/backend/src/services/note/unread.ts index 29d2b54af8..0b2b5b8d75 100644 --- a/packages/backend/src/services/note/unread.ts +++ b/packages/backend/src/services/note/unread.ts @@ -12,7 +12,7 @@ export async function insertNoteUnread(userId: User['id'], note: Note, params: { //#region ミュートしているなら無視 // TODO: 現在の仕様ではChannelにミュートは適用されないのでよしなにケアする const mute = await Mutings.find({ - muterId: userId + muterId: userId, }); if (mute.map(m => m.muteeId).includes(note.userId)) return; //#endregion diff --git a/packages/backend/src/services/note/unwatch.ts b/packages/backend/src/services/note/unwatch.ts index 8ea02fe33c..befdb2aa77 100644 --- a/packages/backend/src/services/note/unwatch.ts +++ b/packages/backend/src/services/note/unwatch.ts @@ -5,6 +5,6 @@ import { Note } from '@/models/entities/note'; export default async (me: User['id'], note: Note) => { await NoteWatchings.delete({ noteId: note.id, - userId: me + userId: me, }); }; diff --git a/packages/backend/src/services/note/watch.ts b/packages/backend/src/services/note/watch.ts index e457191d99..ebaaf35936 100644 --- a/packages/backend/src/services/note/watch.ts +++ b/packages/backend/src/services/note/watch.ts @@ -15,6 +15,6 @@ export default async (me: User['id'], note: Note) => { createdAt: new Date(), noteId: note.id, userId: me, - noteUserId: note.userId + noteUserId: note.userId, } as NoteWatching); }; diff --git a/packages/backend/src/services/push-notification.ts b/packages/backend/src/services/push-notification.ts index c1386b6963..7bdaec9959 100644 --- a/packages/backend/src/services/push-notification.ts +++ b/packages/backend/src/services/push-notification.ts @@ -49,7 +49,7 @@ export async function pushNotification(u // Fetch const subscriptions = await SwSubscriptions.find({ - userId: userId + userId: userId, }); for (const subscription of subscriptions) { @@ -57,8 +57,8 @@ export async function pushNotification(u endpoint: subscription.endpoint, keys: { auth: subscription.auth, - p256dh: subscription.publickey - } + p256dh: subscription.publickey, + }, }; push.sendNotification(pushSubscription, JSON.stringify({ @@ -66,7 +66,7 @@ export async function pushNotification(u body: type === 'notification' ? truncateNotification(body as Packed<'Notification'>) : body, userId, }), { - proxy: config.proxy + proxy: config.proxy, }).catch((err: any) => { //swLogger.info(err.statusCode); //swLogger.info(err.headers); @@ -77,7 +77,7 @@ export async function pushNotification(u userId: userId, endpoint: subscription.endpoint, auth: subscription.auth, - publickey: subscription.publickey + publickey: subscription.publickey, }); } }); diff --git a/packages/backend/src/services/relay.ts b/packages/backend/src/services/relay.ts index 04775524fa..422da88846 100644 --- a/packages/backend/src/services/relay.ts +++ b/packages/backend/src/services/relay.ts @@ -12,7 +12,7 @@ const ACTOR_USERNAME = 'relay.actor' as const; export async function getRelayActor(): Promise { const user = await Users.findOne({ host: null, - username: ACTOR_USERNAME + username: ACTOR_USERNAME, }); if (user) return user as ILocalUser; @@ -25,7 +25,7 @@ export async function addRelay(inbox: string) { const relay = await Relays.save({ id: genId(), inbox, - status: 'requesting' + status: 'requesting', }); const relayActor = await getRelayActor(); @@ -38,7 +38,7 @@ export async function addRelay(inbox: string) { export async function removeRelay(inbox: string) { const relay = await Relays.findOne({ - inbox + inbox, }); if (relay == null) { @@ -61,7 +61,7 @@ export async function listRelay() { export async function relayAccepted(id: string) { const result = await Relays.update(id, { - status: 'accepted' + status: 'accepted', }); return JSON.stringify(result); @@ -69,7 +69,7 @@ export async function relayAccepted(id: string) { export async function relayRejected(id: string) { const result = await Relays.update(id, { - status: 'rejected' + status: 'rejected', }); return JSON.stringify(result); @@ -79,7 +79,7 @@ export async function deliverToRelays(user: { id: User['id']; host: null; }, act if (activity == null) return; const relays = await Relays.find({ - status: 'accepted' + status: 'accepted', }); if (relays.length === 0) return; diff --git a/packages/backend/src/services/stream.ts b/packages/backend/src/services/stream.ts index 0901857c33..7d11ff3f45 100644 --- a/packages/backend/src/services/stream.ts +++ b/packages/backend/src/services/stream.ts @@ -23,7 +23,7 @@ import { ReversiGameStreamTypes, ReversiStreamTypes, UserListStreamTypes, - UserStreamTypes + UserStreamTypes, } from '@/server/api/stream/types'; import { Packed } from '@/misc/schema'; @@ -35,7 +35,7 @@ class Publisher { redisClient.publish(config.host, JSON.stringify({ channel: channel, - message: message + message: message, })); }; @@ -62,7 +62,7 @@ class Publisher { public publishNoteStream = (noteId: Note['id'], type: K, value?: NoteStreamTypes[K]): void => { this.publish(`noteStream:${noteId}`, type, { id: noteId, - body: value + body: value, }); }; diff --git a/packages/backend/src/services/suspend-user.ts b/packages/backend/src/services/suspend-user.ts index 55be63172f..262c8df5b2 100644 --- a/packages/backend/src/services/suspend-user.ts +++ b/packages/backend/src/services/suspend-user.ts @@ -16,9 +16,9 @@ export async function doPostSuspend(user: { id: User['id']; host: User['host'] } const followings = await Followings.find({ where: [ { followerSharedInbox: Not(IsNull()) }, - { followeeSharedInbox: Not(IsNull()) } + { followeeSharedInbox: Not(IsNull()) }, ], - select: ['followerSharedInbox', 'followeeSharedInbox'] + select: ['followerSharedInbox', 'followeeSharedInbox'], }); const inboxes = followings.map(x => x.followerSharedInbox || x.followeeSharedInbox); diff --git a/packages/backend/src/services/unsuspend-user.ts b/packages/backend/src/services/unsuspend-user.ts index bfffa036e5..04ad65a361 100644 --- a/packages/backend/src/services/unsuspend-user.ts +++ b/packages/backend/src/services/unsuspend-user.ts @@ -17,9 +17,9 @@ export async function doPostUnsuspend(user: User) { const followings = await Followings.find({ where: [ { followerSharedInbox: Not(IsNull()) }, - { followeeSharedInbox: Not(IsNull()) } + { followeeSharedInbox: Not(IsNull()) }, ], - select: ['followerSharedInbox', 'followeeSharedInbox'] + select: ['followerSharedInbox', 'followeeSharedInbox'], }); const inboxes = followings.map(x => x.followerSharedInbox || x.followeeSharedInbox); diff --git a/packages/backend/src/services/user-list/push.ts b/packages/backend/src/services/user-list/push.ts index 29d561b519..2b862ca9cc 100644 --- a/packages/backend/src/services/user-list/push.ts +++ b/packages/backend/src/services/user-list/push.ts @@ -12,7 +12,7 @@ export async function pushUserToUserList(target: User, list: UserList) { id: genId(), createdAt: new Date(), userId: target.id, - userListId: list.id + userListId: list.id, } as UserListJoining); publishUserListStream(list.id, 'userAdded', await Users.pack(target)); diff --git a/packages/backend/src/tools/add-emoji.ts b/packages/backend/src/tools/add-emoji.ts index 6c750bcab0..a3f4b54c7e 100644 --- a/packages/backend/src/tools/add-emoji.ts +++ b/packages/backend/src/tools/add-emoji.ts @@ -13,7 +13,7 @@ async function main(name: string, url: string, alias?: string): Promise { name, url, aliases, - updatedAt: new Date() + updatedAt: new Date(), }); } diff --git a/packages/backend/src/tools/demote-admin.ts b/packages/backend/src/tools/demote-admin.ts index b326c946ef..45e32b513c 100644 --- a/packages/backend/src/tools/demote-admin.ts +++ b/packages/backend/src/tools/demote-admin.ts @@ -9,9 +9,9 @@ async function main(username: string) { const res = await Users.update({ usernameLower: username.toLowerCase(), - host: null + host: null, }, { - isAdmin: false + isAdmin: false, }); if (res.affected !== 1) { diff --git a/packages/backend/src/tools/mark-admin.ts b/packages/backend/src/tools/mark-admin.ts index 0833f22266..88d59518ab 100644 --- a/packages/backend/src/tools/mark-admin.ts +++ b/packages/backend/src/tools/mark-admin.ts @@ -9,9 +9,9 @@ async function main(username: string) { const res = await Users.update({ usernameLower: username.toLowerCase(), - host: null + host: null, }, { - isAdmin: true + isAdmin: true, }); if (res.affected !== 1) { diff --git a/packages/backend/src/tools/show-signin-history.ts b/packages/backend/src/tools/show-signin-history.ts index 1291a1b22f..7db84ece02 100644 --- a/packages/backend/src/tools/show-signin-history.ts +++ b/packages/backend/src/tools/show-signin-history.ts @@ -21,7 +21,7 @@ async function main(username: string, headers?: string[]) { if (user == null) throw new Error('User not found'); const history = await Signins.find({ - userId: user.id + userId: user.id, }); for (const signin of history) { diff --git a/packages/backend/yarn.lock b/packages/backend/yarn.lock index defe9b8922..96fbb26c95 100644 --- a/packages/backend/yarn.lock +++ b/packages/backend/yarn.lock @@ -645,11 +645,6 @@ dependencies: "@types/node" "*" -"@types/nprogress@0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@types/nprogress/-/nprogress-0.2.0.tgz#86c593682d4199212a0509cc3c4d562bbbd6e45f" - integrity sha512-1cYJrqq9GezNFPsWTZpFut/d4CjpZqA0vhqDUPFWYKF1oIyBz5qnoYMzR+0C/T96t3ebLAC1SSnwrVOm5/j74A== - "@types/oauth@0.9.1": version "0.9.1" resolved "https://registry.yarnpkg.com/@types/oauth/-/oauth-0.9.1.tgz#e17221e7f7936b0459ae7d006255dff61adca305" @@ -662,15 +657,10 @@ resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109" integrity sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw== -"@types/parse5@6.0.2": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-6.0.2.tgz#99f6b72d82e34cea03a4d8f2ed72114d909c1c61" - integrity sha512-+hQX+WyJAOne7Fh3zF5CxPemILIbuhNcqHHodzK9caYOLnC8pD5efmPleRnw0z++LfKUC/sVNMwk0Gap+B0baA== - -"@types/parsimmon@1.10.6": - version "1.10.6" - resolved "https://registry.yarnpkg.com/@types/parsimmon/-/parsimmon-1.10.6.tgz#8fcf95990514d2a7624aa5f630c13bf2427f9cdd" - integrity sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA== +"@types/parse5@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-6.0.3.tgz#705bb349e789efa06f43f128cef51240753424cb" + integrity sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g== "@types/portscanner@2.1.1": version "2.1.1" @@ -1328,6 +1318,35 @@ aproba@^1.0.3: resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== +archiver-utils@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/archiver-utils/-/archiver-utils-2.1.0.tgz#e8a460e94b693c3e3da182a098ca6285ba9249e2" + integrity sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw== + dependencies: + glob "^7.1.4" + graceful-fs "^4.2.0" + lazystream "^1.0.0" + lodash.defaults "^4.2.0" + lodash.difference "^4.5.0" + lodash.flatten "^4.4.0" + lodash.isplainobject "^4.0.6" + lodash.union "^4.6.0" + normalize-path "^3.0.0" + readable-stream "^2.0.0" + +archiver@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.3.0.tgz#dd3e097624481741df626267564f7dd8640a45ba" + integrity sha512-iUw+oDwK0fgNpvveEsdQ0Ase6IIKztBJU2U0E9MzszMfmVVUyv1QJhS2ITW9ZCqx8dktAxVAjWWkKehuZE8OPg== + dependencies: + archiver-utils "^2.1.0" + async "^3.2.0" + buffer-crc32 "^0.2.1" + readable-stream "^3.6.0" + readdir-glob "^1.0.0" + tar-stream "^2.2.0" + zip-stream "^4.1.0" + are-we-there-yet@~1.1.2: version "1.1.5" resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" @@ -1655,6 +1674,11 @@ buffer-alloc@^1.2.0: buffer-alloc-unsafe "^1.1.0" buffer-fill "^1.0.0" +buffer-crc32@^0.2.1, buffer-crc32@^0.2.13: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= + buffer-equal-constant-time@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" @@ -2177,6 +2201,16 @@ compare-versions@3.6.0: resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62" integrity sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA== +compress-commons@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-4.1.1.tgz#df2a09a7ed17447642bad10a85cc9a19e5c42a7d" + integrity sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ== + dependencies: + buffer-crc32 "^0.2.13" + crc32-stream "^4.0.2" + normalize-path "^3.0.0" + readable-stream "^3.6.0" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -2192,20 +2226,6 @@ concat-stream@^1.5.2: readable-stream "^2.2.2" typedarray "^0.0.6" -concurrently@6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-6.3.0.tgz#63128cb4a6ed54d3c0ed8528728590a5fe54582a" - integrity sha512-k4k1jQGHHKsfbqzkUszVf29qECBrkvBKkcPJEUDTyVR7tZd1G/JOfnst4g1sYbFvJ4UjHZisj1aWQR8yLKpGPw== - dependencies: - chalk "^4.1.0" - date-fns "^2.16.1" - lodash "^4.17.21" - rxjs "^6.6.3" - spawn-command "^0.0.2-1" - supports-color "^8.1.0" - tree-kill "^1.2.2" - yargs "^16.2.0" - condense-newlines@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/condense-newlines/-/condense-newlines-0.2.1.tgz#3de985553139475d32502c83b02f60684d24c55f" @@ -2273,7 +2293,7 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -crc-32@1.2.0: +crc-32@1.2.0, crc-32@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.0.tgz#cb2db6e29b88508e32d9dd0ec1693e7b41a18208" integrity sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA== @@ -2281,6 +2301,14 @@ crc-32@1.2.0: exit-on-epipe "~1.0.1" printj "~1.1.0" +crc32-stream@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-4.0.2.tgz#c922ad22b38395abe9d3870f02fa8134ed709007" + integrity sha512-DxFZ/Hk473b/muq1VJ///PMNLj0ZMnzye9thBpmjpJKCc5eMgB95aK8zCGrGfQ90cWo561Te6HK9D+j4KPdM6w== + dependencies: + crc-32 "^1.2.0" + readable-stream "^3.4.0" + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -2488,11 +2516,6 @@ date-fns@2.25.0: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.25.0.tgz#8c5c8f1d958be3809a9a03f4b742eba894fc5680" integrity sha512-ovYRFnTrbGPD4nqaEqescPEv1mNwvt+UTqI3Ay9SzNtey9NZnYu6E2qCcBBgJ6/2VF1zGGygpyTDITqpQQ5e+w== -date-fns@^2.16.1: - version "2.19.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.19.0.tgz#65193348635a28d5d916c43ec7ce6fbd145059e1" - integrity sha512-X3bf2iTPgCAQp9wvjOQytnf5vO5rESYRXlPIVcgSbtT5OTScPcsf9eZU+B/YIkKAtYr5WeCii58BgATrNitlWg== - dateformat@4.5.1: version "4.5.1" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c" @@ -4930,6 +4953,13 @@ langmap@0.0.16: resolved "https://registry.yarnpkg.com/langmap/-/langmap-0.0.16.tgz#2fe3e98a531fec0fec546624ebe168c2855bab56" integrity sha512-AtYvBK7BsDvWwnSfmO7CfgeUy7GUT1wK3QX8eKH/Ey/eXodqoHuAtvdQ82hmWD9QVFVKnuiNjym9fGY4qSJeLA== +lazystream@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.1.tgz#494c831062f1f9408251ec44db1cba29242a2638" + integrity sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw== + dependencies: + readable-stream "^2.0.5" + lcid@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/lcid/-/lcid-3.1.1.tgz#9030ec479a058fc36b5e8243ebaac8b6ac582fd0" @@ -5010,6 +5040,11 @@ lodash.defaults@^4.0.1, lodash.defaults@^4.2.0: resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw= +lodash.difference@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.difference/-/lodash.difference-4.5.0.tgz#9ccb4e505d486b91651345772885a2df27fd017c" + integrity sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw= + lodash.filter@^4.4.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.filter/-/lodash.filter-4.6.0.tgz#668b1d4981603ae1cc5a6fa760143e480b4c4ace" @@ -5035,6 +5070,11 @@ lodash.isfinite@^3.3.2: resolved "https://registry.yarnpkg.com/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz#fb89b65a9a80281833f0b7478b3a5104f898ebb3" integrity sha1-+4m2WpqAKBgz8LdHizpRBPiY67M= +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= + lodash.isregexp@3.0.5: version "3.0.5" resolved "https://registry.yarnpkg.com/lodash.isregexp/-/lodash.isregexp-3.0.5.tgz#e0f596242f2fa228a840086b6c8ad82e4b71fd2d" @@ -5080,6 +5120,11 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= +lodash.union@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88" + integrity sha1-SLtQiECfFvGCFmZkHETdGqrjzYg= + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -5227,6 +5272,18 @@ mime-db@1.44.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== +mime-db@1.51.0: + version "1.51.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" + integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== + +mime-types@2.1.34: + version "2.1.34" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" + integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== + dependencies: + mime-db "1.51.0" + mime-types@^2.1.12, mime-types@^2.1.18, mime-types@^2.1.27, mime-types@~2.1.19, mime-types@~2.1.24: version "2.1.27" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" @@ -6806,7 +6863,7 @@ readable-stream@1.1.x: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@^2.0.6, readable-stream@^2.2.2: +readable-stream@^2.0.0, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -6836,6 +6893,13 @@ readable-web-to-node-stream@^3.0.0: "@types/readable-stream" "^2.3.9" readable-stream "^3.6.0" +readdir-glob@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.1.tgz#f0e10bb7bf7bfa7e0add8baffdc54c3f7dbee6c4" + integrity sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA== + dependencies: + minimatch "^3.0.4" + readdirp@~3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.3.0.tgz#984458d13a1e42e2e9f5841b129e162f369aff17" @@ -7048,13 +7112,6 @@ run-parallel@^1.1.9: resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== -rxjs@^6.6.3: - version "6.6.6" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.6.tgz#14d8417aa5a07c5e633995b525e1e3c0dec03b70" - integrity sha512-/oTwee4N4iWzAMAL9xdGKjkEHmIwupR3oXbQjCKywF1BeFohswF3vZdogbmEF6pZkOsXTzWkrZszrWpQTByYVg== - dependencies: - tslib "^1.9.0" - s-age@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/s-age/-/s-age-1.1.2.tgz#c0cf15233ccc93f41de92ea42c36d957977d1ea2" @@ -7323,11 +7380,6 @@ source-map@~0.7.2: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -spawn-command@^0.0.2-1: - version "0.0.2-1" - resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" - integrity sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A= - speakeasy@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/speakeasy/-/speakeasy-2.0.0.tgz#85c91a071b09a5cb8642590d983566165f57613a" @@ -7618,7 +7670,7 @@ summaly@2.4.1: require-all "3.0.0" trace-redirect "1.0.6" -supports-color@8.1.1, supports-color@^8.1.0: +supports-color@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== @@ -7705,7 +7757,7 @@ tar-stream@^2.0.0: inherits "^2.0.3" readable-stream "^3.1.1" -tar-stream@^2.1.4: +tar-stream@^2.1.4, tar-stream@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== @@ -7866,11 +7918,6 @@ trace-redirect@1.0.6: resolved "https://registry.yarnpkg.com/trace-redirect/-/trace-redirect-1.0.6.tgz#ac629b5bf8247d30dde5a35fe9811b811075b504" integrity sha512-UUfa1DjjU5flcjMdaFIiIEGDTyu2y/IiMjOX4uGXa7meKBS4vD4f2Uy/tken9Qkd4Jsm4sRsfZcIIPqrRVF3Mg== -tree-kill@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" - integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== - ts-jest@^25.2.1: version "25.5.1" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-25.5.1.tgz#2913afd08f28385d54f2f4e828be4d261f4337c7" @@ -8560,7 +8607,7 @@ yargs-unparser@2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@16.2.0, yargs@^16.0.0, yargs@^16.2.0: +yargs@16.2.0, yargs@^16.0.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== @@ -8629,3 +8676,12 @@ zen-observable@^0.8.15: version "0.8.15" resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== + +zip-stream@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79" + integrity sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A== + dependencies: + archiver-utils "^2.1.0" + compress-commons "^4.1.0" + readable-stream "^3.6.0" diff --git a/packages/client/package.json b/packages/client/package.json index 911dadceee..681e222082 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -11,10 +11,8 @@ }, "dependencies": { "@discordapp/twemoji": "13.1.0", - "@elastic/elasticsearch": "7.11.0", "@sentry/browser": "5.29.2", "@sentry/tracing": "5.29.2", - "@sinonjs/fake-timers": "7.1.2", "@syuilo/aiscript": "0.11.1", "@types/dateformat": "3.0.1", "@types/escape-regexp": "0.0.0", @@ -22,70 +20,56 @@ "@types/gulp": "4.0.9", "@types/gulp-rename": "2.0.1", "@types/is-url": "1.2.30", - "@types/js-yaml": "4.0.4", "@types/katex": "0.11.1", "@types/matter-js": "0.17.6", "@types/mocha": "8.2.3", - "@types/node": "16.11.7", - "@types/node-fetch": "2.5.12", - "@types/nodemailer": "6.4.4", - "@types/nprogress": "0.2.0", + "@types/node": "16.11.12", "@types/oauth": "0.9.1", - "@types/parse5": "6.0.2", - "@types/parsimmon": "1.10.6", - "@types/portscanner": "2.1.1", - "@types/pug": "2.0.5", + "@types/parse5": "6.0.3", "@types/punycode": "2.1.0", "@types/qrcode": "1.4.1", "@types/random-seed": "0.3.3", - "@types/rename": "1.0.4", "@types/request-stats": "3.0.0", "@types/seedrandom": "2.4.28", - "@types/sinonjs__fake-timers": "6.0.4", - "@types/speakeasy": "2.0.6", "@types/throttle-debounce": "2.1.0", "@types/tinycolor2": "1.4.3", "@types/tmp": "0.2.2", - "@types/uuid": "8.3.1", + "@types/uuid": "8.3.3", "@types/web-push": "3.3.2", "@types/webpack": "5.28.0", "@types/webpack-stream": "3.2.12", "@types/websocket": "1.0.4", - "@types/ws": "8.2.0", - "@typescript-eslint/parser": "5.1.0", - "@vue/compiler-sfc": "3.2.21", + "@types/ws": "8.2.2", + "@typescript-eslint/parser": "5.6.0", + "@vue/compiler-sfc": "3.2.24", "abort-controller": "3.0.0", "autobind-decorator": "2.4.0", "autosize": "4.0.4", "autwh": "0.1.0", "blurhash": "1.1.4", - "broadcast-channel": "4.5.0", - "chart.js": "3.6.0", + "broadcast-channel": "4.7.0", + "chart.js": "3.6.2", "chartjs-adapter-date-fns": "2.0.0", - "chartjs-plugin-zoom": "1.1.1", + "chartjs-plugin-zoom": "1.2.0", "compare-versions": "3.6.0", - "concurrently": "6.3.0", "content-disposition": "0.5.3", "crc-32": "1.2.0", "css-loader": "6.5.1", - "cssnano": "5.0.10", - "date-fns": "2.25.0", + "cssnano": "5.0.12", + "date-fns": "2.27.0", "dateformat": "4.5.1", "escape-regexp": "0.0.1", - "eslint": "8.2.0", - "eslint-plugin-vue": "8.1.1", + "eslint": "8.4.1", + "eslint-plugin-vue": "8.2.0", "eventemitter3": "4.0.7", "feed": "4.2.2", "glob": "7.2.0", - "got": "11.8.2", "idb-keyval": "5.1.3", "insert-text-at-cursor": "0.3.0", "ip-cidr": "3.0.4", - "is-svg": "4.3.1", - "js-yaml": "4.1.0", "json5": "2.2.0", "json5-loader": "4.0.1", - "katex": "0.13.18", + "katex": "0.15.1", "langmap": "0.0.16", "matter-js": "0.17.1", "mfm-js": "0.20.0", @@ -93,32 +77,26 @@ "mocha": "8.4.0", "ms": "2.1.3", "nested-property": "4.0.0", - "node-fetch": "2.6.1", "parse5": "6.0.1", "photoswipe": "git://github.com/dimsemenov/photoswipe#v5-beta", "portscanner": "2.2.0", - "postcss": "8.3.11", - "postcss-loader": "6.2.0", + "postcss": "8.4.4", + "postcss-loader": "6.2.1", "prismjs": "1.25.0", "private-ip": "2.3.3", - "probe-image-size": "7.2.1", "promise-limit": "2.7.0", "pug": "3.0.2", "punycode": "2.1.1", - "pureimage": "0.3.5", - "qrcode": "1.4.4", + "qrcode": "1.5.0", "querystring": "0.2.1", "random-seed": "0.3.0", - "ratelimiter": "3.4.1", "reflect-metadata": "0.1.13", - "rename": "1.0.4", "request-stats": "3.0.0", "rndstr": "1.0.0", "s-age": "1.1.2", - "sass": "1.43.4", - "sass-loader": "12.3.0", + "sass": "1.44.0", + "sass-loader": "12.4.0", "seedrandom": "3.0.5", - "speakeasy": "2.0.0", "strict-event-emitter-types": "2.0.0", "stringz": "2.1.0", "style-loader": "3.3.1", @@ -130,25 +108,25 @@ "tmp": "0.2.1", "ts-loader": "9.2.6", "ts-node": "10.4.0", - "tsc-alias": "1.3.10", - "tsconfig-paths": "3.11.0", + "tsc-alias": "1.4.2", + "tsconfig-paths": "3.12.0", "twemoji-parser": "13.1.0", - "typescript": "4.4.4", + "typescript": "4.5.2", "uuid": "8.3.2", "v-debounce": "0.1.2", "vanilla-tilt": "1.7.2", - "vue": "3.2.21", - "vue-loader": "16.7.0", + "vue": "3.2.24", + "vue-loader": "16.8.3", "vue-prism-editor": "2.0.0-alpha.2", "vue-router": "4.0.5", "vue-style-loader": "4.1.3", "vue-svg-loader": "0.17.0-beta.2", "vuedraggable": "4.0.1", "web-push": "3.4.5", - "webpack": "5.63.0", + "webpack": "5.65.0", "webpack-cli": "4.9.1", "websocket": "1.0.34", - "ws": "8.2.3" + "ws": "8.3.0" }, "devDependencies": { "@redocly/openapi-core": "1.0.0-beta.54", diff --git a/packages/client/src/components/drive-file-thumbnail.vue b/packages/client/src/components/drive-file-thumbnail.vue index b374ac1cfd..e94b6b8bcb 100644 --- a/packages/client/src/components/drive-file-thumbnail.vue +++ b/packages/client/src/components/drive-file-thumbnail.vue @@ -85,6 +85,10 @@ export default defineComponent({ diff --git a/packages/client/src/components/drive.file.vue b/packages/client/src/components/drive.file.vue index 62fd56d487..511647229e 100644 --- a/packages/client/src/components/drive.file.vue +++ b/packages/client/src/components/drive.file.vue @@ -210,7 +210,7 @@ export default defineComponent({ position: relative; padding: 8px 0 0 0; min-height: 180px; - border-radius: 4px; + border-radius: 8px; &, * { cursor: pointer; diff --git a/packages/client/src/components/drive.vue b/packages/client/src/components/drive.vue index 1e59de7055..46bcd42558 100644 --- a/packages/client/src/components/drive.vue +++ b/packages/client/src/components/drive.vue @@ -657,14 +657,14 @@ export default defineComponent({ > .path { display: inline-block; vertical-align: bottom; - line-height: 38px; + line-height: 50px; white-space: nowrap; > * { display: inline-block; margin: 0; padding: 0 8px; - line-height: 38px; + line-height: 50px; cursor: pointer; * { @@ -699,6 +699,7 @@ export default defineComponent({ > .menu { margin-left: auto; + padding: 0 12px; } } diff --git a/packages/client/src/components/emoji-picker.vue b/packages/client/src/components/emoji-picker.vue index 6695c236e7..180aff87ac 100644 --- a/packages/client/src/components/emoji-picker.vue +++ b/packages/client/src/components/emoji-picker.vue @@ -79,7 +79,7 @@ import { emojilist } from '@/scripts/emojilist'; import { getStaticImageUrl } from '@/scripts/get-static-image-url'; import Particle from '@/components/particle.vue'; import * as os from '@/os'; -import { isDeviceTouch } from '@/scripts/is-device-touch'; +import { isTouchUsing } from '@/scripts/touch'; import { isMobile } from '@/scripts/is-mobile'; import { emojiCategories } from '@/instance'; import XSection from './emoji-picker.section.vue'; @@ -108,7 +108,7 @@ export default defineComponent({ pinned: this.$store.reactiveState.reactions, width: this.asReactionPicker ? this.$store.state.reactionPickerWidth : 3, height: this.asReactionPicker ? this.$store.state.reactionPickerHeight : 2, - big: this.asReactionPicker ? isDeviceTouch : false, + big: this.asReactionPicker ? isTouchUsing : false, customEmojiCategories: emojiCategories, customEmojis: this.$instance.emojis, q: null, @@ -268,7 +268,7 @@ export default defineComponent({ methods: { focus() { - if (!isMobile && !isDeviceTouch) { + if (!isMobile && !isTouchUsing) { this.$refs.search.focus({ preventScroll: true }); diff --git a/packages/client/src/components/global/emoji.vue b/packages/client/src/components/global/emoji.vue index 67a3dea2c5..92edb1caf9 100644 --- a/packages/client/src/components/global/emoji.vue +++ b/packages/client/src/components/global/emoji.vue @@ -6,9 +6,11 @@ diff --git a/packages/client/src/components/global/url.vue b/packages/client/src/components/global/url.vue index 4987c2b61c..097fcddef6 100644 --- a/packages/client/src/components/global/url.vue +++ b/packages/client/src/components/global/url.vue @@ -23,7 +23,7 @@ import { defineComponent } from 'vue'; import { toUnicode as decodePunycode } from 'punycode/'; import { url as local } from '@/config'; -import { isDeviceTouch } from '@/scripts/is-device-touch'; +import { isTouchUsing } from '@/scripts/touch'; import * as os from '@/os'; export default defineComponent({ @@ -91,13 +91,13 @@ export default defineComponent({ } }, onMouseover() { - if (isDeviceTouch) return; + if (isTouchUsing) return; clearTimeout(this.showTimer); clearTimeout(this.hideTimer); this.showTimer = setTimeout(this.showPreview, 500); }, onMouseleave() { - if (isDeviceTouch) return; + if (isTouchUsing) return; clearTimeout(this.showTimer); clearTimeout(this.hideTimer); this.hideTimer = setTimeout(this.closePreview, 500); diff --git a/packages/client/src/components/link.vue b/packages/client/src/components/link.vue index 5a6754016e..8b8cde6510 100644 --- a/packages/client/src/components/link.vue +++ b/packages/client/src/components/link.vue @@ -12,7 +12,7 @@ diff --git a/packages/client/src/pages/gallery/edit.vue b/packages/client/src/pages/gallery/edit.vue index 08f31d0db2..caca6aed4b 100644 --- a/packages/client/src/pages/gallery/edit.vue +++ b/packages/client/src/pages/gallery/edit.vue @@ -37,7 +37,7 @@ import FormTuple from '@/components/debobigego/tuple.vue'; import FormBase from '@/components/debobigego/base.vue'; import FormGroup from '@/components/debobigego/group.vue'; import FormSuspense from '@/components/debobigego/suspense.vue'; -import { selectFile } from '@/scripts/select-file'; +import { selectFiles } from '@/scripts/select-file'; import * as os from '@/os'; import * as symbols from '@/symbols'; @@ -95,7 +95,7 @@ export default defineComponent({ methods: { selectFile(e) { - selectFile(e.currentTarget || e.target, null, true).then(files => { + selectFiles(e.currentTarget || e.target, null).then(files => { this.files = this.files.concat(files); }); }, diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index 0ce589f034..8d92c430f1 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -152,7 +152,7 @@ export default defineComponent({ }, chooseFile(e) { - selectFile(e.currentTarget || e.target, this.$ts.selectFile, false).then(file => { + selectFile(e.currentTarget || e.target, this.$ts.selectFile).then(file => { this.file = file; }); }, diff --git a/packages/client/src/pages/page-editor/page-editor.vue b/packages/client/src/pages/page-editor/page-editor.vue index 52f6858b0b..fe207555f8 100644 --- a/packages/client/src/pages/page-editor/page-editor.vue +++ b/packages/client/src/pages/page-editor/page-editor.vue @@ -448,7 +448,7 @@ export default defineComponent({ }, setEyeCatchingImage(e) { - selectFile(e.currentTarget || e.target, null, false).then(file => { + selectFile(e.currentTarget || e.target, null).then(file => { this.eyeCatchingImageId = file.id; }); }, diff --git a/packages/client/src/pages/room/room.vue b/packages/client/src/pages/room/room.vue index fa35d7d93e..eb85d39dc4 100644 --- a/packages/client/src/pages/room/room.vue +++ b/packages/client/src/pages/room/room.vue @@ -210,7 +210,7 @@ export default defineComponent({ }, chooseImage(key, e) { - selectFile(e.currentTarget || e.target, null, false).then(file => { + selectFile(e.currentTarget || e.target, null).then(file => { room.updateProp(key, `/proxy/?${urlQuery({ url: file.thumbnailUrl })}`); this.$refs.preview.selected(room.getSelectedObject()); this.changed = true; diff --git a/packages/client/src/pages/settings/import-export.vue b/packages/client/src/pages/settings/import-export.vue index 5b5b704695..a1dd6a1539 100644 --- a/packages/client/src/pages/settings/import-export.vue +++ b/packages/client/src/pages/settings/import-export.vue @@ -2,106 +2,158 @@
- {{ $ts.export }} + {{ $ts.export }} - {{ $ts.export }} - {{ $ts.import }} + + + {{ $ts._exportOrImport.excludeMutingUsers }} + + + {{ $ts._exportOrImport.excludeInactiveUsers }} + + {{ $ts.export }} + + + {{ $ts.import }} + - {{ $ts.export }} - {{ $ts.import }} + {{ $ts.export }} + {{ $ts.import }} - {{ $ts.export }} - {{ $ts.import }} + {{ $ts.export }} + {{ $ts.import }} - {{ $ts.export }} - {{ $ts.import }} + {{ $ts.export }} + {{ $ts.import }}
diff --git a/packages/client/src/pages/settings/index.vue b/packages/client/src/pages/settings/index.vue index bfac1be77d..8ffff86705 100644 --- a/packages/client/src/pages/settings/index.vue +++ b/packages/client/src/pages/settings/index.vue @@ -1,23 +1,25 @@ diff --git a/packages/client/src/pages/settings/other.vue b/packages/client/src/pages/settings/other.vue index fbc895a07d..0d9e60e21d 100644 --- a/packages/client/src/pages/settings/other.vue +++ b/packages/client/src/pages/settings/other.vue @@ -1,42 +1,41 @@