1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-11 13:18:11 +09:00

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
#deliverJobConcurrency: 128
#inboxJobConcurrency: 16
#relashionshipJobConcurrency: 16
# What's relashionshipJob?:
#relationshipJobConcurrency: 16
# What's relationshipJob?:
# Follow, unfollow, block and unblock(ings) while following-imports, etc. or account migrations.
# Job rate limiter
#deliverJobPerSec: 128
#inboxJobPerSec: 32
#relashionshipJobPerSec: 64
#relationshipJobPerSec: 64
# Job attempts
#deliverJobMaxAttempts: 12

View File

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

View File

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

View File

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

View File

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

View File

@ -97,7 +97,7 @@ export class AccountMoveService {
await this.apDeliverManagerService.deliverToFollowers(src, moveAct);
// 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);
// Unfollow after 24 hours

View File

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

View File

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

View File

@ -109,13 +109,13 @@ export class UserBlockingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(followee)) {
this.userEntityService.pack(followee, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
if (this.userEntityService.isLocalUser(follower) && !silent) {
this.userEntityService.pack(followee, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async 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 { IdService } from '@/core/IdService.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 { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { WebhookService } from '@/core/WebhookService.js';
@ -293,9 +292,9 @@ export class UserFollowingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(follower) && !silent) {
// Publish follow event
this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).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'));
for (const webhook of webhooks) {
@ -360,7 +359,7 @@ export class UserFollowingService implements OnModuleInit {
if (!silent && this.userEntityService.isLocalUser(follower)) {
// Publish unfollow event
this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async 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(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
// 通知を作成
@ -548,7 +547,7 @@ export class UserFollowingService implements OnModuleInit {
});
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
@ -576,7 +575,7 @@ export class UserFollowingService implements OnModuleInit {
}
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
@ -696,7 +695,7 @@ export class UserFollowingService implements OnModuleInit {
@bindThis
private async publishUnfollow(followee: Both, follower: Local): Promise<void> {
const packedFollowee = await this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
});
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>>> {
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 = {
type: 'object',
properties: {} as Record<string, unknown>,
@ -101,10 +124,7 @@ export function getJsonSchema<S extends Schema>(schema: S): ToJsonSchema<Unflatt
};
for (const k in schema) {
jsonSchema.properties[k] = {
type: 'array',
items: { type: 'number' },
};
unflatten(k, jsonSchema);
}
return jsonSchema as ToJsonSchema<Unflatten<ChartResult<S>>>;

View File

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

View File

@ -37,7 +37,7 @@ export class BlockingEntityService {
createdAt: this.idService.parse(blocking.id).date.toISOString(),
blockeeId: blocking.blockeeId,
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(),
updatedAt: flash.updatedAt.toISOString(),
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,
summary: flash.summary,
script: flash.script,

View File

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

View File

@ -39,7 +39,7 @@ export class ModerationLogEntityService {
info: log.info,
userId: log.userId,
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,
muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View File

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

View File

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

View File

@ -37,7 +37,7 @@ export class RenoteMutingEntityService {
createdAt: this.idService.parse(muting.id).date.toISOString(),
muteeId: muting.muteeId,
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 { 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 = new Ajv();
@ -304,34 +296,35 @@ export class UserEntityService implements OnModuleInit {
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,
me: { id: MiUser['id'] } | null | undefined,
options?: {
detail?: D,
schema?: S,
includeSecrets?: boolean,
userProfile?: MiUserProfile,
},
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> {
): Promise<Packed<S>> {
const opts = Object.assign({
detail: false,
schema: 'UserLite',
includeSecrets: false,
}, options);
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
const isDetailed = opts.schema !== 'UserLite';
const meId = me ? me.id : null;
const isMe = meId === user.id;
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.');
const relation = meId && !isMe && opts.detail ? await this.getRelation(meId, user.id) : null;
const pins = opts.detail ? await this.userNotePiningsRepository.createQueryBuilder('pin')
const relation = meId && !isMe && isDetailed ? await this.getRelation(meId, user.id) : null;
const pins = isDetailed ? await this.userNotePiningsRepository.createQueryBuilder('pin')
.where('pin.userId = :userId', { userId: user.id })
.innerJoinAndSelect('pin.note', 'note')
.orderBy('pin.id', 'DESC')
.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 :
(profile.followingVisibility === 'public') || isMe ? user.followingCount :
@ -343,12 +336,12 @@ export class UserEntityService implements OnModuleInit {
(profile.followersVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount :
null;
const policies = opts.detail ? await this.roleService.getUserPolicies(user.id) : null;
const isModerator = (isMe || iAmModerator) && opts.detail ? this.roleService.isModerator(user) : null;
const isAdmin = (isMe || iAmModerator) && opts.detail ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && opts.detail ? await this.announcementService.getUnreadAnnouncements(user) : null;
const policies = isDetailed ? await this.roleService.getUserPolicies(user.id) : null;
const isModerator = (isMe || iAmModerator) && isDetailed ? this.roleService.isModerator(user) : null;
const isAdmin = (isMe || iAmModerator) && isDetailed ? this.roleService.isAdministrator(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 = {
id: user.id,
@ -384,7 +377,7 @@ export class UserEntityService implements OnModuleInit {
displayOrder: r.displayOrder,
}))) : undefined,
...(opts.detail ? {
...(isDetailed ? {
url: profile!.url,
uri: user.uri,
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,
} : {}),
...(opts.detail && (isMe || iAmModerator) ? {
...(isDetailed && (isMe || iAmModerator) ? {
avatarId: user.avatarId,
bannerId: user.bannerId,
isModerator: isModerator,
@ -518,21 +511,21 @@ export class UserEntityService implements OnModuleInit {
notify: relation.following?.notify ?? 'none',
withReplies: relation.following?.withReplies ?? false,
} : {}),
} as Promiseable<Packed<'User'>> as Promiseable<IsMeAndIsUserDetailed<ExpectsMe, D>>;
} as Promiseable<Packed<S>>;
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)[],
me: { id: MiUser['id'] } | null | undefined,
options?: {
detail?: D,
schema?: S,
includeSecrets?: boolean,
},
): Promise<IsUserDetailed<D>[]> {
): Promise<Packed<S>[]> {
return (await Promise.allSettled(users.map(u => this.pack(u, me, options))))
.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が遅いため
// 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 {
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;
const obj = {} as Record<string, Cloneable>;
for (const [k, v] of Object.entries(x)) {
obj[k] = deepClone(v);
obj[k] = v === undefined ? undefined : deepClone(v);
}
return obj as T;
} 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 { packedNoteSchema } from '@/models/json-schema/note.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 { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/json-schema/emoji.js';
import { packedRenoteMutingSchema } from '@/models/json-schema/renote-muting.js';
import { packedUserListMembershipSchema, packedUserListSchema } from '@/models/json-schema/user-list.js';
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.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 { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js';
@ -71,6 +71,7 @@ export const refs = {
Hashtag: packedHashtagSchema,
InviteCode: packedInviteCodeSchema,
Page: packedPageSchema,
PageBlock: packedPageBlockSchema,
PageLike: packedPageLikeSchema,
Channel: packedChannelSchema,
QueueCount: packedQueueCountSchema,
@ -87,6 +88,7 @@ export const refs = {
Signin: packedSigninSchema,
RoleLite: packedRoleLiteSchema,
Role: packedRoleSchema,
RolePolicies: packedRolePoliciesSchema,
ReversiGameLite: packedReversiGameLiteSchema,
ReversiGameDetailed: packedReversiGameDetailedSchema,
AbuseUserReport: packedAbuseUserReportSchema,
@ -95,6 +97,9 @@ export const refs = {
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 StringDefToType<T extends TypeStringef> =
T extends 'null' ? null :

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,6 +69,7 @@ export const packedNoteSchema = {
visibility: {
type: 'string',
optional: false, nullable: false,
enum: ['public', 'home', 'followers', 'specified'],
},
mentions: {
type: 'array',
@ -117,6 +118,48 @@ export const packedNoteSchema = {
poll: {
type: 'object',
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: {
type: 'string',
@ -162,9 +205,23 @@ export const packedNoteSchema = {
type: 'string',
optional: false, nullable: true,
},
reactionEmojis: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
anyOf: [{
type: 'string',
}],
},
},
reactions: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
anyOf: [{
type: 'number',
}],
},
},
renoteCount: {
type: 'number',
@ -196,7 +253,7 @@ export const packedNoteSchema = {
},
myReaction: {
type: 'object',
type: 'string',
optional: true, nullable: true,
},
},

View File

@ -5,7 +5,7 @@
import { notificationTypes } from '@/types.js';
export const packedNotificationSchema = {
const baseSchema = {
type: 'object',
properties: {
id: {
@ -23,68 +23,368 @@ export const packedNotificationSchema = {
optional: false, nullable: false,
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: true, nullable: true,
},
userId: {
type: 'string',
optional: true, nullable: true,
format: 'id',
},
note: {
type: 'object',
ref: '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'],
},
} as const;
export const packedNotificationSchema = {
type: 'object',
oneOf: [{
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['note'],
},
},
users: {
type: 'array',
optional: true, nullable: true,
items: {
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: ['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;

View File

@ -3,6 +3,107 @@
* 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 = {
type: 'object',
properties: {
@ -38,6 +139,7 @@ export const packedPageSchema = {
items: {
type: 'object',
optional: false, nullable: false,
ref: 'PageBlock',
},
},
variables: {

View File

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

View File

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

View File

@ -582,108 +582,7 @@ export const packedMeDetailedOnlySchema = {
policies: {
type: 'object',
nullable: false, optional: false,
properties: {
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,
},
},
ref: 'RolePolicies',
},
//#region secrets
email: {
@ -778,13 +677,5 @@ export const packedUserSchema = {
type: 'object',
ref: 'UserDetailed',
},
{
type: 'object',
ref: 'UserDetailedNotMe',
},
{
type: 'object',
ref: 'MeDetailed',
},
],
} as const;

View File

@ -286,9 +286,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
}, {
...baseWorkerOptions(this.config.redisForRelationshipQueue, this.config.bullmqWorkerOptions, QUEUE.RELATIONSHIP),
autorun: false,
concurrency: this.config.relashionshipJobConcurrency ?? 16,
concurrency: this.config.relationshipJobConcurrency ?? 16,
limiter: {
max: this.config.relashionshipJobPerSec ?? 64,
max: this.config.relationshipJobPerSec ?? 64,
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 }, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View File

@ -157,7 +157,7 @@ export class ApiServerService {
return {
ok: true,
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 {
return {

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
ref: 'User',
ref: 'UserDetailed',
},
} 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, {
detail: true,
schema: 'UserDetailed',
});
return res;

View File

@ -40,7 +40,7 @@ export const meta = {
},
required: ['id', 'createdAt', 'user'],
},
}
},
} as const;
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 => ({
id: assign.id,
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,
})));
});

View File

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

View File

@ -27,7 +27,7 @@ export const meta = {
user: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailedNotMe',
ref: 'UserDetailed',
},
},
},
@ -112,7 +112,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return {
accessToken: accessToken.token,
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);
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);
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'],
});
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 => ({
id: r.id,

View File

@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.limit(ps.limit)
.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();
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];
}
return await this.userEntityService.pack<true, true>(userProfile.user!, userProfile.user!, {
detail: true,
return await this.userEntityService.pack(userProfile.user!, userProfile.user!, {
schema: 'MeDetailed',
includeSecrets: isSecure,
userProfile,
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ export const meta = {
res: {
type: 'object',
ref: 'UserDetailed',
ref: 'MeDetailed',
},
} 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, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});

View File

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

View File

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

View File

@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
var: ps.var,
userId: me.id,
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(),
})));
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,
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,

View File

@ -33,11 +33,11 @@ export const meta = {
properties: {
id: {
type: 'string',
format: 'misskey:id'
format: 'misskey:id',
},
user: {
type: 'object',
ref: 'User'
ref: 'UserDetailed',
},
},
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 => ({
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();
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)
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,
})));

View File

@ -46,7 +46,7 @@ export const meta = {
},
user: {
type: 'object',
ref: 'User',
ref: 'UserLite',
},
withReplies: {
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();
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();
}
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, {
detail: true,
schema: 'UserDetailed',
});
} else {
// Lookup user
@ -147,7 +147,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
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 {
public readonly chName = 'admin';
public static shouldShare = true;
public static requireCredential = true as const;
public static kind = 'read:admin:stream';
public static readonly shouldShare = true;
public static readonly requireCredential = true as const;
public static readonly kind = 'read:admin:stream';
@bindThis
public async init(params: any) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@
"@discordapp/twemoji": "15.0.2",
"@github/webauthn-json": "2.1.1",
"@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-replace": "5.0.5",
"@rollup/plugin-typescript": "11.1.6",
@ -40,7 +40,7 @@
"chartjs-chart-matrix": "2.0.1",
"chartjs-plugin-gradient": "0.6.1",
"chartjs-plugin-zoom": "2.0.1",
"chromatic": "10.5.0",
"chromatic": "10.6.1",
"compare-versions": "6.1.0",
"cropperjs": "2.0.0-beta.4",
"date-fns": "2.30.0",
@ -77,8 +77,8 @@
"vuedraggable": "next"
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "^1.0.0",
"@misskey-dev/summaly": "^5.0.3",
"@misskey-dev/eslint-plugin": "1.0.0",
"@misskey-dev/summaly": "5.0.3",
"@storybook/addon-actions": "7.6.10",
"@storybook/addon-essentials": "7.6.10",
"@storybook/addon-interactions": "7.6.10",
@ -102,12 +102,12 @@
"@types/estree": "1.0.5",
"@types/matter-js": "0.19.6",
"@types/micromatch": "4.0.6",
"@types/node": "20.11.6",
"@types/node": "20.11.10",
"@types/punycode": "2.1.3",
"@types/sanitize-html": "2.9.5",
"@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6",
"@types/uuid": "9.0.7",
"@types/uuid": "9.0.8",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1",
@ -118,12 +118,12 @@
"cypress": "13.6.3",
"eslint": "8.56.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-vue": "9.20.1",
"eslint-plugin-vue": "9.21.0",
"fast-glob": "3.3.2",
"happy-dom": "10.0.3",
"intersection-observer": "0.12.2",
"micromatch": "4.0.5",
"msw": "2.1.4",
"msw": "2.1.5",
"msw-storybook-addon": "1.10.0",
"nodemon": "3.0.3",
"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 { miLocalStorage } from '@/local-storage.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>) {
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 { deckStore } from '@/ui/deck/deck-store.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() {
const { isClientUpdated } = await common(() => createApp(

View File

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

View File

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div>
<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.iconFrame, {

View File

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

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