Merge pull request MisskeyIO#396 from merge-upstream

This commit is contained in:
まっちゃとーにゅ 2024-02-01 00:05:08 +09:00 committed by GitHub
commit c4cc9dae87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
271 changed files with 3016 additions and 4582 deletions

View file

@ -160,14 +160,14 @@ id: 'aidx'
# Job concurrency per worker # Job concurrency per worker
#deliverJobConcurrency: 128 #deliverJobConcurrency: 128
#inboxJobConcurrency: 16 #inboxJobConcurrency: 16
#relashionshipJobConcurrency: 16 #relationshipJobConcurrency: 16
# What's relashionshipJob?: # What's relationshipJob?:
# Follow, unfollow, block and unblock(ings) while following-imports, etc. or account migrations. # Follow, unfollow, block and unblock(ings) while following-imports, etc. or account migrations.
# Job rate limiter # Job rate limiter
#deliverJobPerSec: 128 #deliverJobPerSec: 128
#inboxJobPerSec: 32 #inboxJobPerSec: 32
#relashionshipJobPerSec: 64 #relationshipJobPerSec: 64
# Job attempts # Job attempts
#deliverJobMaxAttempts: 12 #deliverJobMaxAttempts: 12

View file

@ -45,11 +45,19 @@
- Enhance: ノート作成画面のファイル添付メニューから直接ファイルを削除できるように - Enhance: ノート作成画面のファイル添付メニューから直接ファイルを削除できるように
- Enhance: MFMの属性でオートコンプリートが使用できるように #12735 - Enhance: MFMの属性でオートコンプリートが使用できるように #12735
- Enhance: 絵文字編集ダイアログをモーダルではなくウィンドウで表示するように - Enhance: 絵文字編集ダイアログをモーダルではなくウィンドウで表示するように
- Enhance: リモートのユーザーはメニューから直接リモートで表示できるように
- Fix: ネイティブモードの絵文字がモノクロにならないように - Fix: ネイティブモードの絵文字がモノクロにならないように
- Fix: v2023.12.0で追加された「モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能」が管理画面上で正しく表示されていない問題を修正 - Fix: v2023.12.0で追加された「モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能」が管理画面上で正しく表示されていない問題を修正
- Fix: AiScriptの`readline`関数が不正な値を返すことがある問題のv2023.12.0時点での修正がPlay以外に適用されていないのを修正 - Fix: AiScriptの`readline`関数が不正な値を返すことがある問題のv2023.12.0時点での修正がPlay以外に適用されていないのを修正
- Fix: v2023.12.1で追加された`$[clickable ...]`および`onClickEv`が正しく機能していないのを修正 - Fix: v2023.12.1で追加された`$[clickable ...]`および`onClickEv`が正しく機能していないのを修正
- Fix: Renoteのキーボードショートカットが機能していなかった問題を修正
- Fix: 投稿フォームでアンケートの日時指定をした状態で再読み込みをすると期日が復元されない問題を修正
- Fix: アンケートを設定したノートを「削除して編集」をするとアンケートの期日が引き継がれず、リセットされてしまう問題を修正
- Fix: デッキのプロファイル作成時に名前を空にできる問題を修正
- Fix: テーマ作成時に名称が空欄でも作成できてしまう問題を修正
- Fix: プラグインで`Plugin:register_note_post_interruptor`を使用すると、ノートが投稿できなくなる問題を修正
- Enhance: ページ遷移時にPlayerを閉じるように - Enhance: ページ遷移時にPlayerを閉じるように
- Fix: iOSで大きな画像を変換してアップロードできない問題を修正
### Server ### Server
- Enhance: 連合先のレートリミットに引っかかった際にリトライするようになりました - Enhance: 連合先のレートリミットに引っかかった際にリトライするようになりました
@ -62,6 +70,7 @@
- Fix: `notes/create`で、`text`が空白文字のみで構成されていてかつリノート、ファイルまたは投票を含んでいるリクエストに対するレスポンスの`text`が`""`から`null`になるように変更 - Fix: `notes/create`で、`text`が空白文字のみで構成されていてかつリノート、ファイルまたは投票を含んでいるリクエストに対するレスポンスの`text`が`""`から`null`になるように変更
- Fix: ipv4とipv6の両方が利用可能な環境でallowedPrivateNetworksが設定されていた場合プライベートipの検証ができていなかった問題を修正 - Fix: ipv4とipv6の両方が利用可能な環境でallowedPrivateNetworksが設定されていた場合プライベートipの検証ができていなかった問題を修正
- Fix: properly handle cc followers - Fix: properly handle cc followers
- Fix: ジョブに関する設定の名前を修正 relashionshipJobPerSec -> relationshipJobPerSec
### Service Worker ### Service Worker
- Enhance: オフライン表示のデザインを改善・多言語対応 - Enhance: オフライン表示のデザインを改善・多言語対応

30
cypress/e2e/router.cy.js Normal file
View file

@ -0,0 +1,30 @@
describe('Router transition', () => {
describe('Redirect', () => {
// サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う使いまわした方が早い
before(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
// ユーザー作成
cy.registerUser('alice', 'alice1234');
cy.login('alice', 'alice1234');
// アカウント初期設定ウィザード
// 表示に時間がかかるのでデフォルト秒数だとタイムアウトする
cy.get('[data-cy-user-setup] [data-cy-modal-window-close]', { timeout: 12000 }).click();
cy.wait(500);
cy.get('[data-cy-modal-dialog-ok]').click();
});
it('redirect to user profile', () => {
// テストのためだけに用意されたリダイレクト用ルートに飛ぶ
cy.visit('/redirect-test');
// プロフィールページのURLであることを確認する
cy.url().should('include', '/@alice')
});
});
});

2
locales/index.d.ts vendored
View file

@ -5010,7 +5010,7 @@ export interface Locale extends ILocale {
*/ */
"readConfirmText": ParameterizedString<"title">; "readConfirmText": ParameterizedString<"title">;
/** /**
* UXを損ねる可能性が高いため使 * UXを損ねる可能性が高いため使
*/ */
"shouldNotBeUsedToPresentPermanentInfo": string; "shouldNotBeUsedToPresentPermanentInfo": string;
/** /**

View file

@ -1255,7 +1255,7 @@ _announcement:
tooManyActiveAnnouncementDescription: "アクティブなお知らせが多いため、UXが低下する可能性があります。終了したお知らせはアーカイブすることを検討してください。" tooManyActiveAnnouncementDescription: "アクティブなお知らせが多いため、UXが低下する可能性があります。終了したお知らせはアーカイブすることを検討してください。"
readConfirmTitle: "既読にしますか?" readConfirmTitle: "既読にしますか?"
readConfirmText: "「{title}」の内容を読み、既読にします。" readConfirmText: "「{title}」の内容を読み、既読にします。"
shouldNotBeUsedToPresentPermanentInfo: "特に新規ユーザーのUXを損ねる可能性が高いため、ストック情報ではなくフロー情報の掲示にお知らせを使用することを推奨します。" shouldNotBeUsedToPresentPermanentInfo: "特に新規ユーザーのUXを損ねる可能性が高いため、常時掲示するための情報ではなく、即時性が求められる情報の掲示のためにお知らせを使用することを推奨します。"
dialogAnnouncementUxWarn: "ダイアログ形式のお知らせが同時に2つ以上ある場合、UXに悪影響を及ぼす可能性が非常に高いため、使用は慎重に行うことを推奨します。" dialogAnnouncementUxWarn: "ダイアログ形式のお知らせが同時に2つ以上ある場合、UXに悪影響を及ぼす可能性が非常に高いため、使用は慎重に行うことを推奨します。"
silence: "非通知" silence: "非通知"
silenceDescription: "オンにすると、このお知らせは通知されず、既読にする必要もなくなります。" silenceDescription: "オンにすると、このお知らせは通知されず、既読にする必要もなくなります。"

View file

@ -35,17 +35,17 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"@swc/core-android-arm64": "1.3.11", "@swc/core-android-arm64": "1.3.11",
"@swc/core-darwin-arm64": "1.3.105", "@swc/core-darwin-arm64": "1.3.107",
"@swc/core-darwin-x64": "1.3.105", "@swc/core-darwin-x64": "1.3.107",
"@swc/core-freebsd-x64": "1.3.11", "@swc/core-freebsd-x64": "1.3.11",
"@swc/core-linux-arm-gnueabihf": "1.3.105", "@swc/core-linux-arm-gnueabihf": "1.3.107",
"@swc/core-linux-arm64-gnu": "1.3.105", "@swc/core-linux-arm64-gnu": "1.3.107",
"@swc/core-linux-arm64-musl": "1.3.105", "@swc/core-linux-arm64-musl": "1.3.107",
"@swc/core-linux-x64-gnu": "1.3.105", "@swc/core-linux-x64-gnu": "1.3.107",
"@swc/core-linux-x64-musl": "1.3.105", "@swc/core-linux-x64-musl": "1.3.107",
"@swc/core-win32-arm64-msvc": "1.3.105", "@swc/core-win32-arm64-msvc": "1.3.107",
"@swc/core-win32-ia32-msvc": "1.3.105", "@swc/core-win32-ia32-msvc": "1.3.107",
"@swc/core-win32-x64-msvc": "1.3.105", "@swc/core-win32-x64-msvc": "1.3.107",
"@tensorflow/tfjs": "4.4.0", "@tensorflow/tfjs": "4.4.0",
"@tensorflow/tfjs-node": "4.4.0", "@tensorflow/tfjs-node": "4.4.0",
"bufferutil": "4.0.8", "bufferutil": "4.0.8",
@ -67,9 +67,9 @@
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "3.412.0", "@aws-sdk/client-s3": "3.412.0",
"@aws-sdk/lib-storage": "3.412.0", "@aws-sdk/lib-storage": "3.412.0",
"@bull-board/api": "5.13.0", "@bull-board/api": "5.14.0",
"@bull-board/fastify": "5.13.0", "@bull-board/fastify": "5.14.0",
"@bull-board/ui": "5.13.0", "@bull-board/ui": "5.14.0",
"@discordapp/twemoji": "15.0.2", "@discordapp/twemoji": "15.0.2",
"@fastify/accepts": "4.3.0", "@fastify/accepts": "4.3.0",
"@fastify/cookie": "9.3.1", "@fastify/cookie": "9.3.1",
@ -85,11 +85,11 @@
"@nestjs/core": "10.3.1", "@nestjs/core": "10.3.1",
"@nestjs/testing": "10.3.1", "@nestjs/testing": "10.3.1",
"@peertube/http-signature": "1.7.0", "@peertube/http-signature": "1.7.0",
"@simplewebauthn/server": "9.0.0", "@simplewebauthn/server": "9.0.1",
"@sinonjs/fake-timers": "11.2.2", "@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "2.3.1", "@smithy/node-http-handler": "2.3.1",
"@swc/cli": "0.1.65", "@swc/cli": "0.1.65",
"@swc/core": "1.3.105", "@swc/core": "1.3.107",
"@twemoji/parser": "15.0.0", "@twemoji/parser": "15.0.0",
"accepts": "1.3.8", "accepts": "1.3.8",
"ajv": "8.12.0", "ajv": "8.12.0",
@ -109,13 +109,13 @@
"content-disposition": "0.5.4", "content-disposition": "0.5.4",
"date-fns": "2.30.0", "date-fns": "2.30.0",
"deep-email-validator": "0.1.21", "deep-email-validator": "0.1.21",
"fastify": "4.25.2", "fastify": "4.26.0",
"fastify-raw-body": "4.3.0", "fastify-raw-body": "4.3.0",
"feed": "4.2.2", "feed": "4.2.2",
"file-type": "19.0.0", "file-type": "19.0.0",
"fluent-ffmpeg": "2.1.2", "fluent-ffmpeg": "2.1.2",
"form-data": "4.0.0", "form-data": "4.0.0",
"got": "14.0.0", "got": "14.1.0",
"happy-dom": "10.0.3", "happy-dom": "10.0.3",
"hpagent": "1.2.0", "hpagent": "1.2.0",
"http-link-header": "1.1.1", "http-link-header": "1.1.1",
@ -149,7 +149,7 @@
"pg": "8.11.3", "pg": "8.11.3",
"pino": "8.17.2", "pino": "8.17.2",
"pino-pretty": "10.3.1", "pino-pretty": "10.3.1",
"pkce-challenge": "4.0.1", "pkce-challenge": "4.1.0",
"probe-image-size": "7.2.3", "probe-image-size": "7.2.3",
"promise-limit": "2.7.0", "promise-limit": "2.7.0",
"pug": "3.0.2", "pug": "3.0.2",
@ -175,7 +175,7 @@
"tmp": "0.2.1", "tmp": "0.2.1",
"tsc-alias": "1.8.8", "tsc-alias": "1.8.8",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"typeorm": "0.3.19", "typeorm": "0.3.20",
"typescript": "5.3.3", "typescript": "5.3.3",
"ulid": "2.3.0", "ulid": "2.3.0",
"vary": "1.1.2", "vary": "1.1.2",
@ -187,7 +187,7 @@
"@jest/globals": "29.7.0", "@jest/globals": "29.7.0",
"@misskey-dev/eslint-plugin": "1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@nestjs/platform-express": "10.3.1", "@nestjs/platform-express": "10.3.1",
"@simplewebauthn/types": "9.0.0", "@simplewebauthn/types": "9.0.1",
"@swc/jest": "0.2.31", "@swc/jest": "0.2.31",
"@types/accepts": "1.3.7", "@types/accepts": "1.3.7",
"@types/archiver": "6.0.2", "@types/archiver": "6.0.2",
@ -204,12 +204,12 @@
"@types/jsrsasign": "10.5.12", "@types/jsrsasign": "10.5.12",
"@types/mime-types": "2.1.4", "@types/mime-types": "2.1.4",
"@types/ms": "0.7.34", "@types/ms": "0.7.34",
"@types/node": "20.11.6", "@types/node": "20.11.10",
"@types/nodemailer": "6.4.14", "@types/nodemailer": "6.4.14",
"@types/oauth": "0.9.4", "@types/oauth": "0.9.4",
"@types/oauth2orize": "1.11.3", "@types/oauth2orize": "1.11.3",
"@types/oauth2orize-pkce": "0.1.2", "@types/oauth2orize-pkce": "0.1.2",
"@types/pg": "8.10.9", "@types/pg": "8.11.0",
"@types/pug": "2.0.10", "@types/pug": "2.0.10",
"@types/punycode": "2.1.3", "@types/punycode": "2.1.3",
"@types/qrcode": "1.5.5", "@types/qrcode": "1.5.5",

View file

@ -88,10 +88,10 @@ type Source = {
bullmqWorkerOptions?: Partial<Bull.WorkerOptions>; bullmqWorkerOptions?: Partial<Bull.WorkerOptions>;
deliverJobConcurrency?: number; deliverJobConcurrency?: number;
inboxJobConcurrency?: number; inboxJobConcurrency?: number;
relashionshipJobConcurrency?: number; relationshipJobConcurrency?: number;
deliverJobPerSec?: number; deliverJobPerSec?: number;
inboxJobPerSec?: number; inboxJobPerSec?: number;
relashionshipJobPerSec?: number; relationshipJobPerSec?: number;
deliverJobMaxAttempts?: number; deliverJobMaxAttempts?: number;
inboxJobMaxAttempts?: number; inboxJobMaxAttempts?: number;
@ -152,10 +152,10 @@ export type Config = {
bullmqWorkerOptions: Partial<Bull.WorkerOptions>; bullmqWorkerOptions: Partial<Bull.WorkerOptions>;
deliverJobConcurrency: number | undefined; deliverJobConcurrency: number | undefined;
inboxJobConcurrency: number | undefined; inboxJobConcurrency: number | undefined;
relashionshipJobConcurrency: number | undefined; relationshipJobConcurrency: number | undefined;
deliverJobPerSec: number | undefined; deliverJobPerSec: number | undefined;
inboxJobPerSec: number | undefined; inboxJobPerSec: number | undefined;
relashionshipJobPerSec: number | undefined; relationshipJobPerSec: number | undefined;
deliverJobMaxAttempts: number | undefined; deliverJobMaxAttempts: number | undefined;
inboxJobMaxAttempts: number | undefined; inboxJobMaxAttempts: number | undefined;
proxyRemoteFiles: boolean | undefined; proxyRemoteFiles: boolean | undefined;
@ -278,10 +278,10 @@ export function loadConfig(): Config {
bullmqWorkerOptions: config.bullmqWorkerOptions ?? {}, bullmqWorkerOptions: config.bullmqWorkerOptions ?? {},
deliverJobConcurrency: config.deliverJobConcurrency, deliverJobConcurrency: config.deliverJobConcurrency,
inboxJobConcurrency: config.inboxJobConcurrency, inboxJobConcurrency: config.inboxJobConcurrency,
relashionshipJobConcurrency: config.relashionshipJobConcurrency, relationshipJobConcurrency: config.relationshipJobConcurrency,
deliverJobPerSec: config.deliverJobPerSec, deliverJobPerSec: config.deliverJobPerSec,
inboxJobPerSec: config.inboxJobPerSec, inboxJobPerSec: config.inboxJobPerSec,
relashionshipJobPerSec: config.relashionshipJobPerSec, relationshipJobPerSec: config.relationshipJobPerSec,
deliverJobMaxAttempts: config.deliverJobMaxAttempts, deliverJobMaxAttempts: config.deliverJobMaxAttempts,
inboxJobMaxAttempts: config.inboxJobMaxAttempts, inboxJobMaxAttempts: config.inboxJobMaxAttempts,
proxyRemoteFiles: config.proxyRemoteFiles, proxyRemoteFiles: config.proxyRemoteFiles,

View file

@ -97,7 +97,7 @@ export class AccountMoveService {
await this.apDeliverManagerService.deliverToFollowers(src, moveAct); await this.apDeliverManagerService.deliverToFollowers(src, moveAct);
// Publish meUpdated event // Publish meUpdated event
const iObj = await this.userEntityService.pack<true, true>(src.id, src, { detail: true, includeSecrets: true }); const iObj = await this.userEntityService.pack(src.id, src, { schema: 'MeDetailed', includeSecrets: true });
this.globalEventService.publishMainStream(src.id, 'meUpdated', iObj); this.globalEventService.publishMainStream(src.id, 'meUpdated', iObj);
// Unfollow after 24 hours // Unfollow after 24 hours

View file

@ -169,7 +169,7 @@ export class AnnouncementService {
id: In(announcements.map(a => a.userId).filter(id => id != null)), id: In(announcements.map(a => a.userId).filter(id => id != null)),
}); });
const packedUsers = await this.userEntityService.packMany(users, moderator, { const packedUsers = await this.userEntityService.packMany(users, moderator, {
detail: false, schema: 'UserLite'
}); });
return announcements.map(announcement => ({ return announcements.map(announcement => ({

View file

@ -54,15 +54,15 @@ export interface MainEventTypes {
reply: Packed<'Note'>; reply: Packed<'Note'>;
renote: Packed<'Note'>; renote: Packed<'Note'>;
follow: Packed<'UserDetailedNotMe'>; follow: Packed<'UserDetailedNotMe'>;
followed: Packed<'User'>; followed: Packed<'UserLite'>;
unfollow: Packed<'User'>; unfollow: Packed<'UserDetailedNotMe'>;
meUpdated: Packed<'User'>; meUpdated: Packed<'MeDetailed'>;
pageEvent: { pageEvent: {
pageId: MiPage['id']; pageId: MiPage['id'];
event: string; event: string;
var: any; var: any;
userId: MiUser['id']; userId: MiUser['id'];
user: Packed<'User'>; user: Packed<'UserDetailed'>;
}; };
urlUploadFinished: { urlUploadFinished: {
marker?: string | null; marker?: string | null;
@ -92,7 +92,7 @@ export interface MainEventTypes {
}; };
driveFileCreated: Packed<'DriveFile'>; driveFileCreated: Packed<'DriveFile'>;
readAntenna: MiAntenna; readAntenna: MiAntenna;
receiveFollowRequest: Packed<'User'>; receiveFollowRequest: Packed<'UserLite'>;
announcementCreated: { announcementCreated: {
announcement: Packed<'Announcement'>; announcement: Packed<'Announcement'>;
}; };
@ -140,8 +140,8 @@ type NoteStreamEventTypes = {
}; };
export interface UserListEventTypes { export interface UserListEventTypes {
userAdded: Packed<'User'>; userAdded: Packed<'UserLite'>;
userRemoved: Packed<'User'>; userRemoved: Packed<'UserLite'>;
} }
export interface AntennaEventTypes { export interface AntennaEventTypes {

View file

@ -109,13 +109,13 @@ export class UserBlockingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(followee)) { if (this.userEntityService.isLocalUser(followee)) {
this.userEntityService.pack(followee, followee, { this.userEntityService.pack(followee, followee, {
detail: true, schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed)); }).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
} }
if (this.userEntityService.isLocalUser(follower) && !silent) { if (this.userEntityService.isLocalUser(follower) && !silent) {
this.userEntityService.pack(followee, follower, { this.userEntityService.pack(followee, follower, {
detail: true, schema: 'UserDetailedNotMe',
}).then(async packed => { }).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'unfollow', packed); this.globalEventService.publishMainStream(follower.id, 'unfollow', packed);

View file

@ -13,7 +13,6 @@ import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
import { GlobalEventService } from '@/core/GlobalEventService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js';
import { IdService } from '@/core/IdService.js'; import { IdService } from '@/core/IdService.js';
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
import type { Packed } from '@/misc/json-schema.js';
import InstanceChart from '@/core/chart/charts/instance.js'; import InstanceChart from '@/core/chart/charts/instance.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { WebhookService } from '@/core/WebhookService.js'; import { WebhookService } from '@/core/WebhookService.js';
@ -293,9 +292,9 @@ export class UserFollowingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(follower) && !silent) { if (this.userEntityService.isLocalUser(follower) && !silent) {
// Publish follow event // Publish follow event
this.userEntityService.pack(followee.id, follower, { this.userEntityService.pack(followee.id, follower, {
detail: true, schema: 'UserDetailedNotMe',
}).then(async packed => { }).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'follow', packed as Packed<'UserDetailedNotMe'>); this.globalEventService.publishMainStream(follower.id, 'follow', packed);
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === follower.id && x.on.includes('follow')); const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === follower.id && x.on.includes('follow'));
for (const webhook of webhooks) { for (const webhook of webhooks) {
@ -360,7 +359,7 @@ export class UserFollowingService implements OnModuleInit {
if (!silent && this.userEntityService.isLocalUser(follower)) { if (!silent && this.userEntityService.isLocalUser(follower)) {
// Publish unfollow event // Publish unfollow event
this.userEntityService.pack(followee.id, follower, { this.userEntityService.pack(followee.id, follower, {
detail: true, schema: 'UserDetailedNotMe',
}).then(async packed => { }).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'unfollow', packed); this.globalEventService.publishMainStream(follower.id, 'unfollow', packed);
@ -500,7 +499,7 @@ export class UserFollowingService implements OnModuleInit {
this.userEntityService.pack(follower.id, followee).then(packed => this.globalEventService.publishMainStream(followee.id, 'receiveFollowRequest', packed)); this.userEntityService.pack(follower.id, followee).then(packed => this.globalEventService.publishMainStream(followee.id, 'receiveFollowRequest', packed));
this.userEntityService.pack(followee.id, followee, { this.userEntityService.pack(followee.id, followee, {
detail: true, schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed)); }).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
// 通知を作成 // 通知を作成
@ -548,7 +547,7 @@ export class UserFollowingService implements OnModuleInit {
}); });
this.userEntityService.pack(followee.id, followee, { this.userEntityService.pack(followee.id, followee, {
detail: true, schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed)); }).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
} }
@ -576,7 +575,7 @@ export class UserFollowingService implements OnModuleInit {
} }
this.userEntityService.pack(followee.id, followee, { this.userEntityService.pack(followee.id, followee, {
detail: true, schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed)); }).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
} }
@ -696,7 +695,7 @@ export class UserFollowingService implements OnModuleInit {
@bindThis @bindThis
private async publishUnfollow(followee: Both, follower: Local): Promise<void> { private async publishUnfollow(followee: Both, follower: Local): Promise<void> {
const packedFollowee = await this.userEntityService.pack(followee.id, follower, { const packedFollowee = await this.userEntityService.pack(followee.id, follower, {
detail: true, schema: 'UserDetailedNotMe',
}); });
this.globalEventService.publishMainStream(follower.id, 'unfollow', packedFollowee); this.globalEventService.publishMainStream(follower.id, 'unfollow', packedFollowee);

View file

@ -94,6 +94,29 @@ type ToJsonSchema<S> = {
}; };
export function getJsonSchema<S extends Schema>(schema: S): ToJsonSchema<Unflatten<ChartResult<S>>> { export function getJsonSchema<S extends Schema>(schema: S): ToJsonSchema<Unflatten<ChartResult<S>>> {
const unflatten = (str: string, parent: Record<string, any>) => {
const keys = str.split('.');
const key = keys.shift();
const nextKey = keys[0];
if (key == null) return;
if (parent.properties[key] == null) {
parent.properties[key] = nextKey ? {
type: 'object',
properties: {},
required: [],
} : {
type: 'array',
items: {
type: 'number',
},
};
}
if (nextKey) unflatten(keys.join('.'), parent.properties[key] as Record<string, any>);
};
const jsonSchema = { const jsonSchema = {
type: 'object', type: 'object',
properties: {} as Record<string, unknown>, properties: {} as Record<string, unknown>,
@ -101,10 +124,7 @@ export function getJsonSchema<S extends Schema>(schema: S): ToJsonSchema<Unflatt
}; };
for (const k in schema) { for (const k in schema) {
jsonSchema.properties[k] = { unflatten(k, jsonSchema);
type: 'array',
items: { type: 'number' },
};
} }
return jsonSchema as ToJsonSchema<Unflatten<ChartResult<S>>>; return jsonSchema as ToJsonSchema<Unflatten<ChartResult<S>>>;

View file

@ -41,13 +41,13 @@ export class AbuseUserReportEntityService {
targetUserId: report.targetUserId, targetUserId: report.targetUserId,
assigneeId: report.assigneeId, assigneeId: report.assigneeId,
reporter: this.userEntityService.pack(report.reporter ?? report.reporterId, me, { reporter: this.userEntityService.pack(report.reporter ?? report.reporterId, me, {
detail: true, schema: 'UserDetailed',
}), }),
targetUser: this.userEntityService.pack(report.targetUser ?? report.targetUserId, me, { targetUser: this.userEntityService.pack(report.targetUser ?? report.targetUserId, me, {
detail: true, schema: 'UserDetailed',
}), }),
assignee: report.assigneeId ? this.userEntityService.pack(report.assignee ?? report.assigneeId, me, { assignee: report.assigneeId ? this.userEntityService.pack(report.assignee ?? report.assigneeId, me, {
detail: true, schema: 'UserDetailed',
}) : null, }) : null,
forwarded: report.forwarded, forwarded: report.forwarded,
category: report.category, category: report.category,

View file

@ -37,7 +37,7 @@ export class BlockingEntityService {
createdAt: this.idService.parse(blocking.id).date.toISOString(), createdAt: this.idService.parse(blocking.id).date.toISOString(),
blockeeId: blocking.blockeeId, blockeeId: blocking.blockeeId,
blockee: this.userEntityService.pack(blocking.blockeeId, me, { blockee: this.userEntityService.pack(blocking.blockeeId, me, {
detail: true, schema: 'UserDetailedNotMe',
}), }),
}); });
} }

View file

@ -41,7 +41,7 @@ export class FlashEntityService {
createdAt: this.idService.parse(flash.id).date.toISOString(), createdAt: this.idService.parse(flash.id).date.toISOString(),
updatedAt: flash.updatedAt.toISOString(), updatedAt: flash.updatedAt.toISOString(),
userId: flash.userId, userId: flash.userId,
user: this.userEntityService.pack(flash.user ?? flash.userId, me), // { detail: true } すると無限ループするので注意 user: this.userEntityService.pack(flash.user ?? flash.userId, me), // { schema: 'UserDetailed' } すると無限ループするので注意
title: flash.title, title: flash.title,
summary: flash.summary, summary: flash.summary,
script: flash.script, script: flash.script,

View file

@ -88,10 +88,10 @@ export class FollowingEntityService {
followeeId: following.followeeId, followeeId: following.followeeId,
followerId: following.followerId, followerId: following.followerId,
followee: opts.populateFollowee ? this.userEntityService.pack(following.followee ?? following.followeeId, me, { followee: opts.populateFollowee ? this.userEntityService.pack(following.followee ?? following.followeeId, me, {
detail: true, schema: 'UserDetailedNotMe',
}) : undefined, }) : undefined,
follower: opts.populateFollower ? this.userEntityService.pack(following.follower ?? following.followerId, me, { follower: opts.populateFollower ? this.userEntityService.pack(following.follower ?? following.followerId, me, {
detail: true, schema: 'UserDetailedNotMe',
}) : undefined, }) : undefined,
}); });
} }

View file

@ -39,7 +39,7 @@ export class ModerationLogEntityService {
info: log.info, info: log.info,
userId: log.userId, userId: log.userId,
user: this.userEntityService.pack(log.user ?? log.userId, me, { user: this.userEntityService.pack(log.user ?? log.userId, me, {
detail: true, schema: 'UserDetailed',
}), }),
}); });
} }

View file

@ -38,7 +38,7 @@ export class MutingEntityService {
expiresAt: muting.expiresAt ? muting.expiresAt.toISOString() : null, expiresAt: muting.expiresAt ? muting.expiresAt.toISOString() : null,
muteeId: muting.muteeId, muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, { mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true, schema: 'UserDetailedNotMe',
}), }),
}); });
} }

View file

@ -164,7 +164,7 @@ export class NoteEntityService implements OnModuleInit {
return { return {
multiple: poll.multiple, multiple: poll.multiple,
expiresAt: poll.expiresAt, expiresAt: poll.expiresAt?.toISOString() ?? null,
choices, choices,
}; };
} }
@ -329,9 +329,7 @@ export class NoteEntityService implements OnModuleInit {
id: note.id, id: note.id,
createdAt: this.idService.parse(note.id).date.toISOString(), createdAt: this.idService.parse(note.id).date.toISOString(),
userId: note.userId, userId: note.userId,
user: this.userEntityService.pack(note.user ?? note.userId, me, { user: this.userEntityService.pack(note.user ?? note.userId, me),
detail: false,
}),
text: text, text: text,
cw: note.cw, cw: note.cw,
visibility: note.visibility, visibility: note.visibility,

View file

@ -62,7 +62,7 @@ export class NotificationEntityService implements OnModuleInit {
}, },
hint?: { hint?: {
packedNotes: Map<MiNote['id'], Packed<'Note'>>; packedNotes: Map<MiNote['id'], Packed<'Note'>>;
packedUsers: Map<MiUser['id'], Packed<'User'>>; packedUsers: Map<MiUser['id'], Packed<'UserLite'>>;
}, },
): Promise<Packed<'Notification'>> { ): Promise<Packed<'Notification'>> {
const notification = src; const notification = src;
@ -76,9 +76,7 @@ export class NotificationEntityService implements OnModuleInit {
const userIfNeed = 'notifierId' in notification ? ( const userIfNeed = 'notifierId' in notification ? (
hint?.packedUsers != null hint?.packedUsers != null
? hint.packedUsers.get(notification.notifierId) ? hint.packedUsers.get(notification.notifierId)
: this.userEntityService.pack(notification.notifierId, { id: meId }, { : this.userEntityService.pack(notification.notifierId, { id: meId })
detail: false,
})
) : undefined; ) : undefined;
const role = notification.type === 'roleAssigned' ? await this.roleEntityService.pack(notification.roleId, { id: meId }) : undefined; const role = notification.type === 'roleAssigned' ? await this.roleEntityService.pack(notification.roleId, { id: meId }) : undefined;
@ -131,9 +129,7 @@ export class NotificationEntityService implements OnModuleInit {
const users = userIds.length > 0 ? await this.usersRepository.find({ const users = userIds.length > 0 ? await this.usersRepository.find({
where: { id: In(userIds) }, where: { id: In(userIds) },
}) : []; }) : [];
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId }, { const packedUsersArray = await this.userEntityService.packMany(users, { id: meId });
detail: false,
});
const packedUsers = new Map(packedUsersArray.map(p => [p.id, p])); const packedUsers = new Map(packedUsersArray.map(p => [p.id, p]));
// 既に解決されたフォローリクエストの通知を除外 // 既に解決されたフォローリクエストの通知を除外
@ -160,7 +156,7 @@ export class NotificationEntityService implements OnModuleInit {
}, },
hint?: { hint?: {
packedNotes: Map<MiNote['id'], Packed<'Note'>>; packedNotes: Map<MiNote['id'], Packed<'Note'>>;
packedUsers: Map<MiUser['id'], Packed<'User'>>; packedUsers: Map<MiUser['id'], Packed<'UserLite'>>;
}, },
): Promise<Packed<'Notification'>> { ): Promise<Packed<'Notification'>> {
const notification = src; const notification = src;
@ -174,18 +170,14 @@ export class NotificationEntityService implements OnModuleInit {
const userIfNeed = 'notifierId' in notification ? ( const userIfNeed = 'notifierId' in notification ? (
hint?.packedUsers != null hint?.packedUsers != null
? hint.packedUsers.get(notification.notifierId) ? hint.packedUsers.get(notification.notifierId)
: this.userEntityService.pack(notification.notifierId, { id: meId }, { : this.userEntityService.pack(notification.notifierId, { id: meId })
detail: false,
})
) : undefined; ) : undefined;
if (notification.type === 'reaction:grouped') { if (notification.type === 'reaction:grouped') {
const reactions = await Promise.allSettled(notification.reactions.map(async reaction => { const reactions = await Promise.allSettled(notification.reactions.map(async reaction => {
const user = hint?.packedUsers != null const user = hint?.packedUsers != null
? hint.packedUsers.get(reaction.userId)! ? hint.packedUsers.get(reaction.userId)!
: await this.userEntityService.pack(reaction.userId, { id: meId }, { : await this.userEntityService.pack(reaction.userId, { id: meId });
detail: false,
});
return { return {
user, user,
reaction: reaction.reaction, reaction: reaction.reaction,
@ -206,9 +198,7 @@ export class NotificationEntityService implements OnModuleInit {
return packedUser; return packedUser;
} }
return this.userEntityService.pack(userId, { id: meId }, { return this.userEntityService.pack(userId, { id: meId });
detail: false,
});
})); }));
return await awaitAll({ return await awaitAll({
id: notification.id, id: notification.id,
@ -276,9 +266,7 @@ export class NotificationEntityService implements OnModuleInit {
const users = userIds.length > 0 ? await this.usersRepository.find({ const users = userIds.length > 0 ? await this.usersRepository.find({
where: { id: In(userIds) }, where: { id: In(userIds) },
}) : []; }) : [];
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId }, { const packedUsersArray = await this.userEntityService.packMany(users, { id: meId });
detail: false,
});
const packedUsers = new Map(packedUsersArray.map(p => [p.id, p])); const packedUsers = new Map(packedUsersArray.map(p => [p.id, p]));
// 既に解決されたフォローリクエストの通知を除外 // 既に解決されたフォローリクエストの通知を除外

View file

@ -89,7 +89,7 @@ export class PageEntityService {
createdAt: this.idService.parse(page.id).date.toISOString(), createdAt: this.idService.parse(page.id).date.toISOString(),
updatedAt: page.updatedAt.toISOString(), updatedAt: page.updatedAt.toISOString(),
userId: page.userId, userId: page.userId,
user: this.userEntityService.pack(page.user ?? page.userId, me), // { detail: true } すると無限ループするので注意 user: this.userEntityService.pack(page.user ?? page.userId, me), // { schema: 'UserDetailed' } すると無限ループするので注意
content: page.content, content: page.content,
variables: page.variables, variables: page.variables,
title: page.title, title: page.title,

View file

@ -37,7 +37,7 @@ export class RenoteMutingEntityService {
createdAt: this.idService.parse(muting.id).date.toISOString(), createdAt: this.idService.parse(muting.id).date.toISOString(),
muteeId: muting.muteeId, muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, { mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true, schema: 'UserDetailedNotMe',
}), }),
}); });
} }

View file

@ -31,14 +31,6 @@ import type { NoteEntityService } from './NoteEntityService.js';
import type { DriveFileEntityService } from './DriveFileEntityService.js'; import type { DriveFileEntityService } from './DriveFileEntityService.js';
import type { PageEntityService } from './PageEntityService.js'; import type { PageEntityService } from './PageEntityService.js';
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
Detailed extends true ?
ExpectsMe extends true ? Packed<'MeDetailed'> :
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
Packed<'UserDetailed'> :
Packed<'UserLite'>;
const Ajv = _Ajv.default; const Ajv = _Ajv.default;
const ajv = new Ajv(); const ajv = new Ajv();
@ -304,34 +296,35 @@ export class UserEntityService implements OnModuleInit {
return `${this.config.url}/users/${userId}`; return `${this.config.url}/users/${userId}`;
} }
public async pack<ExpectsMe extends boolean | null = null, D extends boolean = false>( public async pack<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
src: MiUser['id'] | MiUser, src: MiUser['id'] | MiUser,
me: { id: MiUser['id'] } | null | undefined, me: { id: MiUser['id'] } | null | undefined,
options?: { options?: {
detail?: D, schema?: S,
includeSecrets?: boolean, includeSecrets?: boolean,
userProfile?: MiUserProfile, userProfile?: MiUserProfile,
}, },
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> { ): Promise<Packed<S>> {
const opts = Object.assign({ const opts = Object.assign({
detail: false, schema: 'UserLite',
includeSecrets: false, includeSecrets: false,
}, options); }, options);
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src }); const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
const isDetailed = opts.schema !== 'UserLite';
const meId = me ? me.id : null; const meId = me ? me.id : null;
const isMe = meId === user.id; const isMe = meId === user.id;
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false; const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false;
if (user.isSuspended && !iAmModerator) throw new IdentifiableError('8ca4f428-b32e-4f83-ac43-406ed7cd0452', 'This user is suspended.'); if (user.isSuspended && !iAmModerator) throw new IdentifiableError('8ca4f428-b32e-4f83-ac43-406ed7cd0452', 'This user is suspended.');
const relation = meId && !isMe && opts.detail ? await this.getRelation(meId, user.id) : null; const relation = meId && !isMe && isDetailed ? await this.getRelation(meId, user.id) : null;
const pins = opts.detail ? await this.userNotePiningsRepository.createQueryBuilder('pin') const pins = isDetailed ? await this.userNotePiningsRepository.createQueryBuilder('pin')
.where('pin.userId = :userId', { userId: user.id }) .where('pin.userId = :userId', { userId: user.id })
.innerJoinAndSelect('pin.note', 'note') .innerJoinAndSelect('pin.note', 'note')
.orderBy('pin.id', 'DESC') .orderBy('pin.id', 'DESC')
.getMany() : []; .getMany() : [];
const profile = opts.detail ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null; const profile = isDetailed ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null;
const followingCount = profile == null ? null : const followingCount = profile == null ? null :
(profile.followingVisibility === 'public') || isMe ? user.followingCount : (profile.followingVisibility === 'public') || isMe ? user.followingCount :
@ -343,12 +336,12 @@ export class UserEntityService implements OnModuleInit {
(profile.followersVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount : (profile.followersVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount :
null; null;
const policies = opts.detail ? await this.roleService.getUserPolicies(user.id) : null; const policies = isDetailed ? await this.roleService.getUserPolicies(user.id) : null;
const isModerator = (isMe || iAmModerator) && opts.detail ? this.roleService.isModerator(user) : null; const isModerator = (isMe || iAmModerator) && isDetailed ? this.roleService.isModerator(user) : null;
const isAdmin = (isMe || iAmModerator) && opts.detail ? this.roleService.isAdministrator(user) : null; const isAdmin = (isMe || iAmModerator) && isDetailed ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && opts.detail ? await this.announcementService.getUnreadAnnouncements(user) : null; const unreadAnnouncements = isMe && isDetailed ? await this.announcementService.getUnreadAnnouncements(user) : null;
const notificationsInfo = isMe && opts.detail ? await this.getNotificationsInfo(user.id) : null; const notificationsInfo = isMe && isDetailed ? await this.getNotificationsInfo(user.id) : null;
const packed = { const packed = {
id: user.id, id: user.id,
@ -384,7 +377,7 @@ export class UserEntityService implements OnModuleInit {
displayOrder: r.displayOrder, displayOrder: r.displayOrder,
}))) : undefined, }))) : undefined,
...(opts.detail ? { ...(isDetailed ? {
url: profile!.url, url: profile!.url,
uri: user.uri, uri: user.uri,
movedTo: user.movedToUri ? this.apPersonService.resolvePerson(user.movedToUri).then(user => user.id).catch(() => null) : null, movedTo: user.movedToUri ? this.apPersonService.resolvePerson(user.movedToUri).then(user => user.id).catch(() => null) : null,
@ -447,7 +440,7 @@ export class UserEntityService implements OnModuleInit {
moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined, moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined,
} : {}), } : {}),
...(opts.detail && (isMe || iAmModerator) ? { ...(isDetailed && (isMe || iAmModerator) ? {
avatarId: user.avatarId, avatarId: user.avatarId,
bannerId: user.bannerId, bannerId: user.bannerId,
isModerator: isModerator, isModerator: isModerator,
@ -518,21 +511,21 @@ export class UserEntityService implements OnModuleInit {
notify: relation.following?.notify ?? 'none', notify: relation.following?.notify ?? 'none',
withReplies: relation.following?.withReplies ?? false, withReplies: relation.following?.withReplies ?? false,
} : {}), } : {}),
} as Promiseable<Packed<'User'>> as Promiseable<IsMeAndIsUserDetailed<ExpectsMe, D>>; } as Promiseable<Packed<S>>;
return await awaitAll(packed); return await awaitAll(packed);
} }
public async packMany<D extends boolean = false>( public async packMany<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
users: (MiUser['id'] | MiUser)[], users: (MiUser['id'] | MiUser)[],
me: { id: MiUser['id'] } | null | undefined, me: { id: MiUser['id'] } | null | undefined,
options?: { options?: {
detail?: D, schema?: S,
includeSecrets?: boolean, includeSecrets?: boolean,
}, },
): Promise<IsUserDetailed<D>[]> { ): Promise<Packed<S>[]> {
return (await Promise.allSettled(users.map(u => this.pack(u, me, options)))) return (await Promise.allSettled(users.map(u => this.pack(u, me, options))))
.filter(result => result.status === 'fulfilled') .filter(result => result.status === 'fulfilled')
.map(result => (result as PromiseFulfilledResult<IsUserDetailed<D>>).value); .map(result => (result as PromiseFulfilledResult<Packed<S>>).value);
} }
} }

View file

@ -6,7 +6,7 @@
// structredCloneが遅いため // structredCloneが遅いため
// SEE: http://var.blog.jp/archives/86038606.html // SEE: http://var.blog.jp/archives/86038606.html
type Cloneable = string | number | boolean | null | { [key: string]: Cloneable } | Cloneable[]; type Cloneable = string | number | boolean | null | undefined | { [key: string]: Cloneable } | Cloneable[];
export function deepClone<T extends Cloneable>(x: T): T { export function deepClone<T extends Cloneable>(x: T): T {
if (typeof x === 'object') { if (typeof x === 'object') {
@ -14,7 +14,7 @@ export function deepClone<T extends Cloneable>(x: T): T {
if (Array.isArray(x)) return x.map(deepClone) as T; if (Array.isArray(x)) return x.map(deepClone) as T;
const obj = {} as Record<string, Cloneable>; const obj = {} as Record<string, Cloneable>;
for (const [k, v] of Object.entries(x)) { for (const [k, v] of Object.entries(x)) {
obj[k] = deepClone(v); obj[k] = v === undefined ? undefined : deepClone(v);
} }
return obj as T; return obj as T;
} else { } else {

View file

@ -32,14 +32,14 @@ import { packedNoteFavoriteSchema } from '@/models/json-schema/note-favorite.js'
import { packedNoteReactionSchema } from '@/models/json-schema/note-reaction.js'; import { packedNoteReactionSchema } from '@/models/json-schema/note-reaction.js';
import { packedNoteSchema } from '@/models/json-schema/note.js'; import { packedNoteSchema } from '@/models/json-schema/note.js';
import { packedNotificationSchema } from '@/models/json-schema/notification.js'; import { packedNotificationSchema } from '@/models/json-schema/notification.js';
import { packedPageLikeSchema, packedPageSchema } from '@/models/json-schema/page.js'; import { packedPageLikeSchema, packedPageBlockSchema, packedPageSchema } from '@/models/json-schema/page.js';
import { packedQueueCountSchema } from '@/models/json-schema/queue.js'; import { packedQueueCountSchema } from '@/models/json-schema/queue.js';
import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/json-schema/emoji.js'; import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/json-schema/emoji.js';
import { packedRenoteMutingSchema } from '@/models/json-schema/renote-muting.js'; import { packedRenoteMutingSchema } from '@/models/json-schema/renote-muting.js';
import { packedUserListMembershipSchema, packedUserListSchema } from '@/models/json-schema/user-list.js'; import { packedUserListMembershipSchema, packedUserListSchema } from '@/models/json-schema/user-list.js';
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js'; import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
import { packedSigninSchema } from '@/models/json-schema/signin.js'; import { packedSigninSchema } from '@/models/json-schema/signin.js';
import { packedRoleLiteSchema, packedRoleSchema } from '@/models/json-schema/role.js'; import { packedRoleLiteSchema, packedRoleSchema, packedRolePoliciesSchema } from '@/models/json-schema/role.js';
import { packedAdSchema } from '@/models/json-schema/ad.js'; import { packedAdSchema } from '@/models/json-schema/ad.js';
import { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js'; import { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js';
@ -71,6 +71,7 @@ export const refs = {
Hashtag: packedHashtagSchema, Hashtag: packedHashtagSchema,
InviteCode: packedInviteCodeSchema, InviteCode: packedInviteCodeSchema,
Page: packedPageSchema, Page: packedPageSchema,
PageBlock: packedPageBlockSchema,
PageLike: packedPageLikeSchema, PageLike: packedPageLikeSchema,
Channel: packedChannelSchema, Channel: packedChannelSchema,
QueueCount: packedQueueCountSchema, QueueCount: packedQueueCountSchema,
@ -87,6 +88,7 @@ export const refs = {
Signin: packedSigninSchema, Signin: packedSigninSchema,
RoleLite: packedRoleLiteSchema, RoleLite: packedRoleLiteSchema,
Role: packedRoleSchema, Role: packedRoleSchema,
RolePolicies: packedRolePoliciesSchema,
ReversiGameLite: packedReversiGameLiteSchema, ReversiGameLite: packedReversiGameLiteSchema,
ReversiGameDetailed: packedReversiGameDetailedSchema, ReversiGameDetailed: packedReversiGameDetailedSchema,
AbuseUserReport: packedAbuseUserReportSchema, AbuseUserReport: packedAbuseUserReportSchema,
@ -95,6 +97,9 @@ export const refs = {
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>; export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
export type KeyOf<x extends keyof typeof refs> = PropertiesToUnion<typeof refs[x]>;
type PropertiesToUnion<p extends Schema> = p['properties'] extends NonNullable<Obj> ? keyof p['properties'] : never;
type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any'; type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any';
type StringDefToType<T extends TypeStringef> = type StringDefToType<T extends TypeStringef> =
T extends 'null' ? null : T extends 'null' ? null :

View file

@ -45,7 +45,7 @@ export class MiAnnouncement {
length: 256, nullable: false, length: 256, nullable: false,
default: 'info', default: 'info',
}) })
public icon: string; public icon: 'info' | 'warning' | 'error' | 'success';
// normal ... お知らせページ掲載 // normal ... お知らせページ掲載
// banner ... お知らせページ掲載 + バナー表示 // banner ... お知らせページ掲載 + バナー表示
@ -54,7 +54,7 @@ export class MiAnnouncement {
length: 256, nullable: false, length: 256, nullable: false,
default: 'normal', default: 'normal',
}) })
public display: string; public display: 'normal' | 'banner' | 'dialog';
@Column('boolean', { @Column('boolean', {
default: false, default: false,

View file

@ -37,10 +37,12 @@ export const packedAnnouncementSchema = {
icon: { icon: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: false,
enum: ['info', 'warning', 'error', 'success'],
}, },
display: { display: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: false,
enum: ['dialog', 'normal', 'banner'],
}, },
needConfirmationToRead: { needConfirmationToRead: {
type: 'boolean', type: 'boolean',

View file

@ -25,7 +25,7 @@ export const packedBlockingSchema = {
blockee: { blockee: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'UserDetailed', ref: 'UserDetailedNotMe',
}, },
}, },
} as const; } as const;

View file

@ -30,12 +30,12 @@ export const packedFollowingSchema = {
followee: { followee: {
type: 'object', type: 'object',
optional: true, nullable: false, optional: true, nullable: false,
ref: 'UserDetailed', ref: 'UserDetailedNotMe',
}, },
follower: { follower: {
type: 'object', type: 'object',
optional: true, nullable: false, optional: true, nullable: false,
ref: 'UserDetailed', ref: 'UserDetailedNotMe',
}, },
}, },
} as const; } as const;

View file

@ -30,7 +30,7 @@ export const packedMutingSchema = {
mutee: { mutee: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'UserDetailed', ref: 'UserDetailedNotMe',
}, },
}, },
} as const; } as const;

View file

@ -69,6 +69,7 @@ export const packedNoteSchema = {
visibility: { visibility: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: false,
enum: ['public', 'home', 'followers', 'specified'],
}, },
mentions: { mentions: {
type: 'array', type: 'array',
@ -117,6 +118,48 @@ export const packedNoteSchema = {
poll: { poll: {
type: 'object', type: 'object',
optional: true, nullable: true, optional: true, nullable: true,
properties: {
expiresAt: {
type: 'string',
optional: true, nullable: true,
format: 'date-time',
},
multiple: {
type: 'boolean',
optional: false, nullable: false,
},
choices: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
properties: {
isVoted: {
type: 'boolean',
optional: false, nullable: false,
},
text: {
type: 'string',
optional: false, nullable: false,
},
votes: {
type: 'number',
optional: false, nullable: false,
},
},
},
},
},
},
emojis: {
type: 'object',
optional: true, nullable: false,
additionalProperties: {
anyOf: [{
type: 'string',
}],
},
}, },
channelId: { channelId: {
type: 'string', type: 'string',
@ -162,9 +205,23 @@ export const packedNoteSchema = {
type: 'string', type: 'string',
optional: false, nullable: true, optional: false, nullable: true,
}, },
reactionEmojis: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
anyOf: [{
type: 'string',
}],
},
},
reactions: { reactions: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
additionalProperties: {
anyOf: [{
type: 'number',
}],
},
}, },
renoteCount: { renoteCount: {
type: 'number', type: 'number',
@ -196,7 +253,7 @@ export const packedNoteSchema = {
}, },
myReaction: { myReaction: {
type: 'object', type: 'string',
optional: true, nullable: true, optional: true, nullable: true,
}, },
}, },

View file

@ -5,7 +5,7 @@
import { notificationTypes } from '@/types.js'; import { notificationTypes } from '@/types.js';
export const packedNotificationSchema = { const baseSchema = {
type: 'object', type: 'object',
properties: { properties: {
id: { id: {
@ -23,68 +23,368 @@ export const packedNotificationSchema = {
optional: false, nullable: false, optional: false, nullable: false,
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'], enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
}, },
user: { },
type: 'object', } as const;
ref: 'UserLite',
optional: true, nullable: true, export const packedNotificationSchema = {
}, type: 'object',
userId: { oneOf: [{
type: 'string', type: 'object',
optional: true, nullable: true, properties: {
format: 'id', ...baseSchema.properties,
}, type: {
note: { type: 'string',
type: 'object', optional: false, nullable: false,
ref: 'Note', enum: ['note'],
optional: true, nullable: true,
},
reaction: {
type: 'string',
optional: true, nullable: true,
},
achievement: {
type: 'string',
optional: true, nullable: false,
},
body: {
type: 'string',
optional: true, nullable: true,
},
header: {
type: 'string',
optional: true, nullable: true,
},
icon: {
type: 'string',
optional: true, nullable: true,
},
reactions: {
type: 'array',
optional: true, nullable: true,
items: {
type: 'object',
properties: {
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
reaction: {
type: 'string',
optional: false, nullable: false,
},
},
required: ['user', 'reaction'],
}, },
}, user: {
users: {
type: 'array',
optional: true, nullable: true,
items: {
type: 'object', type: 'object',
ref: 'UserLite', ref: 'UserLite',
optional: false, nullable: false, optional: false, nullable: false,
}, },
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
}, },
}, }, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['mention'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['reply'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['renote'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['quote'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['reaction'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
reaction: {
type: 'string',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['pollEnded'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['follow'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['receiveFollowRequest'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['followRequestAccepted'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['roleAssigned'],
},
role: {
type: 'object',
ref: 'Role',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['achievementEarned'],
},
achievement: {
type: 'string',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['app'],
},
body: {
type: 'string',
optional: false, nullable: false,
},
header: {
type: 'string',
optional: false, nullable: false,
},
icon: {
type: 'string',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['reaction:grouped'],
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
reactions: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
properties: {
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
reaction: {
type: 'string',
optional: false, nullable: false,
},
},
required: ['user', 'reaction'],
},
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['renote:grouped'],
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
users: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['test'],
},
},
}],
} as const; } as const;

View file

@ -3,6 +3,107 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
const blockBaseSchema = {
type: 'object',
properties: {
id: {
type: 'string',
optional: false, nullable: false,
},
type: {
type: 'string',
optional: false, nullable: false,
},
},
} as const;
const textBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['text'],
},
text: {
type: 'string',
optional: false, nullable: false,
},
},
} as const;
const sectionBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['section'],
},
title: {
type: 'string',
optional: false, nullable: false,
},
children: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'PageBlock',
},
},
},
} as const;
const imageBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['image'],
},
fileId: {
type: 'string',
optional: false, nullable: true,
},
},
} as const;
const noteBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['note'],
},
detailed: {
type: 'boolean',
optional: false, nullable: false,
},
note: {
type: 'string',
optional: false, nullable: true,
},
},
} as const;
export const packedPageBlockSchema = {
type: 'object',
oneOf: [
textBlockSchema,
sectionBlockSchema,
imageBlockSchema,
noteBlockSchema,
],
} as const;
export const packedPageSchema = { export const packedPageSchema = {
type: 'object', type: 'object',
properties: { properties: {
@ -38,6 +139,7 @@ export const packedPageSchema = {
items: { items: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'PageBlock',
}, },
}, },
variables: { variables: {

View file

@ -25,7 +25,7 @@ export const packedRenoteMutingSchema = {
mutee: { mutee: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'UserDetailed', ref: 'UserDetailedNotMe',
}, },
}, },
} as const; } as const;

View file

@ -1,26 +1,127 @@
const rolePolicyValue = { export const packedRolePoliciesSchema = {
type: 'object', type: 'object',
optional: false, nullable: false,
properties: { properties: {
value: { gtlAvailable: {
oneOf: [ type: 'boolean',
{ optional: false, nullable: false,
type: 'integer',
optional: false, nullable: false,
},
{
type: 'boolean',
optional: false, nullable: false,
},
],
}, },
priority: { ltlAvailable: {
type: 'boolean',
optional: false, nullable: false,
},
canPublicNote: {
type: 'boolean',
optional: false, nullable: false,
},
canCreateContent: {
type: 'boolean',
optional: false, nullable: false,
},
canUpdateContent: {
type: 'boolean',
optional: false, nullable: false,
},
canDeleteContent: {
type: 'boolean',
optional: false, nullable: false,
},
canUpdateAvatar: {
type: 'boolean',
optional: false, nullable: false,
},
canUpdateBanner: {
type: 'boolean',
optional: false, nullable: false,
},
canInvite: {
type: 'boolean',
optional: false, nullable: false,
},
inviteLimit: {
type: 'integer', type: 'integer',
optional: false, nullable: false, optional: false, nullable: false,
}, },
useDefault: { inviteLimitCycle: {
type: 'integer',
optional: false, nullable: false,
},
inviteExpirationTime: {
type: 'integer',
optional: false, nullable: false,
},
canManageCustomEmojis: {
type: 'boolean', type: 'boolean',
optional: false, nullable: false, optional: false, nullable: false,
}, },
canManageAvatarDecorations: {
type: 'boolean',
optional: false, nullable: false,
},
canSearchNotes: {
type: 'boolean',
optional: false, nullable: false,
},
canUseTranslator: {
type: 'boolean',
optional: false, nullable: false,
},
canUseDriveFileInSoundSettings: {
type: 'boolean',
optional: false, nullable: false,
},
canHideAds: {
type: 'boolean',
optional: false, nullable: false,
},
driveCapacityMb: {
type: 'integer',
optional: false, nullable: false,
},
alwaysMarkNsfw: {
type: 'boolean',
optional: false, nullable: false,
},
pinLimit: {
type: 'integer',
optional: false, nullable: false,
},
antennaLimit: {
type: 'integer',
optional: false, nullable: false,
},
wordMuteLimit: {
type: 'integer',
optional: false, nullable: false,
},
webhookLimit: {
type: 'integer',
optional: false, nullable: false,
},
clipLimit: {
type: 'integer',
optional: false, nullable: false,
},
noteEachClipsLimit: {
type: 'integer',
optional: false, nullable: false,
},
userListLimit: {
type: 'integer',
optional: false, nullable: false,
},
userEachUserListsLimit: {
type: 'integer',
optional: false, nullable: false,
},
rateLimitFactor: {
type: 'integer',
optional: false, nullable: false,
},
avatarDecorationLimit: {
type: 'integer',
optional: false, nullable: false,
},
}, },
} as const; } as const;
@ -121,32 +222,28 @@ export const packedRoleSchema = {
policies: { policies: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
properties: { additionalProperties: {
pinLimit: rolePolicyValue, anyOf: [{
canInvite: rolePolicyValue, type: 'object',
clipLimit: rolePolicyValue, properties: {
canHideAds: rolePolicyValue, value: {
inviteLimit: rolePolicyValue, oneOf: [
antennaLimit: rolePolicyValue, {
gtlAvailable: rolePolicyValue, type: 'integer',
ltlAvailable: rolePolicyValue, },
webhookLimit: rolePolicyValue, {
canPublicNote: rolePolicyValue, type: 'boolean',
userListLimit: rolePolicyValue, },
wordMuteLimit: rolePolicyValue, ],
alwaysMarkNsfw: rolePolicyValue, },
canSearchNotes: rolePolicyValue, priority: {
driveCapacityMb: rolePolicyValue, type: 'integer',
rateLimitFactor: rolePolicyValue, },
inviteLimitCycle: rolePolicyValue, useDefault: {
noteEachClipsLimit: rolePolicyValue, type: 'boolean',
inviteExpirationTime: rolePolicyValue, },
canManageCustomEmojis: rolePolicyValue, },
userEachUserListsLimit: rolePolicyValue, }],
canManageAvatarDecorations: rolePolicyValue,
canUseDriveFileInSoundSettings: rolePolicyValue,
canUseTranslator: rolePolicyValue,
avatarDecorationLimit: rolePolicyValue,
}, },
}, },
usersCount: { usersCount: {

View file

@ -582,108 +582,7 @@ export const packedMeDetailedOnlySchema = {
policies: { policies: {
type: 'object', type: 'object',
nullable: false, optional: false, nullable: false, optional: false,
properties: { ref: 'RolePolicies',
gtlAvailable: {
type: 'boolean',
nullable: false, optional: false,
},
ltlAvailable: {
type: 'boolean',
nullable: false, optional: false,
},
canPublicNote: {
type: 'boolean',
nullable: false, optional: false,
},
canInvite: {
type: 'boolean',
nullable: false, optional: false,
},
inviteLimit: {
type: 'number',
nullable: false, optional: false,
},
inviteLimitCycle: {
type: 'number',
nullable: false, optional: false,
},
inviteExpirationTime: {
type: 'number',
nullable: false, optional: false,
},
canManageCustomEmojis: {
type: 'boolean',
nullable: false, optional: false,
},
canManageAvatarDecorations: {
type: 'boolean',
nullable: false, optional: false,
},
canSearchNotes: {
type: 'boolean',
nullable: false, optional: false,
},
canUseTranslator: {
type: 'boolean',
nullable: false, optional: false,
},
canUseDriveFileInSoundSettings: {
type: 'boolean',
nullable: false, optional: false,
},
canHideAds: {
type: 'boolean',
nullable: false, optional: false,
},
driveCapacityMb: {
type: 'number',
nullable: false, optional: false,
},
alwaysMarkNsfw: {
type: 'boolean',
nullable: false, optional: false,
},
pinLimit: {
type: 'number',
nullable: false, optional: false,
},
antennaLimit: {
type: 'number',
nullable: false, optional: false,
},
wordMuteLimit: {
type: 'number',
nullable: false, optional: false,
},
webhookLimit: {
type: 'number',
nullable: false, optional: false,
},
clipLimit: {
type: 'number',
nullable: false, optional: false,
},
noteEachClipsLimit: {
type: 'number',
nullable: false, optional: false,
},
userListLimit: {
type: 'number',
nullable: false, optional: false,
},
userEachUserListsLimit: {
type: 'number',
nullable: false, optional: false,
},
rateLimitFactor: {
type: 'number',
nullable: false, optional: false,
},
avatarDecorationLimit: {
type: 'number',
nullable: false, optional: false,
},
},
}, },
//#region secrets //#region secrets
email: { email: {
@ -778,13 +677,5 @@ export const packedUserSchema = {
type: 'object', type: 'object',
ref: 'UserDetailed', ref: 'UserDetailed',
}, },
{
type: 'object',
ref: 'UserDetailedNotMe',
},
{
type: 'object',
ref: 'MeDetailed',
},
], ],
} as const; } as const;

View file

@ -286,9 +286,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
}, { }, {
...baseWorkerOptions(this.config.redisForRelationshipQueue, this.config.bullmqWorkerOptions, QUEUE.RELATIONSHIP), ...baseWorkerOptions(this.config.redisForRelationshipQueue, this.config.bullmqWorkerOptions, QUEUE.RELATIONSHIP),
autorun: false, autorun: false,
concurrency: this.config.relashionshipJobConcurrency ?? 16, concurrency: this.config.relationshipJobConcurrency ?? 16,
limiter: { limiter: {
max: this.config.relashionshipJobPerSec ?? 64, max: this.config.relationshipJobPerSec ?? 64,
duration: 1000, duration: 1000,
}, },
}); });

View file

@ -211,7 +211,7 @@ export class ServerService implements OnApplicationShutdown {
}); });
this.globalEventService.publishMainStream(profile.userId, 'meUpdated', await this.userEntityService.pack(profile.userId, { id: profile.userId }, { this.globalEventService.publishMainStream(profile.userId, 'meUpdated', await this.userEntityService.pack(profile.userId, { id: profile.userId }, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));

View file

@ -157,7 +157,7 @@ export class ApiServerService {
return { return {
ok: true, ok: true,
token: token.token, token: token.token,
user: await this.userEntityService.pack(token.userId, { id: token.userId }, { detail: true }), user: await this.userEntityService.pack(token.userId, { id: token.userId }, { schema: 'UserDetailed' }),
}; };
} else { } else {
return { return {

View file

@ -213,7 +213,7 @@ export class SignupApiService {
}); });
const res = await this.userEntityService.pack(account, account, { const res = await this.userEntityService.pack(account, account, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
}); });

View file

@ -4,8 +4,7 @@
*/ */
import { permissions } from 'misskey-js'; import { permissions } from 'misskey-js';
import type { Schema } from '@/misc/json-schema.js'; import type { KeyOf, Schema } from '@/misc/json-schema.js';
import { RolePolicies } from '@/core/RoleService.js';
import * as ep___admin_meta from './endpoints/admin/meta.js'; import * as ep___admin_meta from './endpoints/admin/meta.js';
import * as ep___admin_abuseUserReports from './endpoints/admin/abuse-user-reports.js'; import * as ep___admin_abuseUserReports from './endpoints/admin/abuse-user-reports.js';
@ -788,7 +787,7 @@ interface IEndpointMetaBase {
*/ */
readonly requireAdmin?: boolean; readonly requireAdmin?: boolean;
readonly requireRolePolicy?: keyof RolePolicies; readonly requireRolePolicy?: KeyOf<'RolePolicies'>;
/** /**
* *

View file

@ -62,17 +62,17 @@ export const meta = {
reporter: { reporter: {
type: 'object', type: 'object',
nullable: false, optional: false, nullable: false, optional: false,
ref: 'User', ref: 'UserDetailed',
}, },
targetUser: { targetUser: {
type: 'object', type: 'object',
nullable: false, optional: false, nullable: false, optional: false,
ref: 'User', ref: 'UserDetailed',
}, },
assignee: { assignee: {
type: 'object', type: 'object',
nullable: true, optional: true, nullable: true, optional: true,
ref: 'User', ref: 'UserDetailed',
}, },
category: { category: {
type: 'string', type: 'string',

View file

@ -11,6 +11,7 @@ import { SignupService } from '@/core/SignupService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { localUsernameSchema, passwordSchema } from '@/models/User.js'; import { localUsernameSchema, passwordSchema } from '@/models/User.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { Packed } from '@/misc/json-schema.js';
export const meta = { export const meta = {
tags: ['admin'], tags: ['admin'],
@ -18,7 +19,7 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'User', ref: 'MeDetailed',
properties: { properties: {
token: { token: {
type: 'string', type: 'string',
@ -60,11 +61,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
const res = await this.userEntityService.pack(account, account, { const res = await this.userEntityService.pack(account, account, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
}); }) as Packed<'MeDetailed'> & { token: string };
(res as any).token = secret; res.token = secret;
return res; return res;
}); });

View file

@ -27,7 +27,7 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'User', ref: 'UserDetailed',
}, },
} as const; } as const;
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
const res = await this.userEntityService.pack(profile.user!, null, { const res = await this.userEntityService.pack(profile.user!, null, {
detail: true, schema: 'UserDetailed',
}); });
return res; return res;

View file

@ -40,7 +40,7 @@ export const meta = {
}, },
required: ['id', 'createdAt', 'user'], required: ['id', 'createdAt', 'user'],
}, },
} },
} as const; } as const;
export const paramDef = { export const paramDef = {
@ -92,7 +92,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return await Promise.all(assigns.map(async assign => ({ return await Promise.all(assigns.map(async assign => ({
id: assign.id, id: assign.id,
createdAt: this.idService.parse(assign.id).date.toISOString(), createdAt: this.idService.parse(assign.id).date.toISOString(),
user: await this.userEntityService.pack(assign.user!, me, { detail: true }), user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
expiresAt: assign.expiresAt?.toISOString() ?? null, expiresAt: assign.expiresAt?.toISOString() ?? null,
}))); })));
}); });

View file

@ -114,7 +114,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.getMany(); const users = await query.getMany();
return await this.userEntityService.packMany(users, me, { detail: true }); return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
}); });
} }
} }

View file

@ -148,7 +148,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (user != null) { if (user != null) {
return { return {
type: 'User', type: 'User',
object: await this.userEntityService.pack(user, me, { detail: true }), object: await this.userEntityService.pack(user, me, { schema: 'UserDetailedNotMe' }),
}; };
} else if (note != null) { } else if (note != null) {
try { try {

View file

@ -27,7 +27,7 @@ export const meta = {
user: { user: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
ref: 'UserDetailedNotMe', ref: 'UserDetailed',
}, },
}, },
}, },
@ -112,7 +112,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return { return {
accessToken: accessToken.token, accessToken: accessToken.token,
user: await this.userEntityService.pack(session.userId, me, { user: await this.userEntityService.pack(session.userId, me, {
detail: true, schema: 'UserDetailed',
}), }),
}; };
}); });

View file

@ -103,7 +103,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
await this.userBlockingService.block(blocker, blockee); await this.userBlockingService.block(blocker, blockee);
return await this.userEntityService.pack(blockee.id, blocker, { return await this.userEntityService.pack(blockee.id, blocker, {
detail: true, schema: 'UserDetailedNotMe',
}); });
}); });
} }

View file

@ -104,7 +104,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
await this.userBlockingService.unblock(blocker, blockee); await this.userBlockingService.unblock(blocker, blockee);
return await this.userEntityService.pack(blockee.id, blocker, { return await this.userEntityService.pack(blockee.id, blocker, {
detail: true, schema: 'UserDetailedNotMe',
}); });
}); });
} }

View file

@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
relations: ['user'], relations: ['user'],
}); });
const users = await this.userEntityService.packMany(records.map(r => r.user!), null, { detail: false }); const users = await this.userEntityService.packMany(records.map(r => r.user!), null);
return records.map(r => ({ return records.map(r => ({
id: r.id, id: r.id,

View file

@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.limit(ps.limit) .limit(ps.limit)
.getMany(); .getMany();
return await this.userEntityService.packMany(users, me, { detail: true }); return await this.userEntityService.packMany(users, me, { schema: 'UserDetailedNotMe' });
}); });
} }
} }

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.limit(ps.limit).getMany(); const users = await query.limit(ps.limit).getMany();
return await this.userEntityService.packMany(users, me, { detail: true }); return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
}); });
} }
} }

View file

@ -71,8 +71,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
userProfile.loggedInDates = [...userProfile.loggedInDates, today]; userProfile.loggedInDates = [...userProfile.loggedInDates, today];
} }
return await this.userEntityService.pack<true, true>(userProfile.user!, userProfile.user!, { return await this.userEntityService.pack(userProfile.user!, userProfile.user!, {
detail: true, schema: 'MeDetailed',
includeSecrets: isSecure, includeSecrets: isSecure,
userProfile, userProfile,
}); });

View file

@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event // Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, { this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));

View file

@ -111,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
// Publish meUpdated event // Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, { this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));

View file

@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event // Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, { this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));
}); });

View file

@ -99,7 +99,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event // Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, { this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));

View file

@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event // Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, { this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));
}); });

View file

@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event // Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, { this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
})); }));

View file

@ -68,8 +68,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err; throw err;
}); });
return await this.userEntityService.pack<true, true>(me.id, me, { return await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
}); });
}); });
} }

View file

@ -52,8 +52,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err; throw err;
}); });
return await this.userEntityService.pack<true, true>(me.id, me, { return await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
}); });
}); });
} }

View file

@ -50,7 +50,7 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
ref: 'UserDetailed', ref: 'MeDetailed',
}, },
} as const; } as const;
@ -109,7 +109,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
const iObj = await this.userEntityService.pack(me.id, me, { const iObj = await this.userEntityService.pack(me.id, me, {
detail: true, schema: 'MeDetailed',
includeSecrets: true, includeSecrets: true,
}); });

View file

@ -433,8 +433,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
verifiedLinks: [], verifiedLinks: [],
}); });
const iObj = await this.userEntityService.pack<true, true>(user.id, user, { const iObj = await this.userEntityService.pack(user.id, user, {
detail: true, schema: 'MeDetailed',
includeSecrets: isSecure, includeSecrets: isSecure,
}); });

View file

@ -304,6 +304,11 @@ export const meta = {
type: 'string', type: 'string',
optional: false, nullable: true, optional: false, nullable: true,
}, },
policies: {
type: 'object',
optional: false, nullable: false,
ref: 'RolePolicies',
},
}, },
}, },
} as const; } as const;

View file

@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
var: ps.var, var: ps.var,
userId: me.id, userId: me.id,
user: await this.userEntityService.pack(me.id, { id: page.userId }, { user: await this.userEntityService.pack(me.id, { id: page.userId }, {
detail: true, schema: 'UserDetailed',
}), }),
}); });
}); });

View file

@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
host: acct.host ?? IsNull(), host: acct.host ?? IsNull(),
}))); })));
return await this.userEntityService.packMany(users.filter(x => x !== null) as MiUser[], me, { detail: true }); return await this.userEntityService.packMany(users.filter(x => x !== null) as MiUser[], me, { schema: 'UserDetailed' });
}); });
} }
} }

View file

@ -14,6 +14,32 @@ export const meta = {
requireCredential: false, requireCredential: false,
res: { res: {
type: 'array',
items: {
type: 'object',
properties: {
createdAt: {
type: 'string',
format: 'date-time',
},
users: {
type: 'number',
},
data: {
type: 'object',
additionalProperties: {
anyOf: [{
type: 'number',
}],
},
},
},
required: [
'createdAt',
'users',
'data',
],
},
}, },
allowGet: true, allowGet: true,

View file

@ -33,11 +33,11 @@ export const meta = {
properties: { properties: {
id: { id: {
type: 'string', type: 'string',
format: 'misskey:id' format: 'misskey:id',
}, },
user: { user: {
type: 'object', type: 'object',
ref: 'User' ref: 'UserDetailed',
}, },
}, },
required: ['id', 'user'], required: ['id', 'user'],
@ -94,7 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return await Promise.all(assigns.map(async assign => ({ return await Promise.all(assigns.map(async assign => ({
id: assign.id, id: assign.id,
user: await this.userEntityService.pack(assign.user!, me, { detail: true }), user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
}))); })));
}); });
} }

View file

@ -89,7 +89,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.getMany(); const users = await query.getMany();
return await this.userEntityService.packMany(users, me, { detail: true }); return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
}); });
} }
} }

View file

@ -132,7 +132,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Make replies object (includes weights) // Make replies object (includes weights)
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({ const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
user: await this.userEntityService.pack(user, me, { detail: true }), user: await this.userEntityService.pack(user, me, { schema: 'UserDetailed' }),
weight: repliedUsers[user] / peak, weight: repliedUsers[user] / peak,
}))); })));

View file

@ -46,7 +46,7 @@ export const meta = {
}, },
user: { user: {
type: 'object', type: 'object',
ref: 'User', ref: 'UserLite',
}, },
withReplies: { withReplies: {
type: 'boolean', type: 'boolean',

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.limit(ps.limit).offset(ps.offset).getMany(); const users = await query.limit(ps.limit).offset(ps.offset).getMany();
return await this.userEntityService.packMany(users, me, { detail: true }); return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
}); });
} }
} }

View file

@ -131,7 +131,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.getMany(); .getMany();
} }
return await this.userEntityService.packMany(users, me, { detail: !!ps.detail }); return await this.userEntityService.packMany(users, me, { schema: ps.detail ? 'UserDetailed' : 'UserLite' });
}); });
} }
} }

View file

@ -141,7 +141,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
} }
return await this.userEntityService.packMany(users, me, { detail: ps.detail }); return await this.userEntityService.packMany(users, me, { schema: ps.detail ? 'UserDetailed' : 'UserLite' });
}); });
} }
} }

View file

@ -117,7 +117,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
return await this.userEntityService.packMany(_users, me, { return await this.userEntityService.packMany(_users, me, {
detail: true, schema: 'UserDetailed',
}); });
} else { } else {
// Lookup user // Lookup user
@ -147,7 +147,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
return await this.userEntityService.pack(user, me, { return await this.userEntityService.pack(user, me, {
detail: true, schema: 'UserDetailed',
}); });
} }
}); });

View file

@ -9,9 +9,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class AdminChannel extends Channel { class AdminChannel extends Channel {
public readonly chName = 'admin'; public readonly chName = 'admin';
public static shouldShare = true; public static readonly shouldShare = true;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:admin:stream'; public static readonly kind = 'read:admin:stream';
@bindThis @bindThis
public async init(params: any) { public async init(params: any) {

View file

@ -12,9 +12,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class AntennaChannel extends Channel { class AntennaChannel extends Channel {
public readonly chName = 'antenna'; public readonly chName = 'antenna';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:account'; public static readonly kind = 'read:account';
private antennaId: string; private antennaId: string;
constructor( constructor(

View file

@ -12,8 +12,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class ChannelChannel extends Channel { class ChannelChannel extends Channel {
public readonly chName = 'channel'; public readonly chName = 'channel';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private channelId: string; private channelId: string;
constructor( constructor(

View file

@ -9,9 +9,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class DriveChannel extends Channel { class DriveChannel extends Channel {
public readonly chName = 'drive'; public readonly chName = 'drive';
public static shouldShare = true; public static readonly shouldShare = true;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:account'; public static readonly kind = 'read:account';
@bindThis @bindThis
public async init(params: any) { public async init(params: any) {

View file

@ -16,8 +16,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class GlobalTimelineChannel extends Channel { class GlobalTimelineChannel extends Channel {
public readonly chName = 'globalTimeline'; public readonly chName = 'globalTimeline';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private withRenotes: boolean; private withRenotes: boolean;
private withFiles: boolean; private withFiles: boolean;

View file

@ -13,8 +13,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class HashtagChannel extends Channel { class HashtagChannel extends Channel {
public readonly chName = 'hashtag'; public readonly chName = 'hashtag';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private q: string[][]; private q: string[][];
constructor( constructor(

View file

@ -14,9 +14,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class HomeTimelineChannel extends Channel { class HomeTimelineChannel extends Channel {
public readonly chName = 'homeTimeline'; public readonly chName = 'homeTimeline';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:account'; public static readonly kind = 'read:account';
private withRenotes: boolean; private withRenotes: boolean;
private withFiles: boolean; private withFiles: boolean;

View file

@ -16,9 +16,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class HybridTimelineChannel extends Channel { class HybridTimelineChannel extends Channel {
public readonly chName = 'hybridTimeline'; public readonly chName = 'hybridTimeline';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:account'; public static readonly kind = 'read:account';
private withRenotes: boolean; private withRenotes: boolean;
private withReplies: boolean; private withReplies: boolean;
private withFiles: boolean; private withFiles: boolean;

View file

@ -15,8 +15,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class LocalTimelineChannel extends Channel { class LocalTimelineChannel extends Channel {
public readonly chName = 'localTimeline'; public readonly chName = 'localTimeline';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private withRenotes: boolean; private withRenotes: boolean;
private withReplies: boolean; private withReplies: boolean;
private withFiles: boolean; private withFiles: boolean;

View file

@ -11,9 +11,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class MainChannel extends Channel { class MainChannel extends Channel {
public readonly chName = 'main'; public readonly chName = 'main';
public static shouldShare = true; public static readonly shouldShare = true;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:account'; public static readonly kind = 'read:account';
constructor( constructor(
private noteEntityService: NoteEntityService, private noteEntityService: NoteEntityService,

View file

@ -12,8 +12,8 @@ const ev = new Xev();
class QueueStatsChannel extends Channel { class QueueStatsChannel extends Channel {
public readonly chName = 'queueStats'; public readonly chName = 'queueStats';
public static shouldShare = true; public static readonly shouldShare = true;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
constructor(id: string, connection: Channel['connection']) { constructor(id: string, connection: Channel['connection']) {
super(id, connection); super(id, connection);

View file

@ -13,8 +13,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class ReversiGameChannel extends Channel { class ReversiGameChannel extends Channel {
public readonly chName = 'reversiGame'; public readonly chName = 'reversiGame';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private gameId: MiReversiGame['id'] | null = null; private gameId: MiReversiGame['id'] | null = null;
constructor( constructor(

View file

@ -9,9 +9,9 @@ import Channel, { type MiChannelService } from '../channel.js';
class ReversiChannel extends Channel { class ReversiChannel extends Channel {
public readonly chName = 'reversi'; public readonly chName = 'reversi';
public static shouldShare = true; public static readonly shouldShare = true;
public static requireCredential = true as const; public static readonly requireCredential = true as const;
public static kind = 'read:account'; public static readonly kind = 'read:account';
@bindThis @bindThis
public async init(params: any) { public async init(params: any) {

View file

@ -14,8 +14,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class RoleTimelineChannel extends Channel { class RoleTimelineChannel extends Channel {
public readonly chName = 'roleTimeline'; public readonly chName = 'roleTimeline';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private roleId: string; private roleId: string;
constructor( constructor(

View file

@ -12,8 +12,8 @@ const ev = new Xev();
class ServerStatsChannel extends Channel { class ServerStatsChannel extends Channel {
public readonly chName = 'serverStats'; public readonly chName = 'serverStats';
public static shouldShare = true; public static readonly shouldShare = true;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
constructor(id: string, connection: Channel['connection']) { constructor(id: string, connection: Channel['connection']) {
super(id, connection); super(id, connection);

View file

@ -15,8 +15,8 @@ import Channel, { type MiChannelService } from '../channel.js';
class UserListChannel extends Channel { class UserListChannel extends Channel {
public readonly chName = 'userList'; public readonly chName = 'userList';
public static shouldShare = false; public static readonly shouldShare = false;
public static requireCredential = false as const; public static readonly requireCredential = false as const;
private listId: string; private listId: string;
private membershipsMap: Record<string, Pick<MiUserListMembership, 'withReplies'> | undefined> = {}; private membershipsMap: Record<string, Pick<MiUserListMembership, 'withReplies'> | undefined> = {};
private listUsersClock: NodeJS.Timeout; private listUsersClock: NodeJS.Timeout;

View file

@ -16,3 +16,8 @@ declare const _DATA_TRANSFER_DECK_COLUMN_: string;
// for dev-mode // for dev-mode
declare const _LANGS_FULL_: string[][]; declare const _LANGS_FULL_: string[][];
// TagCanvas
interface Window {
TagCanvas: any;
}

View file

@ -20,7 +20,7 @@
"@discordapp/twemoji": "15.0.2", "@discordapp/twemoji": "15.0.2",
"@github/webauthn-json": "2.1.1", "@github/webauthn-json": "2.1.1",
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3", "@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
"@misskey-dev/browser-image-resizer": "2.2.1-misskey.10", "@misskey-dev/browser-image-resizer": "2024.1.0",
"@rollup/plugin-json": "6.1.0", "@rollup/plugin-json": "6.1.0",
"@rollup/plugin-replace": "5.0.5", "@rollup/plugin-replace": "5.0.5",
"@rollup/plugin-typescript": "11.1.6", "@rollup/plugin-typescript": "11.1.6",
@ -40,7 +40,7 @@
"chartjs-chart-matrix": "2.0.1", "chartjs-chart-matrix": "2.0.1",
"chartjs-plugin-gradient": "0.6.1", "chartjs-plugin-gradient": "0.6.1",
"chartjs-plugin-zoom": "2.0.1", "chartjs-plugin-zoom": "2.0.1",
"chromatic": "10.5.0", "chromatic": "10.6.1",
"compare-versions": "6.1.0", "compare-versions": "6.1.0",
"cropperjs": "2.0.0-beta.4", "cropperjs": "2.0.0-beta.4",
"date-fns": "2.30.0", "date-fns": "2.30.0",
@ -77,8 +77,8 @@
"vuedraggable": "next" "vuedraggable": "next"
}, },
"devDependencies": { "devDependencies": {
"@misskey-dev/eslint-plugin": "^1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@misskey-dev/summaly": "^5.0.3", "@misskey-dev/summaly": "5.0.3",
"@storybook/addon-actions": "7.6.10", "@storybook/addon-actions": "7.6.10",
"@storybook/addon-essentials": "7.6.10", "@storybook/addon-essentials": "7.6.10",
"@storybook/addon-interactions": "7.6.10", "@storybook/addon-interactions": "7.6.10",
@ -102,12 +102,12 @@
"@types/estree": "1.0.5", "@types/estree": "1.0.5",
"@types/matter-js": "0.19.6", "@types/matter-js": "0.19.6",
"@types/micromatch": "4.0.6", "@types/micromatch": "4.0.6",
"@types/node": "20.11.6", "@types/node": "20.11.10",
"@types/punycode": "2.1.3", "@types/punycode": "2.1.3",
"@types/sanitize-html": "2.9.5", "@types/sanitize-html": "2.9.5",
"@types/throttle-debounce": "5.0.2", "@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6", "@types/tinycolor2": "1.4.6",
"@types/uuid": "9.0.7", "@types/uuid": "9.0.8",
"@types/ws": "8.5.10", "@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "6.18.1", "@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1", "@typescript-eslint/parser": "6.18.1",
@ -118,12 +118,12 @@
"cypress": "13.6.3", "cypress": "13.6.3",
"eslint": "8.56.0", "eslint": "8.56.0",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-vue": "9.20.1", "eslint-plugin-vue": "9.21.0",
"fast-glob": "3.3.2", "fast-glob": "3.3.2",
"happy-dom": "10.0.3", "happy-dom": "10.0.3",
"intersection-observer": "0.12.2", "intersection-observer": "0.12.2",
"micromatch": "4.0.5", "micromatch": "4.0.5",
"msw": "2.1.4", "msw": "2.1.5",
"msw-storybook-addon": "1.10.0", "msw-storybook-addon": "1.10.0",
"nodemon": "3.0.3", "nodemon": "3.0.3",
"prettier": "3.2.4", "prettier": "3.2.4",

View file

@ -22,7 +22,7 @@ import { getAccountFromId } from '@/scripts/get-account-from-id.js';
import { deckStore } from '@/ui/deck/deck-store.js'; import { deckStore } from '@/ui/deck/deck-store.js';
import { miLocalStorage } from '@/local-storage.js'; import { miLocalStorage } from '@/local-storage.js';
import { fetchCustomEmojis } from '@/custom-emojis.js'; import { fetchCustomEmojis } from '@/custom-emojis.js';
import { setupRouter } from '@/global/router/definition.js'; import { setupRouter } from '@/router/definition.js';
export async function common(createVue: () => App<Element>) { export async function common(createVue: () => App<Element>) {
console.info(`Misskey v${version}`); console.info(`Misskey v${version}`);

View file

@ -19,7 +19,7 @@ import { claimAchievement, claimedAchievements } from '@/scripts/achievements.js
import { initializeSw } from '@/scripts/initialize-sw.js'; import { initializeSw } from '@/scripts/initialize-sw.js';
import { deckStore } from '@/ui/deck/deck-store.js'; import { deckStore } from '@/ui/deck/deck-store.js';
import { emojiPicker } from '@/scripts/emoji-picker.js'; import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mainRouter } from '@/global/router/main.js'; import { mainRouter } from '@/router/main.js';
export async function mainBoot() { export async function mainBoot() {
const { isClientUpdated } = await common(() => createApp( const { isClientUpdated } = await common(() => createApp(

View file

@ -76,7 +76,7 @@ import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
const props = defineProps<{ const props = defineProps<{
user: Misskey.entities.User; user: Misskey.entities.UserDetailed;
initialComment?: string; initialComment?: string;
}>(); }>();

View file

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div> <div>
<div v-if="achievements" :class="$style.root"> <div v-if="achievements" :class="$style.root">
<div v-for="achievement in achievements" :key="achievement" :class="$style.achievement" class="_panel"> <div v-for="achievement in achievements" :key="achievement.name" :class="$style.achievement" class="_panel">
<div :class="$style.icon"> <div :class="$style.icon">
<div <div
:class="[$style.iconFrame, { :class="[$style.iconFrame, {

View file

@ -55,7 +55,7 @@ async function gotIt(): Promise<void> {
if (confirm.canceled) return; if (confirm.canceled) return;
} }
modal.value.close(); modal.value?.close();
misskeyApi('i/read-announcement', { announcementId: props.announcement.id }); misskeyApi('i/read-announcement', { announcementId: props.announcement.id });
updateAccount({ updateAccount({
unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== props.announcement.id), unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== props.announcement.id),
@ -63,7 +63,7 @@ async function gotIt(): Promise<void> {
} }
function onBgClick() { function onBgClick() {
rootEl.value.animate([{ rootEl.value?.animate([{
offset: 0, offset: 0,
transform: 'scale(1)', transform: 'scale(1)',
}, { }, {

Some files were not shown because too many files have changed in this diff Show more