Merge branch 'develop' into fix-7311
This commit is contained in:
commit
1650d495c0
|
@ -10,7 +10,7 @@
|
||||||
"ghcr.io/devcontainers-contrib/features/corepack:1": {}
|
"ghcr.io/devcontainers-contrib/features/corepack:1": {}
|
||||||
},
|
},
|
||||||
"forwardPorts": [3000],
|
"forwardPorts": [3000],
|
||||||
"postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh",
|
"postCreateCommand": "/bin/bash .devcontainer/init.sh",
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
|
|
|
@ -8,6 +8,7 @@ services:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ../:/workspace:cached
|
- ../:/workspace:cached
|
||||||
|
- node_modules:/workspace/node_modules
|
||||||
|
|
||||||
command: sleep infinity
|
command: sleep infinity
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
redis-data:
|
redis-data:
|
||||||
|
node_modules:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal_network:
|
internal_network:
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
sudo chown -R node /workspace
|
sudo chown node node_modules
|
||||||
|
git config --global --add safe.directory /workspace
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
corepack install
|
corepack install
|
||||||
corepack enable
|
corepack enable
|
||||||
|
|
|
@ -2,3 +2,7 @@ contact_links:
|
||||||
- name: 💬 Misskey official Discord
|
- name: 💬 Misskey official Discord
|
||||||
url: https://discord.gg/Wp8gVStHW3
|
url: https://discord.gg/Wp8gVStHW3
|
||||||
about: Chat freely about Misskey
|
about: Chat freely about Misskey
|
||||||
|
# 仮
|
||||||
|
- name: 💬 Start discussion
|
||||||
|
url: https://github.com/misskey-dev/misskey/discussions
|
||||||
|
about: The official forum to join conversation and ask question
|
||||||
|
|
|
@ -37,7 +37,7 @@ jobs:
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Build and push by digest
|
- name: Build and push by digest
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
|
|
@ -48,7 +48,7 @@ jobs:
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Build and Push to Docker Hub
|
- name: Build and Push to Docker Hub
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
|
|
@ -13,10 +13,12 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DOCKER_CONTENT_TRUST: 1
|
DOCKER_CONTENT_TRUST: 1
|
||||||
|
DOCKLE_VERSION: 0.4.14
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.1
|
- uses: actions/checkout@v4.1.1
|
||||||
- run: |
|
- name: Download and install dockle v${{ env.DOCKLE_VERSION }}
|
||||||
curl -L -o dockle.deb "https://github.com/goodwithtech/dockle/releases/download/v0.4.10/dockle_0.4.10_Linux-64bit.deb"
|
run: |
|
||||||
|
curl -L -o dockle.deb "https://github.com/goodwithtech/dockle/releases/download/v${DOCKLE_VERSION}/dockle_${DOCKLE_VERSION}_Linux-64bit.deb"
|
||||||
sudo dpkg -i dockle.deb
|
sudo dpkg -i dockle.deb
|
||||||
- run: |
|
- run: |
|
||||||
cp .config/docker_example.env .config/docker.env
|
cp .config/docker_example.env .config/docker.env
|
||||||
|
|
|
@ -88,7 +88,7 @@ jobs:
|
||||||
if [ "$BRANCH" = "misskey-dev:$HEAD_REF" ]; then
|
if [ "$BRANCH" = "misskey-dev:$HEAD_REF" ]; then
|
||||||
BRANCH="$HEAD_REF"
|
BRANCH="$HEAD_REF"
|
||||||
fi
|
fi
|
||||||
pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name $BRANCH $(echo "$CHROMATIC_PARAMETER")
|
pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name "$BRANCH" $(echo "$CHROMATIC_PARAMETER")
|
||||||
env:
|
env:
|
||||||
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
||||||
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
||||||
|
|
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -7,10 +7,23 @@
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: アイコン画像・バナー画像を外せるように
|
- Enhance: アイコン画像・バナー画像を外せるように
|
||||||
|
- Fix: `/about#federation` ページなどで各インスタンスのチャートが表示されなくなっていた問題を修正
|
||||||
|
- Fix: ユーザーページの追加情報のラベルを投稿者のサーバーの絵文字で表示する (#13968)
|
||||||
|
- Fix: リバーシの対局を正しく共有できないことがある問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正
|
- チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正
|
||||||
|
- Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949)
|
||||||
|
- Fix: ユーザーのフィードページのMFMをHTMLに展開するように (#14006)
|
||||||
|
- Fix: アンテナ・クリップ・リスト・ウェブフックがロールポリシーの上限より一つ多く作れてしまうのを修正 (#14036)
|
||||||
|
- Enhance: エンドポイント`clips/update`の必須項目を`clipId`のみに
|
||||||
|
- Enhance: エンドポイント`admin/roles/update`の必須項目を`roleId`のみに
|
||||||
|
- Enhance: エンドポイント`pages/update`の必須項目を`pageId`のみに
|
||||||
|
- Enhance: エンドポイント`gallery/posts/update`の必須項目を`postId`のみに
|
||||||
|
- Enhance: エンドポイント`i/webhook/update`の必須項目を`webhookId`のみに
|
||||||
|
- Enhance: エンドポイント`admin/ad/update`の必須項目を`id`のみに
|
||||||
|
- Fix: notRespondingSinceが実装される前に不通になったインスタンスが自動的に配信停止にならない (#14059)
|
||||||
|
- Fix: FTT有効時、タイムライン用エンドポイントで`sinceId`にキャッシュ内最古のものより古いものを指定した場合に正しく結果が返ってこない問題を修正
|
||||||
|
|
||||||
## 2024.5.0
|
## 2024.5.0
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
"postcss": "8.4.38",
|
"postcss": "8.4.38",
|
||||||
"tar": "6.2.1",
|
"tar": "6.2.1",
|
||||||
"terser": "5.30.3",
|
"terser": "5.30.3",
|
||||||
"typescript": "5.4.5",
|
"typescript": "5.5.2",
|
||||||
"esbuild": "0.20.2",
|
"esbuild": "0.20.2",
|
||||||
"glob": "10.3.12"
|
"glob": "10.3.12"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20.10.0"
|
"node": "^20.10.0 || ^22.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./built/boot/entry.js",
|
"start": "node ./built/boot/entry.js",
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
"qrcode": "1.5.3",
|
"qrcode": "1.5.3",
|
||||||
"random-seed": "0.3.0",
|
"random-seed": "0.3.0",
|
||||||
"ratelimiter": "3.4.1",
|
"ratelimiter": "3.4.1",
|
||||||
"re2": "1.20.10",
|
"re2": "1.21.2",
|
||||||
"redis-lock": "0.1.4",
|
"redis-lock": "0.1.4",
|
||||||
"reflect-metadata": "0.2.2",
|
"reflect-metadata": "0.2.2",
|
||||||
"rename": "1.0.4",
|
"rename": "1.0.4",
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
"tsc-alias": "1.8.8",
|
"tsc-alias": "1.8.8",
|
||||||
"tsconfig-paths": "4.2.0",
|
"tsconfig-paths": "4.2.0",
|
||||||
"typeorm": "0.3.20",
|
"typeorm": "0.3.20",
|
||||||
"typescript": "5.4.5",
|
"typescript": "5.5.2",
|
||||||
"ulid": "2.3.0",
|
"ulid": "2.3.0",
|
||||||
"vary": "1.1.2",
|
"vary": "1.1.2",
|
||||||
"web-push": "3.6.7",
|
"web-push": "3.6.7",
|
||||||
|
|
|
@ -10,7 +10,6 @@ import sanitizeHtml from 'sanitize-html';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { GlobalEvents, GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEvents, GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import type {
|
import type {
|
||||||
AbuseReportNotificationRecipientRepository,
|
AbuseReportNotificationRecipientRepository,
|
||||||
MiAbuseReportNotificationRecipient,
|
MiAbuseReportNotificationRecipient,
|
||||||
|
@ -91,7 +90,7 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
|
||||||
const recipientEMailAddresses = await this.fetchEMailRecipients().then(it => it
|
const recipientEMailAddresses = await this.fetchEMailRecipients().then(it => it
|
||||||
.filter(it => it.isActive && it.userProfile?.emailVerified)
|
.filter(it => it.isActive && it.userProfile?.emailVerified)
|
||||||
.map(it => it.userProfile?.email)
|
.map(it => it.userProfile?.email)
|
||||||
.filter(isNotNull),
|
.filter(x => x != null),
|
||||||
);
|
);
|
||||||
|
|
||||||
// 送信先の鮮度を保つため、毎回取得する
|
// 送信先の鮮度を保つため、毎回取得する
|
||||||
|
@ -138,7 +137,7 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
|
||||||
.then(it => it
|
.then(it => it
|
||||||
.filter(it => it.isActive && it.systemWebhookId && it.method === 'webhook')
|
.filter(it => it.isActive && it.systemWebhookId && it.method === 'webhook')
|
||||||
.map(it => it.systemWebhookId)
|
.map(it => it.systemWebhookId)
|
||||||
.filter(isNotNull));
|
.filter(x => x != null));
|
||||||
for (const webhookId of recipientWebhookIds) {
|
for (const webhookId of recipientWebhookIds) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
abuseReports.map(it => {
|
abuseReports.map(it => {
|
||||||
|
@ -340,7 +339,7 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
|
||||||
@bindThis
|
@bindThis
|
||||||
private async removeUnauthorizedRecipientUsers(recipients: MiAbuseReportNotificationRecipient[]): Promise<MiAbuseReportNotificationRecipient[]> {
|
private async removeUnauthorizedRecipientUsers(recipients: MiAbuseReportNotificationRecipient[]): Promise<MiAbuseReportNotificationRecipient[]> {
|
||||||
const userRecipients = recipients.filter(it => it.userId !== null);
|
const userRecipients = recipients.filter(it => it.userId !== null);
|
||||||
const recipientUserIds = new Set(userRecipients.map(it => it.userId).filter(isNotNull));
|
const recipientUserIds = new Set(userRecipients.map(it => it.userId).filter(x => x != null));
|
||||||
if (recipientUserIds.size <= 0) {
|
if (recipientUserIds.size <= 0) {
|
||||||
// ユーザが通知先として設定されていない場合、この関数での処理を行うべきレコードが無い
|
// ユーザが通知先として設定されていない場合、この関数での処理を行うべきレコードが無い
|
||||||
return recipients;
|
return recipients;
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class ClipService {
|
||||||
const currentCount = await this.clipsRepository.countBy({
|
const currentCount = await this.clipsRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).clipLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).clipLimit) {
|
||||||
throw new ClipService.TooManyClipsError();
|
throw new ClipService.TooManyClipsError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export class ClipService {
|
||||||
const currentCount = await this.clipNotesRepository.countBy({
|
const currentCount = await this.clipNotesRepository.countBy({
|
||||||
clipId: clip.id,
|
clipId: clip.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).noteEachClipsLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).noteEachClipsLimit) {
|
||||||
throw new ClipService.TooManyClipNotesError();
|
throw new ClipService.TooManyClipNotesError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,6 @@ export class FanoutTimelineEndpointService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async getMiNotes(ps: TimelineOptions): Promise<MiNote[]> {
|
private async getMiNotes(ps: TimelineOptions): Promise<MiNote[]> {
|
||||||
let noteIds: string[];
|
|
||||||
let shouldFallbackToDb = false;
|
|
||||||
|
|
||||||
// 呼び出し元と以下の処理をシンプルにするためにdbFallbackを置き換える
|
// 呼び出し元と以下の処理をシンプルにするためにdbFallbackを置き換える
|
||||||
if (!ps.useDbFallback) ps.dbFallback = () => Promise.resolve([]);
|
if (!ps.useDbFallback) ps.dbFallback = () => Promise.resolve([]);
|
||||||
|
|
||||||
|
@ -67,12 +64,11 @@ export class FanoutTimelineEndpointService {
|
||||||
const redisResult = await this.fanoutTimelineService.getMulti(ps.redisTimelines, ps.untilId, ps.sinceId);
|
const redisResult = await this.fanoutTimelineService.getMulti(ps.redisTimelines, ps.untilId, ps.sinceId);
|
||||||
|
|
||||||
// TODO: いい感じにgetMulti内でソート済だからuniqするときにredisResultが全てソート済なのを利用して再ソートを避けたい
|
// TODO: いい感じにgetMulti内でソート済だからuniqするときにredisResultが全てソート済なのを利用して再ソートを避けたい
|
||||||
const redisResultIds = Array.from(new Set(redisResult.flat(1)));
|
const redisResultIds = Array.from(new Set(redisResult.flat(1))).sort(idCompare);
|
||||||
|
|
||||||
redisResultIds.sort(idCompare);
|
let noteIds = redisResultIds.slice(0, ps.limit);
|
||||||
noteIds = redisResultIds.slice(0, ps.limit);
|
const oldestNoteId = ascending ? redisResultIds[0] : redisResultIds[redisResultIds.length - 1];
|
||||||
|
const shouldFallbackToDb = noteIds.length === 0 || ps.sinceId != null && ps.sinceId < oldestNoteId;
|
||||||
shouldFallbackToDb = shouldFallbackToDb || (noteIds.length === 0);
|
|
||||||
|
|
||||||
if (!shouldFallbackToDb) {
|
if (!shouldFallbackToDb) {
|
||||||
let filter = ps.noteFilter ?? (_note => true);
|
let filter = ps.noteFilter ?? (_note => true);
|
||||||
|
|
|
@ -59,7 +59,6 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
||||||
import { isReply } from '@/misc/is-reply.js';
|
import { isReply } from '@/misc/is-reply.js';
|
||||||
import { trackPromise } from '@/misc/promise-tracker.js';
|
import { trackPromise } from '@/misc/promise-tracker.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
|
||||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
||||||
|
@ -839,7 +838,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
const mentions = extractMentions(tokens);
|
const mentions = extractMentions(tokens);
|
||||||
let mentionedUsers = (await Promise.all(mentions.map(m =>
|
let mentionedUsers = (await Promise.all(mentions.map(m =>
|
||||||
this.remoteUserResolveService.resolveUser(m.username, m.host ?? user.host).catch(() => null),
|
this.remoteUserResolveService.resolveUser(m.username, m.host ?? user.host).catch(() => null),
|
||||||
))).filter(isNotNull);
|
))).filter(x => x != null);
|
||||||
|
|
||||||
// Drop duplicate users
|
// Drop duplicate users
|
||||||
mentionedUsers = mentionedUsers.filter((u, i, self) =>
|
mentionedUsers = mentionedUsers.filter((u, i, self) =>
|
||||||
|
|
|
@ -95,7 +95,7 @@ export class UserListService implements OnApplicationShutdown, OnModuleInit {
|
||||||
const currentCount = await this.userListMembershipsRepository.countBy({
|
const currentCount = await this.userListMembershipsRepository.countBy({
|
||||||
userListId: list.id,
|
userListId: list.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).userEachUserListsLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).userEachUserListsLimit) {
|
||||||
throw new UserListService.TooManyUsersError();
|
throw new UserListService.TooManyUsersError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import promiseLimit from 'promise-limit';
|
||||||
import type { MiRemoteUser, MiUser } from '@/models/User.js';
|
import type { MiRemoteUser, MiUser } from '@/models/User.js';
|
||||||
import { concat, unique } from '@/misc/prelude/array.js';
|
import { concat, unique } from '@/misc/prelude/array.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { getApIds } from './type.js';
|
import { getApIds } from './type.js';
|
||||||
import { ApPersonService } from './models/ApPersonService.js';
|
import { ApPersonService } from './models/ApPersonService.js';
|
||||||
import type { ApObject } from './type.js';
|
import type { ApObject } from './type.js';
|
||||||
|
@ -41,7 +40,7 @@ export class ApAudienceService {
|
||||||
const limit = promiseLimit<MiUser | null>(2);
|
const limit = promiseLimit<MiUser | null>(2);
|
||||||
const mentionedUsers = (await Promise.all(
|
const mentionedUsers = (await Promise.all(
|
||||||
others.map(id => limit(() => this.apPersonService.resolvePerson(id, resolver).catch(() => null))),
|
others.map(id => limit(() => this.apPersonService.resolvePerson(id, resolver).catch(() => null))),
|
||||||
)).filter(isNotNull);
|
)).filter(x => x != null);
|
||||||
|
|
||||||
if (toGroups.public.length > 0) {
|
if (toGroups.public.length > 0) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -27,7 +27,6 @@ import { QueueService } from '@/core/QueueService.js';
|
||||||
import type { UsersRepository, NotesRepository, FollowingsRepository, AbuseUserReportsRepository, FollowRequestsRepository } from '@/models/_.js';
|
import type { UsersRepository, NotesRepository, FollowingsRepository, AbuseUserReportsRepository, FollowRequestsRepository } from '@/models/_.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { MiRemoteUser } from '@/models/User.js';
|
import type { MiRemoteUser } from '@/models/User.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { AbuseReportService } from '@/core/AbuseReportService.js';
|
import { AbuseReportService } from '@/core/AbuseReportService.js';
|
||||||
import { getApHrefNullable, getApId, getApIds, getApType, isAccept, isActor, isAdd, isAnnounce, isBlock, isCollection, isCollectionOrOrderedCollection, isCreate, isDelete, isFlag, isFollow, isLike, isMove, isPost, isReject, isRemove, isTombstone, isUndo, isUpdate, validActor, validPost } from './type.js';
|
import { getApHrefNullable, getApId, getApIds, getApType, isAccept, isActor, isAdd, isAnnounce, isBlock, isCollection, isCollectionOrOrderedCollection, isCreate, isDelete, isFlag, isFollow, isLike, isMove, isPost, isReject, isRemove, isTombstone, isUndo, isUpdate, validActor, validPost } from './type.js';
|
||||||
|
@ -538,7 +537,7 @@ export class ApInboxService {
|
||||||
const userIds = uris
|
const userIds = uris
|
||||||
.filter(uri => uri.startsWith(this.config.url + '/users/'))
|
.filter(uri => uri.startsWith(this.config.url + '/users/'))
|
||||||
.map(uri => uri.split('/').at(-1))
|
.map(uri => uri.split('/').at(-1))
|
||||||
.filter(isNotNull);
|
.filter(x => x != null);
|
||||||
const users = await this.usersRepository.findBy({
|
const users = await this.usersRepository.findBy({
|
||||||
id: In(userIds),
|
id: In(userIds),
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,7 +26,6 @@ import type { MiUserKeypair } from '@/models/UserKeypair.js';
|
||||||
import type { UsersRepository, UserProfilesRepository, NotesRepository, DriveFilesRepository, PollsRepository } from '@/models/_.js';
|
import type { UsersRepository, UserProfilesRepository, NotesRepository, DriveFilesRepository, PollsRepository } from '@/models/_.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { JsonLdService } from './JsonLdService.js';
|
import { JsonLdService } from './JsonLdService.js';
|
||||||
import { ApMfmService } from './ApMfmService.js';
|
import { ApMfmService } from './ApMfmService.js';
|
||||||
|
@ -317,7 +316,7 @@ export class ApRendererService {
|
||||||
const getPromisedFiles = async (ids: string[]): Promise<MiDriveFile[]> => {
|
const getPromisedFiles = async (ids: string[]): Promise<MiDriveFile[]> => {
|
||||||
if (ids.length === 0) return [];
|
if (ids.length === 0) return [];
|
||||||
const items = await this.driveFilesRepository.findBy({ id: In(ids) });
|
const items = await this.driveFilesRepository.findBy({ id: In(ids) });
|
||||||
return ids.map(id => items.find(item => item.id === id)).filter(isNotNull);
|
return ids.map(id => items.find(item => item.id === id)).filter(x => x != null);
|
||||||
};
|
};
|
||||||
|
|
||||||
let inReplyTo;
|
let inReplyTo;
|
||||||
|
@ -686,7 +685,7 @@ export class ApRendererService {
|
||||||
if (names.length === 0) return [];
|
if (names.length === 0) return [];
|
||||||
|
|
||||||
const allEmojis = await this.customEmojiService.localEmojisCache.fetch();
|
const allEmojis = await this.customEmojiService.localEmojisCache.fetch();
|
||||||
const emojis = names.map(name => allEmojis.get(name)).filter(isNotNull);
|
const emojis = names.map(name => allEmojis.get(name)).filter(x => x != null);
|
||||||
|
|
||||||
return emojis;
|
return emojis;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import promiseLimit from 'promise-limit';
|
||||||
import type { MiUser } from '@/models/_.js';
|
import type { MiUser } from '@/models/_.js';
|
||||||
import { toArray, unique } from '@/misc/prelude/array.js';
|
import { toArray, unique } from '@/misc/prelude/array.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { isMention } from '../type.js';
|
import { isMention } from '../type.js';
|
||||||
import { Resolver } from '../ApResolverService.js';
|
import { Resolver } from '../ApResolverService.js';
|
||||||
import { ApPersonService } from './ApPersonService.js';
|
import { ApPersonService } from './ApPersonService.js';
|
||||||
|
@ -28,7 +27,7 @@ export class ApMentionService {
|
||||||
const limit = promiseLimit<MiUser | null>(2);
|
const limit = promiseLimit<MiUser | null>(2);
|
||||||
const mentionedUsers = (await Promise.all(
|
const mentionedUsers = (await Promise.all(
|
||||||
hrefs.map(x => limit(() => this.apPersonService.resolvePerson(x, resolver).catch(() => null))),
|
hrefs.map(x => limit(() => this.apPersonService.resolvePerson(x, resolver).catch(() => null))),
|
||||||
)).filter(isNotNull);
|
)).filter(x => x != null);
|
||||||
|
|
||||||
return mentionedUsers;
|
return mentionedUsers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { checkHttps } from '@/misc/check-https.js';
|
import { checkHttps } from '@/misc/check-https.js';
|
||||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { getOneApId, getApId, getOneApHrefNullable, validPost, isEmoji, getApType } from '../type.js';
|
import { getOneApId, getApId, getOneApHrefNullable, validPost, isEmoji, getApType } from '../type.js';
|
||||||
import { ApLoggerService } from '../ApLoggerService.js';
|
import { ApLoggerService } from '../ApLoggerService.js';
|
||||||
import { ApMfmService } from '../ApMfmService.js';
|
import { ApMfmService } from '../ApMfmService.js';
|
||||||
|
@ -253,7 +252,7 @@ export class ApNoteService {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const uris = unique([note._misskey_quote, note.quoteUrl].filter(isNotNull));
|
const uris = unique([note._misskey_quote, note.quoteUrl].filter(x => x != null));
|
||||||
const results = await Promise.all(uris.map(tryResolveNote));
|
const results = await Promise.all(uris.map(tryResolveNote));
|
||||||
|
|
||||||
quote = results.filter((x): x is { status: 'ok', res: MiNote } => x.status === 'ok').map(x => x.res).at(0);
|
quote = results.filter((x): x is { status: 'ok', res: MiNote } => x.status === 'ok').map(x => x.res).at(0);
|
||||||
|
|
|
@ -38,7 +38,6 @@ import { MetaService } from '@/core/MetaService.js';
|
||||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||||
import type { AccountMoveService } from '@/core/AccountMoveService.js';
|
import type { AccountMoveService } from '@/core/AccountMoveService.js';
|
||||||
import { checkHttps } from '@/misc/check-https.js';
|
import { checkHttps } from '@/misc/check-https.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { getApId, getApType, getOneApHrefNullable, isActor, isCollection, isCollectionOrOrderedCollection, isPropertyValue } from '../type.js';
|
import { getApId, getApType, getOneApHrefNullable, isActor, isCollection, isCollectionOrOrderedCollection, isPropertyValue } from '../type.js';
|
||||||
import { extractApHashtags } from './tag.js';
|
import { extractApHashtags } from './tag.js';
|
||||||
import type { OnModuleInit } from '@nestjs/common';
|
import type { OnModuleInit } from '@nestjs/common';
|
||||||
|
@ -637,7 +636,7 @@ export class ApPersonService implements OnModuleInit {
|
||||||
|
|
||||||
// とりあえずidを別の時間で生成して順番を維持
|
// とりあえずidを別の時間で生成して順番を維持
|
||||||
let td = 0;
|
let td = 0;
|
||||||
for (const note of featuredNotes.filter(isNotNull)) {
|
for (const note of featuredNotes.filter(x => x != null)) {
|
||||||
td -= 1000;
|
td -= 1000;
|
||||||
transactionalEntityManager.insert(MiUserNotePining, {
|
transactionalEntityManager.insert(MiUserNotePining, {
|
||||||
id: this.idService.gen(Date.now() + td),
|
id: this.idService.gen(Date.now() + td),
|
||||||
|
|
|
@ -10,7 +10,6 @@ import type { Config } from '@/config.js';
|
||||||
import type { IPoll } from '@/models/Poll.js';
|
import type { IPoll } from '@/models/Poll.js';
|
||||||
import type Logger from '@/logger.js';
|
import type Logger from '@/logger.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { isQuestion } from '../type.js';
|
import { isQuestion } from '../type.js';
|
||||||
import { ApLoggerService } from '../ApLoggerService.js';
|
import { ApLoggerService } from '../ApLoggerService.js';
|
||||||
import { ApResolverService } from '../ApResolverService.js';
|
import { ApResolverService } from '../ApResolverService.js';
|
||||||
|
@ -52,7 +51,7 @@ export class ApQuestionService {
|
||||||
|
|
||||||
const choices = question[multiple ? 'anyOf' : 'oneOf']
|
const choices = question[multiple ? 'anyOf' : 'oneOf']
|
||||||
?.map((x) => x.name)
|
?.map((x) => x.name)
|
||||||
.filter(isNotNull)
|
.filter(x => x != null)
|
||||||
?? [];
|
?? [];
|
||||||
|
|
||||||
const votes = question[multiple ? 'anyOf' : 'oneOf']?.map((x) => x.replies?.totalItems ?? x._misskey_votes ?? 0);
|
const votes = question[multiple ? 'anyOf' : 'oneOf']?.map((x) => x.replies?.totalItems ?? x._misskey_votes ?? 0);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { toArray } from '@/misc/prelude/array.js';
|
import { toArray } from '@/misc/prelude/array.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { isHashtag } from '../type.js';
|
import { isHashtag } from '../type.js';
|
||||||
import type { IObject, IApHashtag } from '../type.js';
|
import type { IObject, IApHashtag } from '../type.js';
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ export function extractApHashtags(tags: IObject | IObject[] | null | undefined):
|
||||||
return hashtags.map(tag => {
|
return hashtags.map(tag => {
|
||||||
const m = tag.name.match(/^#(.+)/);
|
const m = tag.name.match(/^#(.+)/);
|
||||||
return m ? m[1] : null;
|
return m ? m[1] : null;
|
||||||
}).filter(isNotNull);
|
}).filter(x => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractApHashtagObjects(tags: IObject | IObject[] | null | undefined): IApHashtag[] {
|
export function extractApHashtagObjects(tags: IObject | IObject[] | null | undefined): IApHashtag[] {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { Packed } from '@/misc/json-schema.js';
|
import { Packed } from '@/misc/json-schema.js';
|
||||||
import { SystemWebhookEntityService } from '@/core/entities/SystemWebhookEntityService.js';
|
import { SystemWebhookEntityService } from '@/core/entities/SystemWebhookEntityService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AbuseReportNotificationRecipientEntityService {
|
export class AbuseReportNotificationRecipientEntityService {
|
||||||
|
@ -66,13 +65,13 @@ export class AbuseReportNotificationRecipientEntityService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userIds = objs.map(it => it.userId).filter(isNotNull);
|
const userIds = objs.map(it => it.userId).filter(x => x != null);
|
||||||
const users: Map<string, Packed<'UserLite'>> = (userIds.length > 0)
|
const users: Map<string, Packed<'UserLite'>> = (userIds.length > 0)
|
||||||
? await this.userEntityService.packMany(userIds)
|
? await this.userEntityService.packMany(userIds)
|
||||||
.then(it => new Map(it.map(it => [it.id, it])))
|
.then(it => new Map(it.map(it => [it.id, it])))
|
||||||
: new Map();
|
: new Map();
|
||||||
|
|
||||||
const systemWebhookIds = objs.map(it => it.systemWebhookId).filter(isNotNull);
|
const systemWebhookIds = objs.map(it => it.systemWebhookId).filter(x => x != null);
|
||||||
const systemWebhooks: Map<string, Packed<'SystemWebhook'>> = (systemWebhookIds.length > 0)
|
const systemWebhooks: Map<string, Packed<'SystemWebhook'>> = (systemWebhookIds.length > 0)
|
||||||
? await this.systemWebhookEntityService.packMany(systemWebhookIds)
|
? await this.systemWebhookEntityService.packMany(systemWebhookIds)
|
||||||
.then(it => new Map(it.map(it => [it.id, it])))
|
.then(it => new Map(it.map(it => [it.id, it])))
|
||||||
|
|
|
@ -10,7 +10,6 @@ import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { MiAbuseUserReport } from '@/models/AbuseUserReport.js';
|
import type { MiAbuseUserReport } from '@/models/AbuseUserReport.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
|
|
||||||
|
@ -63,7 +62,7 @@ export class AbuseUserReportEntityService {
|
||||||
) {
|
) {
|
||||||
const _reporters = reports.map(({ reporter, reporterId }) => reporter ?? reporterId);
|
const _reporters = reports.map(({ reporter, reporterId }) => reporter ?? reporterId);
|
||||||
const _targetUsers = reports.map(({ targetUser, targetUserId }) => targetUser ?? targetUserId);
|
const _targetUsers = reports.map(({ targetUser, targetUserId }) => targetUser ?? targetUserId);
|
||||||
const _assignees = reports.map(({ assignee, assigneeId }) => assignee ?? assigneeId).filter(isNotNull);
|
const _assignees = reports.map(({ assignee, assigneeId }) => assignee ?? assigneeId).filter(x => x != null);
|
||||||
const _userMap = await this.userEntityService.packMany(
|
const _userMap = await this.userEntityService.packMany(
|
||||||
[..._reporters, ..._targetUsers, ..._assignees],
|
[..._reporters, ..._targetUsers, ..._assignees],
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -16,7 +16,6 @@ import { appendQuery, query } from '@/misc/prelude/url.js';
|
||||||
import { deepClone } from '@/misc/clone.js';
|
import { deepClone } from '@/misc/clone.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isMimeImage } from '@/misc/is-mime-image.js';
|
import { isMimeImage } from '@/misc/is-mime-image.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { UtilityService } from '../UtilityService.js';
|
import { UtilityService } from '../UtilityService.js';
|
||||||
import { VideoProcessingService } from '../VideoProcessingService.js';
|
import { VideoProcessingService } from '../VideoProcessingService.js';
|
||||||
|
@ -261,11 +260,11 @@ export class DriveFileEntityService {
|
||||||
files: MiDriveFile[],
|
files: MiDriveFile[],
|
||||||
options?: PackOptions,
|
options?: PackOptions,
|
||||||
): Promise<Packed<'DriveFile'>[]> {
|
): Promise<Packed<'DriveFile'>[]> {
|
||||||
const _user = files.map(({ user, userId }) => user ?? userId).filter(isNotNull);
|
const _user = files.map(({ user, userId }) => user ?? userId).filter(x => x != null);
|
||||||
const _userMap = await this.userEntityService.packMany(_user)
|
const _userMap = await this.userEntityService.packMany(_user)
|
||||||
.then(users => new Map(users.map(user => [user.id, user])));
|
.then(users => new Map(users.map(user => [user.id, user])));
|
||||||
const items = await Promise.all(files.map(f => this.packNullable(f, options, f.userId ? { packedUser: _userMap.get(f.userId) } : {})));
|
const items = await Promise.all(files.map(f => this.packNullable(f, options, f.userId ? { packedUser: _userMap.get(f.userId) } : {})));
|
||||||
return items.filter(isNotNull);
|
return items.filter(x => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -290,6 +289,6 @@ export class DriveFileEntityService {
|
||||||
): Promise<Packed<'DriveFile'>[]> {
|
): Promise<Packed<'DriveFile'>[]> {
|
||||||
if (fileIds.length === 0) return [];
|
if (fileIds.length === 0) return [];
|
||||||
const filesMap = await this.packManyByIdsMap(fileIds, options);
|
const filesMap = await this.packManyByIdsMap(fileIds, options);
|
||||||
return fileIds.map(id => filesMap.get(id)).filter(isNotNull);
|
return fileIds.map(id => filesMap.get(id)).filter(x => x != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import type { MiUser } from '@/models/User.js';
|
||||||
import type { MiRegistrationTicket } from '@/models/RegistrationTicket.js';
|
import type { MiRegistrationTicket } from '@/models/RegistrationTicket.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -59,8 +58,8 @@ export class InviteCodeEntityService {
|
||||||
tickets: MiRegistrationTicket[],
|
tickets: MiRegistrationTicket[],
|
||||||
me: { id: MiUser['id'] },
|
me: { id: MiUser['id'] },
|
||||||
) {
|
) {
|
||||||
const _createdBys = tickets.map(({ createdBy, createdById }) => createdBy ?? createdById).filter(isNotNull);
|
const _createdBys = tickets.map(({ createdBy, createdById }) => createdBy ?? createdById).filter(x => x != null);
|
||||||
const _usedBys = tickets.map(({ usedBy, usedById }) => usedBy ?? usedById).filter(isNotNull);
|
const _usedBys = tickets.map(({ usedBy, usedById }) => usedBy ?? usedById).filter(x => x != null);
|
||||||
const _userMap = await this.userEntityService.packMany([..._createdBys, ..._usedBys], me)
|
const _userMap = await this.userEntityService.packMany([..._createdBys, ..._usedBys], me)
|
||||||
.then(users => new Map(users.map(u => [u.id, u])));
|
.then(users => new Map(users.map(u => [u.id, u])));
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
|
|
|
@ -14,7 +14,6 @@ import type { MiNote } from '@/models/Note.js';
|
||||||
import type { MiNoteReaction } from '@/models/NoteReaction.js';
|
import type { MiNoteReaction } from '@/models/NoteReaction.js';
|
||||||
import type { UsersRepository, NotesRepository, FollowingsRepository, PollsRepository, PollVotesRepository, NoteReactionsRepository, ChannelsRepository } from '@/models/_.js';
|
import type { UsersRepository, NotesRepository, FollowingsRepository, PollsRepository, PollVotesRepository, NoteReactionsRepository, ChannelsRepository } from '@/models/_.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { DebounceLoader } from '@/misc/loader.js';
|
import { DebounceLoader } from '@/misc/loader.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import type { OnModuleInit } from '@nestjs/common';
|
import type { OnModuleInit } from '@nestjs/common';
|
||||||
|
@ -276,7 +275,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
packedFiles.set(k, v);
|
packedFiles.set(k, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fileIds.map(id => packedFiles.get(id)).filter(isNotNull);
|
return fileIds.map(id => packedFiles.get(id)).filter(x => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -449,12 +448,12 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
|
|
||||||
await this.customEmojiService.prefetchEmojis(this.aggregateNoteEmojis(notes));
|
await this.customEmojiService.prefetchEmojis(this.aggregateNoteEmojis(notes));
|
||||||
// TODO: 本当は renote とか reply がないのに renoteId とか replyId があったらここで解決しておく
|
// TODO: 本当は renote とか reply がないのに renoteId とか replyId があったらここで解決しておく
|
||||||
const fileIds = notes.map(n => [n.fileIds, n.renote?.fileIds, n.reply?.fileIds]).flat(2).filter(isNotNull);
|
const fileIds = notes.map(n => [n.fileIds, n.renote?.fileIds, n.reply?.fileIds]).flat(2).filter(x => x != null);
|
||||||
const packedFiles = fileIds.length > 0 ? await this.driveFileEntityService.packManyByIdsMap(fileIds) : new Map();
|
const packedFiles = fileIds.length > 0 ? await this.driveFileEntityService.packManyByIdsMap(fileIds) : new Map();
|
||||||
const users = [
|
const users = [
|
||||||
...notes.map(({ user, userId }) => user ?? userId),
|
...notes.map(({ user, userId }) => user ?? userId),
|
||||||
...notes.map(({ replyUserId }) => replyUserId).filter(isNotNull),
|
...notes.map(({ replyUserId }) => replyUserId).filter(x => x != null),
|
||||||
...notes.map(({ renoteUserId }) => renoteUserId).filter(isNotNull),
|
...notes.map(({ renoteUserId }) => renoteUserId).filter(x => x != null),
|
||||||
];
|
];
|
||||||
const packedUsers = await this.userEntityService.packMany(users, me)
|
const packedUsers = await this.userEntityService.packMany(users, me)
|
||||||
.then(users => new Map(users.map(u => [u.id, u])));
|
.then(users => new Map(users.map(u => [u.id, u])));
|
||||||
|
|
|
@ -13,7 +13,6 @@ import type { MiGroupedNotification, MiNotification } from '@/models/Notificatio
|
||||||
import type { MiNote } from '@/models/Note.js';
|
import type { MiNote } from '@/models/Note.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { FilterUnionByProperty, groupedNotificationTypes } from '@/types.js';
|
import { FilterUnionByProperty, groupedNotificationTypes } from '@/types.js';
|
||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
import { RoleEntityService } from './RoleEntityService.js';
|
import { RoleEntityService } from './RoleEntityService.js';
|
||||||
|
@ -103,7 +102,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
user,
|
user,
|
||||||
reaction: reaction.reaction,
|
reaction: reaction.reaction,
|
||||||
};
|
};
|
||||||
}))).filter(r => isNotNull(r.user));
|
}))).filter(r => r.user != null);
|
||||||
// if all users have been deleted, don't show this notification
|
// if all users have been deleted, don't show this notification
|
||||||
if (reactions.length === 0) {
|
if (reactions.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -124,7 +123,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.userEntityService.pack(userId, { id: meId });
|
return this.userEntityService.pack(userId, { id: meId });
|
||||||
}))).filter(isNotNull);
|
}))).filter(x => x != null);
|
||||||
// if all users have been deleted, don't show this notification
|
// if all users have been deleted, don't show this notification
|
||||||
if (users.length === 0) {
|
if (users.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -181,7 +180,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
|
|
||||||
validNotifications = await this.#filterValidNotifier(validNotifications, meId);
|
validNotifications = await this.#filterValidNotifier(validNotifications, meId);
|
||||||
|
|
||||||
const noteIds = validNotifications.map(x => 'noteId' in x ? x.noteId : null).filter(isNotNull);
|
const noteIds = validNotifications.map(x => 'noteId' in x ? x.noteId : null).filter(x => x != null);
|
||||||
const notes = noteIds.length > 0 ? await this.notesRepository.find({
|
const notes = noteIds.length > 0 ? await this.notesRepository.find({
|
||||||
where: { id: In(noteIds) },
|
where: { id: In(noteIds) },
|
||||||
relations: ['user', 'reply', 'reply.user', 'renote', 'renote.user'],
|
relations: ['user', 'reply', 'reply.user', 'renote', 'renote.user'],
|
||||||
|
@ -223,7 +222,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (await Promise.all(packPromises)).filter(isNotNull);
|
return (await Promise.all(packPromises)).filter(x => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -305,7 +304,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
this.cacheService.userProfileCache.fetch(meId).then(p => new Set(p.mutedInstances)),
|
this.cacheService.userProfileCache.fetch(meId).then(p => new Set(p.mutedInstances)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const notifierIds = notifications.map(notification => 'notifierId' in notification ? notification.notifierId : null).filter(isNotNull);
|
const notifierIds = notifications.map(notification => 'notifierId' in notification ? notification.notifierId : null).filter(x => x != null);
|
||||||
const notifiers = notifierIds.length > 0 ? await this.usersRepository.find({
|
const notifiers = notifierIds.length > 0 ? await this.usersRepository.find({
|
||||||
where: { id: In(notifierIds) },
|
where: { id: In(notifierIds) },
|
||||||
}) : [];
|
}) : [];
|
||||||
|
@ -313,7 +312,7 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
const filteredNotifications = ((await Promise.all(notifications.map(async (notification) => {
|
const filteredNotifications = ((await Promise.all(notifications.map(async (notification) => {
|
||||||
const isValid = this.#validateNotifier(notification, userIdsWhoMeMuting, userMutedInstances, notifiers);
|
const isValid = this.#validateNotifier(notification, userIdsWhoMeMuting, userMutedInstances, notifiers);
|
||||||
return isValid ? notification : null;
|
return isValid ? notification : null;
|
||||||
}))) as [T | null] ).filter(isNotNull);
|
}))) as [T | null] ).filter(x => x != null);
|
||||||
|
|
||||||
return filteredNotifications;
|
return filteredNotifications;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import type { MiPage } from '@/models/Page.js';
|
||||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import { UserEntityService } from './UserEntityService.js';
|
import { UserEntityService } from './UserEntityService.js';
|
||||||
import { DriveFileEntityService } from './DriveFileEntityService.js';
|
import { DriveFileEntityService } from './DriveFileEntityService.js';
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ export class PageEntityService {
|
||||||
script: page.script,
|
script: page.script,
|
||||||
eyeCatchingImageId: page.eyeCatchingImageId,
|
eyeCatchingImageId: page.eyeCatchingImageId,
|
||||||
eyeCatchingImage: page.eyeCatchingImageId ? await this.driveFileEntityService.pack(page.eyeCatchingImageId) : null,
|
eyeCatchingImage: page.eyeCatchingImageId ? await this.driveFileEntityService.pack(page.eyeCatchingImageId) : null,
|
||||||
attachedFiles: this.driveFileEntityService.packMany((await Promise.all(attachedFiles)).filter(isNotNull)),
|
attachedFiles: this.driveFileEntityService.packMany((await Promise.all(attachedFiles)).filter(x => x != null)),
|
||||||
likedCount: page.likedCount,
|
likedCount: page.likedCount,
|
||||||
isLiked: meId ? await this.pageLikesRepository.exists({ where: { pageId: page.id, userId: meId } }) : undefined,
|
isLiked: meId ? await this.pageLikesRepository.exists({ where: { pageId: page.id, userId: meId } }) : undefined,
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,7 +47,6 @@ import { IdService } from '@/core/IdService.js';
|
||||||
import type { AnnouncementService } from '@/core/AnnouncementService.js';
|
import type { AnnouncementService } from '@/core/AnnouncementService.js';
|
||||||
import type { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import type { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
|
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
import type { OnModuleInit } from '@nestjs/common';
|
import type { OnModuleInit } from '@nestjs/common';
|
||||||
import type { NoteEntityService } from './NoteEntityService.js';
|
import type { NoteEntityService } from './NoteEntityService.js';
|
||||||
import type { DriveFileEntityService } from './DriveFileEntityService.js';
|
import type { DriveFileEntityService } from './DriveFileEntityService.js';
|
||||||
|
@ -514,7 +513,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
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,
|
||||||
alsoKnownAs: user.alsoKnownAs
|
alsoKnownAs: user.alsoKnownAs
|
||||||
? Promise.all(user.alsoKnownAs.map(uri => this.apPersonService.fetchPerson(uri).then(user => user?.id).catch(() => null)))
|
? Promise.all(user.alsoKnownAs.map(uri => this.apPersonService.fetchPerson(uri).then(user => user?.id).catch(() => null)))
|
||||||
.then(xs => xs.length === 0 ? null : xs.filter(isNotNull))
|
.then(xs => xs.length === 0 ? null : xs.filter(x => x != null))
|
||||||
: null,
|
: null,
|
||||||
createdAt: this.idService.parse(user.id).date.toISOString(),
|
createdAt: this.idService.parse(user.id).date.toISOString(),
|
||||||
updatedAt: user.updatedAt ? user.updatedAt.toISOString() : null,
|
updatedAt: user.updatedAt ? user.updatedAt.toISOString() : null,
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function isNotNull<T extends NonNullable<unknown>>(input: T | undefined | null): input is T {
|
|
||||||
return input != null;
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function gcd(a: number, b: number): number {
|
|
||||||
return b === 0 ? a : gcd(b, a % b);
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface IMaybe<T> {
|
|
||||||
isJust(): this is IJust<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IJust<T> extends IMaybe<T> {
|
|
||||||
get(): T;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function just<T>(value: T): IJust<T> {
|
|
||||||
return {
|
|
||||||
isJust: () => true,
|
|
||||||
get: () => value,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function nothing<T>(): IMaybe<T> {
|
|
||||||
return {
|
|
||||||
isJust: () => false,
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function concat(xs: string[]): string {
|
|
||||||
return xs.join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function capitalize(s: string): string {
|
|
||||||
return toUpperCase(s.charAt(0)) + toLowerCase(s.slice(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function toUpperCase(s: string): string {
|
|
||||||
return s.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function toLowerCase(s: string): string {
|
|
||||||
return s.toLowerCase();
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const fallback = Symbol('fallback');
|
|
|
@ -82,34 +82,14 @@ import { MiReversiGame } from '@/models/ReversiGame.js';
|
||||||
import type { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity.js';
|
import type { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity.js';
|
||||||
|
|
||||||
export interface MiRepository<T extends ObjectLiteral> {
|
export interface MiRepository<T extends ObjectLiteral> {
|
||||||
createTableColumnNames(this: Repository<T> & MiRepository<T>, queryBuilder: InsertQueryBuilder<T>): string[];
|
createTableColumnNames(this: Repository<T> & MiRepository<T>): string[];
|
||||||
createTableColumnNamesWithPrimaryKey(this: Repository<T> & MiRepository<T>, queryBuilder: InsertQueryBuilder<T>): string[];
|
|
||||||
insertOne(this: Repository<T> & MiRepository<T>, entity: QueryDeepPartialEntity<T>, findOptions?: Pick<FindOneOptions<T>, 'relations'>): Promise<T>;
|
insertOne(this: Repository<T> & MiRepository<T>, entity: QueryDeepPartialEntity<T>, findOptions?: Pick<FindOneOptions<T>, 'relations'>): Promise<T>;
|
||||||
selectAliasColumnNames(this: Repository<T> & MiRepository<T>, queryBuilder: InsertQueryBuilder<T>, builder: SelectQueryBuilder<T>): void;
|
selectAliasColumnNames(this: Repository<T> & MiRepository<T>, queryBuilder: InsertQueryBuilder<T>, builder: SelectQueryBuilder<T>): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const miRepository = {
|
export const miRepository = {
|
||||||
createTableColumnNames(queryBuilder) {
|
createTableColumnNames() {
|
||||||
// @ts-expect-error -- protected
|
return this.metadata.columns.filter(column => column.isSelect && !column.isVirtual).map(column => column.databaseName);
|
||||||
const insertedColumns = queryBuilder.getInsertedColumns();
|
|
||||||
if (insertedColumns.length) {
|
|
||||||
return insertedColumns.map(column => column.databaseName);
|
|
||||||
}
|
|
||||||
if (!queryBuilder.expressionMap.mainAlias?.hasMetadata && !queryBuilder.expressionMap.insertColumns.length) {
|
|
||||||
// @ts-expect-error -- protected
|
|
||||||
const valueSets = queryBuilder.getValueSets();
|
|
||||||
if (valueSets.length === 1) {
|
|
||||||
return Object.keys(valueSets[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return queryBuilder.expressionMap.insertColumns;
|
|
||||||
},
|
|
||||||
createTableColumnNamesWithPrimaryKey(queryBuilder) {
|
|
||||||
const columnNames = this.createTableColumnNames(queryBuilder);
|
|
||||||
if (!columnNames.includes('id')) {
|
|
||||||
columnNames.unshift('id');
|
|
||||||
}
|
|
||||||
return columnNames;
|
|
||||||
},
|
},
|
||||||
async insertOne(entity, findOptions?) {
|
async insertOne(entity, findOptions?) {
|
||||||
const queryBuilder = this.createQueryBuilder().insert().values(entity);
|
const queryBuilder = this.createQueryBuilder().insert().values(entity);
|
||||||
|
@ -117,7 +97,7 @@ export const miRepository = {
|
||||||
const mainAlias = queryBuilder.expressionMap.mainAlias!;
|
const mainAlias = queryBuilder.expressionMap.mainAlias!;
|
||||||
const name = mainAlias.name;
|
const name = mainAlias.name;
|
||||||
mainAlias.name = 't';
|
mainAlias.name = 't';
|
||||||
const columnNames = this.createTableColumnNamesWithPrimaryKey(queryBuilder);
|
const columnNames = this.createTableColumnNames();
|
||||||
queryBuilder.returning(columnNames.reduce((a, c) => `${a}, ${queryBuilder.escape(c)}`, '').slice(2));
|
queryBuilder.returning(columnNames.reduce((a, c) => `${a}, ${queryBuilder.escape(c)}`, '').slice(2));
|
||||||
const builder = this.createQueryBuilder().addCommonTableExpression(queryBuilder, 'cte', { columnNames });
|
const builder = this.createQueryBuilder().addCommonTableExpression(queryBuilder, 'cte', { columnNames });
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
@ -138,7 +118,7 @@ export const miRepository = {
|
||||||
selectOrAddSelect = (selection, selectionAliasName) => builder.addSelect(selection, selectionAliasName);
|
selectOrAddSelect = (selection, selectionAliasName) => builder.addSelect(selection, selectionAliasName);
|
||||||
return builder.select(selection, selectionAliasName);
|
return builder.select(selection, selectionAliasName);
|
||||||
};
|
};
|
||||||
for (const columnName of this.createTableColumnNamesWithPrimaryKey(queryBuilder)) {
|
for (const columnName of this.createTableColumnNames()) {
|
||||||
selectOrAddSelect(`${builder.alias}.${columnName}`, `${builder.alias}_${columnName}`);
|
selectOrAddSelect(`${builder.alias}.${columnName}`, `${builder.alias}_${columnName}`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -109,6 +109,12 @@ export class DeliverProcessorService {
|
||||||
suspensionState: 'autoSuspendedForNotResponding',
|
suspensionState: 'autoSuspendedForNotResponding',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// isNotRespondingがtrueでnotRespondingSinceがnullの場合はnotRespondingSinceをセット
|
||||||
|
// notRespondingSinceは新たな機能なので、それ以前のデータにはnotRespondingSinceがない場合がある
|
||||||
|
this.federatedInstanceService.update(i.id, {
|
||||||
|
notRespondingSince: new Date(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.apRequestChart.deliverFail();
|
this.apRequestChart.deliverFail();
|
||||||
|
|
|
@ -73,6 +73,16 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
reply.header('WWW-Authenticate', `Bearer realm="Misskey", error="insufficient_scope", error_description="${err.message}"`);
|
reply.header('WWW-Authenticate', `Bearer realm="Misskey", error="insufficient_scope", error_description="${err.message}"`);
|
||||||
}
|
}
|
||||||
statusCode = statusCode ?? 403;
|
statusCode = statusCode ?? 403;
|
||||||
|
} else if (err.code === 'RATE_LIMIT_EXCEEDED') {
|
||||||
|
const info: unknown = err.info;
|
||||||
|
const unixEpochInSeconds = Date.now();
|
||||||
|
if (typeof(info) === 'object' && info && 'resetMs' in info && typeof(info.resetMs) === 'number') {
|
||||||
|
const cooldownInSeconds = Math.ceil((info.resetMs - unixEpochInSeconds) / 1000);
|
||||||
|
// もしかするとマイナスになる可能性がなくはないのでマイナスだったら0にしておく
|
||||||
|
reply.header('Retry-After', Math.max(cooldownInSeconds, 0).toString(10));
|
||||||
|
} else {
|
||||||
|
this.logger.warn(`rate limit information has unexpected type ${typeof(err.info?.reset)}`);
|
||||||
|
}
|
||||||
} else if (!statusCode) {
|
} else if (!statusCode) {
|
||||||
statusCode = 500;
|
statusCode = 500;
|
||||||
}
|
}
|
||||||
|
@ -308,12 +318,17 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
if (factor > 0) {
|
if (factor > 0) {
|
||||||
// Rate limit
|
// Rate limit
|
||||||
await this.rateLimiterService.limit(limit as IEndpointMeta['limit'] & { key: NonNullable<string> }, limitActor, factor).catch(err => {
|
await this.rateLimiterService.limit(limit as IEndpointMeta['limit'] & { key: NonNullable<string> }, limitActor, factor).catch(err => {
|
||||||
|
if ('info' in err) {
|
||||||
|
// errはLimiter.LimiterInfoであることが期待される
|
||||||
throw new ApiError({
|
throw new ApiError({
|
||||||
message: 'Rate limit exceeded. Please try again later.',
|
message: 'Rate limit exceeded. Please try again later.',
|
||||||
code: 'RATE_LIMIT_EXCEEDED',
|
code: 'RATE_LIMIT_EXCEEDED',
|
||||||
id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef',
|
id: 'd5826d14-3982-4d2e-8011-b9e9f02499ef',
|
||||||
httpStatusCode: 429,
|
httpStatusCode: 429,
|
||||||
});
|
}, err.info);
|
||||||
|
} else {
|
||||||
|
throw new TypeError('information must be a rate-limiter information.');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,13 @@ export class RateLimiterService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public limit(limitation: IEndpointMeta['limit'] & { key: NonNullable<string> }, actor: string, factor = 1) {
|
public limit(limitation: IEndpointMeta['limit'] & { key: NonNullable<string> }, actor: string, factor = 1) {
|
||||||
return new Promise<void>((ok, reject) => {
|
{
|
||||||
if (this.disabled) ok();
|
if (this.disabled) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
// Short-term limit
|
// Short-term limit
|
||||||
const min = (): void => {
|
const min = new Promise<void>((ok, reject) => {
|
||||||
const minIntervalLimiter = new Limiter({
|
const minIntervalLimiter = new Limiter({
|
||||||
id: `${actor}:${limitation.key}:min`,
|
id: `${actor}:${limitation.key}:min`,
|
||||||
duration: limitation.minInterval! * factor,
|
duration: limitation.minInterval! * factor,
|
||||||
|
@ -46,25 +48,25 @@ export class RateLimiterService {
|
||||||
|
|
||||||
minIntervalLimiter.get((err, info) => {
|
minIntervalLimiter.get((err, info) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject('ERR');
|
return reject({ code: 'ERR', info });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.debug(`${actor} ${limitation.key} min remaining: ${info.remaining}`);
|
this.logger.debug(`${actor} ${limitation.key} min remaining: ${info.remaining}`);
|
||||||
|
|
||||||
if (info.remaining === 0) {
|
if (info.remaining === 0) {
|
||||||
reject('BRIEF_REQUEST_INTERVAL');
|
return reject({ code: 'BRIEF_REQUEST_INTERVAL', info });
|
||||||
} else {
|
} else {
|
||||||
if (hasLongTermLimit) {
|
if (hasLongTermLimit) {
|
||||||
max();
|
return max.then(ok, reject);
|
||||||
} else {
|
} else {
|
||||||
ok();
|
return ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
// Long term limit
|
// Long term limit
|
||||||
const max = (): void => {
|
const max = new Promise<void>((ok, reject) => {
|
||||||
const limiter = new Limiter({
|
const limiter = new Limiter({
|
||||||
id: `${actor}:${limitation.key}`,
|
id: `${actor}:${limitation.key}`,
|
||||||
duration: limitation.duration! * factor,
|
duration: limitation.duration! * factor,
|
||||||
|
@ -74,18 +76,18 @@ export class RateLimiterService {
|
||||||
|
|
||||||
limiter.get((err, info) => {
|
limiter.get((err, info) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject('ERR');
|
return reject({ code: 'ERR', info });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.debug(`${actor} ${limitation.key} max remaining: ${info.remaining}`);
|
this.logger.debug(`${actor} ${limitation.key} max remaining: ${info.remaining}`);
|
||||||
|
|
||||||
if (info.remaining === 0) {
|
if (info.remaining === 0) {
|
||||||
reject('RATE_LIMIT_EXCEEDED');
|
return reject({ code: 'RATE_LIMIT_EXCEEDED', info });
|
||||||
} else {
|
} else {
|
||||||
ok();
|
return ok();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
const hasShortTermLimit = typeof limitation.minInterval === 'number';
|
const hasShortTermLimit = typeof limitation.minInterval === 'number';
|
||||||
|
|
||||||
|
@ -94,12 +96,12 @@ export class RateLimiterService {
|
||||||
typeof limitation.max === 'number';
|
typeof limitation.max === 'number';
|
||||||
|
|
||||||
if (hasShortTermLimit) {
|
if (hasShortTermLimit) {
|
||||||
min();
|
return min;
|
||||||
} else if (hasLongTermLimit) {
|
} else if (hasLongTermLimit) {
|
||||||
max();
|
return max;
|
||||||
} else {
|
} else {
|
||||||
ok();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export const paramDef = {
|
||||||
startsAt: { type: 'integer' },
|
startsAt: { type: 'integer' },
|
||||||
dayOfWeek: { type: 'integer' },
|
dayOfWeek: { type: 'integer' },
|
||||||
},
|
},
|
||||||
required: ['id', 'memo', 'url', 'imageUrl', 'place', 'priority', 'ratio', 'expiresAt', 'startsAt', 'dayOfWeek'],
|
required: ['id'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -63,8 +63,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
ratio: ps.ratio,
|
ratio: ps.ratio,
|
||||||
memo: ps.memo,
|
memo: ps.memo,
|
||||||
imageUrl: ps.imageUrl,
|
imageUrl: ps.imageUrl,
|
||||||
expiresAt: new Date(ps.expiresAt),
|
expiresAt: ps.expiresAt ? new Date(ps.expiresAt) : undefined,
|
||||||
startsAt: new Date(ps.startsAt),
|
startsAt: ps.startsAt ? new Date(ps.startsAt) : undefined,
|
||||||
dayOfWeek: ps.dayOfWeek,
|
dayOfWeek: ps.dayOfWeek,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { RolesRepository } from '@/models/_.js';
|
import type { RolesRepository } from '@/models/_.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { ApiError } from '@/server/api/error.js';
|
import { ApiError } from '@/server/api/error.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
@ -50,19 +49,6 @@ export const paramDef = {
|
||||||
},
|
},
|
||||||
required: [
|
required: [
|
||||||
'roleId',
|
'roleId',
|
||||||
'name',
|
|
||||||
'description',
|
|
||||||
'color',
|
|
||||||
'iconUrl',
|
|
||||||
'target',
|
|
||||||
'condFormula',
|
|
||||||
'isPublic',
|
|
||||||
'isModerator',
|
|
||||||
'isAdministrator',
|
|
||||||
'asBadge',
|
|
||||||
'canEditMembersByModerator',
|
|
||||||
'displayOrder',
|
|
||||||
'policies',
|
|
||||||
],
|
],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentAntennasCount = await this.antennasRepository.countBy({
|
const currentAntennasCount = await this.antennasRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentAntennasCount > (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
if (currentAntennasCount >= (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyAntennas);
|
throw new ApiError(meta.errors.tooManyAntennas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { ClipEntityService } from '@/core/entities/ClipEntityService.js';
|
import { ClipEntityService } from '@/core/entities/ClipEntityService.js';
|
||||||
import { ClipService } from '@/core/ClipService.js';
|
import { ClipService } from '@/core/ClipService.js';
|
||||||
|
@ -41,7 +41,7 @@ export const paramDef = {
|
||||||
isPublic: { type: 'boolean' },
|
isPublic: { type: 'boolean' },
|
||||||
description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 },
|
description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 },
|
||||||
},
|
},
|
||||||
required: ['clipId', 'name'],
|
required: ['clipId'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -95,15 +95,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
// Check if the circular reference will occur
|
// Check if the circular reference will occur
|
||||||
const checkCircle = async (folderId: string): Promise<boolean> => {
|
const checkCircle = async (folderId: string): Promise<boolean> => {
|
||||||
// Fetch folder
|
const folder2 = await this.driveFoldersRepository.findOneByOrFail({
|
||||||
const folder2 = await this.driveFoldersRepository.findOneBy({
|
|
||||||
id: folderId,
|
id: folderId,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (folder2!.id === folder!.id) {
|
if (folder2.id === folder.id) {
|
||||||
return true;
|
return true;
|
||||||
} else if (folder2!.parentId) {
|
} else if (folder2.parentId) {
|
||||||
return await checkCircle(folder2!.parentId);
|
return await checkCircle(folder2.parentId);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js';
|
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['gallery'],
|
tags: ['gallery'],
|
||||||
|
@ -70,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
id: fileId,
|
id: fileId,
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
}),
|
}),
|
||||||
))).filter(isNotNull);
|
))).filter(x => x != null);
|
||||||
|
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
|
|
|
@ -10,7 +10,6 @@ import type { DriveFilesRepository, GalleryPostsRepository } from '@/models/_.js
|
||||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js';
|
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['gallery'],
|
tags: ['gallery'],
|
||||||
|
@ -48,7 +47,7 @@ export const paramDef = {
|
||||||
} },
|
} },
|
||||||
isSensitive: { type: 'boolean', default: false },
|
isSensitive: { type: 'boolean', default: false },
|
||||||
},
|
},
|
||||||
required: ['postId', 'title', 'fileIds'],
|
required: ['postId'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -63,16 +62,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
private galleryPostEntityService: GalleryPostEntityService,
|
private galleryPostEntityService: GalleryPostEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const files = (await Promise.all(ps.fileIds.map(fileId =>
|
let files: Array<MiDriveFile> | undefined;
|
||||||
|
|
||||||
|
if (ps.fileIds) {
|
||||||
|
files = (await Promise.all(ps.fileIds.map(fileId =>
|
||||||
this.driveFilesRepository.findOneBy({
|
this.driveFilesRepository.findOneBy({
|
||||||
id: fileId,
|
id: fileId,
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
}),
|
}),
|
||||||
))).filter(isNotNull);
|
))).filter(x => x != null);
|
||||||
|
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await this.galleryPostsRepository.update({
|
await this.galleryPostsRepository.update({
|
||||||
id: ps.postId,
|
id: ps.postId,
|
||||||
|
@ -82,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
title: ps.title,
|
title: ps.title,
|
||||||
description: ps.description,
|
description: ps.description,
|
||||||
isSensitive: ps.isSensitive,
|
isSensitive: ps.isSensitive,
|
||||||
fileIds: files.map(file => file.id),
|
fileIds: files ? files.map(file => file.id) : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const post = await this.galleryPostsRepository.findOneByOrFail({ id: ps.postId });
|
const post = await this.galleryPostsRepository.findOneByOrFail({ id: ps.postId });
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
if (file.size === 0) throw new ApiError(meta.errors.emptyFile);
|
if (file.size === 0) throw new ApiError(meta.errors.emptyFile);
|
||||||
const antennas: (_Antenna & { userListAccts: string[] | null })[] = JSON.parse(await this.downloadService.downloadTextFile(file.url));
|
const antennas: (_Antenna & { userListAccts: string[] | null })[] = JSON.parse(await this.downloadService.downloadTextFile(file.url));
|
||||||
const currentAntennasCount = await this.antennasRepository.countBy({ userId: me.id });
|
const currentAntennasCount = await this.antennasRepository.countBy({ userId: me.id });
|
||||||
if (currentAntennasCount + antennas.length > (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
if (currentAntennasCount + antennas.length >= (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyAntennas);
|
throw new ApiError(meta.errors.tooManyAntennas);
|
||||||
}
|
}
|
||||||
this.queueService.createImportAntennasJob(me, antennas);
|
this.queueService.createImportAntennasJob(me, antennas);
|
||||||
|
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentWebhooksCount = await this.webhooksRepository.countBy({
|
const currentWebhooksCount = await this.webhooksRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentWebhooksCount > (await this.roleService.getUserPolicies(me.id)).webhookLimit) {
|
if (currentWebhooksCount >= (await this.roleService.getUserPolicies(me.id)).webhookLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyWebhooks);
|
throw new ApiError(meta.errors.tooManyWebhooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,13 @@ export const paramDef = {
|
||||||
webhookId: { type: 'string', format: 'misskey:id' },
|
webhookId: { type: 'string', format: 'misskey:id' },
|
||||||
name: { type: 'string', minLength: 1, maxLength: 100 },
|
name: { type: 'string', minLength: 1, maxLength: 100 },
|
||||||
url: { type: 'string', minLength: 1, maxLength: 1024 },
|
url: { type: 'string', minLength: 1, maxLength: 1024 },
|
||||||
secret: { type: 'string', maxLength: 1024, default: '' },
|
secret: { type: 'string', nullable: true, maxLength: 1024 },
|
||||||
on: { type: 'array', items: {
|
on: { type: 'array', items: {
|
||||||
type: 'string', enum: webhookEventTypes,
|
type: 'string', enum: webhookEventTypes,
|
||||||
} },
|
} },
|
||||||
active: { type: 'boolean' },
|
active: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['webhookId', 'name', 'url', 'on', 'active'],
|
required: ['webhookId'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// TODO: ロジックをサービスに切り出す
|
// TODO: ロジックをサービスに切り出す
|
||||||
|
@ -66,7 +66,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
await this.webhooksRepository.update(webhook.id, {
|
await this.webhooksRepository.update(webhook.id, {
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
url: ps.url,
|
url: ps.url,
|
||||||
secret: ps.secret,
|
secret: ps.secret === null ? '' : ps.secret,
|
||||||
on: ps.on,
|
on: ps.on,
|
||||||
active: ps.active,
|
active: ps.active,
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,7 +70,7 @@ export const paramDef = {
|
||||||
alignCenter: { type: 'boolean' },
|
alignCenter: { type: 'boolean' },
|
||||||
hideTitleWhenPinned: { type: 'boolean' },
|
hideTitleWhenPinned: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['pageId', 'title', 'name', 'content', 'variables', 'script'],
|
required: ['pageId'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -91,9 +91,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.accessDenied);
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
}
|
}
|
||||||
|
|
||||||
let eyeCatchingImage = null;
|
|
||||||
if (ps.eyeCatchingImageId != null) {
|
if (ps.eyeCatchingImageId != null) {
|
||||||
eyeCatchingImage = await this.driveFilesRepository.findOneBy({
|
const eyeCatchingImage = await this.driveFilesRepository.findOneBy({
|
||||||
id: ps.eyeCatchingImageId,
|
id: ps.eyeCatchingImageId,
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
|
@ -116,23 +115,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
await this.pagesRepository.update(page.id, {
|
await this.pagesRepository.update(page.id, {
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
title: ps.title,
|
title: ps.title,
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
name: ps.name,
|
||||||
name: ps.name === undefined ? page.name : ps.name,
|
|
||||||
summary: ps.summary === undefined ? page.summary : ps.summary,
|
summary: ps.summary === undefined ? page.summary : ps.summary,
|
||||||
content: ps.content,
|
content: ps.content,
|
||||||
variables: ps.variables,
|
variables: ps.variables,
|
||||||
script: ps.script,
|
script: ps.script,
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
alignCenter: ps.alignCenter,
|
||||||
alignCenter: ps.alignCenter === undefined ? page.alignCenter : ps.alignCenter,
|
hideTitleWhenPinned: ps.hideTitleWhenPinned,
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
font: ps.font,
|
||||||
hideTitleWhenPinned: ps.hideTitleWhenPinned === undefined ? page.hideTitleWhenPinned : ps.hideTitleWhenPinned,
|
eyeCatchingImageId: ps.eyeCatchingImageId,
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
||||||
font: ps.font === undefined ? page.font : ps.font,
|
|
||||||
eyeCatchingImageId: ps.eyeCatchingImageId === null
|
|
||||||
? null
|
|
||||||
: ps.eyeCatchingImageId === undefined
|
|
||||||
? page.eyeCatchingImageId
|
|
||||||
: eyeCatchingImage!.id,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['users'],
|
tags: ['users'],
|
||||||
|
@ -53,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(isNotNull), me, { schema: 'UserDetailed' });
|
return await this.userEntityService.packMany(users.filter(x => x != null), me, { schema: 'UserDetailed' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentCount = await this.userListsRepository.countBy({
|
const currentCount = await this.userListsRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyUserLists);
|
throw new ApiError(meta.errors.tooManyUserLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentCount = await this.userListsRepository.countBy({
|
const currentCount = await this.userListsRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyUserLists);
|
throw new ApiError(meta.errors.tooManyUserLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
|
import { MfmService } from "@/core/MfmService.js";
|
||||||
|
import { parse as mfmParse } from 'mfm-js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FeedService {
|
export class FeedService {
|
||||||
|
@ -33,6 +35,7 @@ export class FeedService {
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private driveFileEntityService: DriveFileEntityService,
|
private driveFileEntityService: DriveFileEntityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
|
private mfmService: MfmService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,13 +79,14 @@ export class FeedService {
|
||||||
id: In(note.fileIds),
|
id: In(note.fileIds),
|
||||||
}) : [];
|
}) : [];
|
||||||
const file = files.find(file => file.type.startsWith('image/'));
|
const file = files.find(file => file.type.startsWith('image/'));
|
||||||
|
const text = note.text;
|
||||||
|
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
title: `New note by ${author.name}`,
|
title: `New note by ${author.name}`,
|
||||||
link: `${this.config.url}/notes/${note.id}`,
|
link: `${this.config.url}/notes/${note.id}`,
|
||||||
date: this.idService.parse(note.id).date,
|
date: this.idService.parse(note.id).date,
|
||||||
description: note.cw ?? undefined,
|
description: note.cw ?? undefined,
|
||||||
content: note.text ?? undefined,
|
content: text ? this.mfmService.toHtml(mfmParse(text), JSON.parse(note.mentionedRemoteUsers)) ?? undefined : undefined,
|
||||||
image: file ? this.driveFileEntityService.getPublicUrl(file) : undefined,
|
image: file ? this.driveFileEntityService.getPublicUrl(file) : undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,7 @@ describe('アンテナ', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('が上限いっぱいまで作成できること', async () => {
|
test('が上限いっぱいまで作成できること', async () => {
|
||||||
// antennaLimit + 1まで作れるのがキモ
|
const response = await Promise.all([...Array(DEFAULT_POLICIES.antennaLimit)].map(() => successfulApiCall({
|
||||||
const response = await Promise.all([...Array(DEFAULT_POLICIES.antennaLimit + 1)].map(() => successfulApiCall({
|
|
||||||
endpoint: 'antennas/create',
|
endpoint: 'antennas/create',
|
||||||
parameters: { ...defaultParam },
|
parameters: { ...defaultParam },
|
||||||
user: alice,
|
user: alice,
|
||||||
|
|
|
@ -153,8 +153,7 @@ describe('クリップ', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('の作成はポリシーで定められた数以上はできない。', async () => {
|
test('の作成はポリシーで定められた数以上はできない。', async () => {
|
||||||
// ポリシー + 1まで作れるという所がミソ
|
const clipLimit = DEFAULT_POLICIES.clipLimit;
|
||||||
const clipLimit = DEFAULT_POLICIES.clipLimit + 1;
|
|
||||||
for (let i = 0; i < clipLimit; i++) {
|
for (let i = 0; i < clipLimit; i++) {
|
||||||
await create();
|
await create();
|
||||||
}
|
}
|
||||||
|
@ -327,7 +326,7 @@ describe('クリップ', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('の一覧(clips/list)が取得できる(上限いっぱい)', async () => {
|
test('の一覧(clips/list)が取得できる(上限いっぱい)', async () => {
|
||||||
const clipLimit = DEFAULT_POLICIES.clipLimit + 1;
|
const clipLimit = DEFAULT_POLICIES.clipLimit;
|
||||||
const clips = await createMany({}, clipLimit);
|
const clips = await createMany({}, clipLimit);
|
||||||
const res = await list({
|
const res = await list({
|
||||||
parameters: { limit: 1 }, // FIXME: 無視されて11全部返ってくる
|
parameters: { limit: 1 }, // FIXME: 無視されて11全部返ってくる
|
||||||
|
@ -705,7 +704,7 @@ describe('クリップ', () => {
|
||||||
|
|
||||||
// TODO: 17000msくらいかかる...
|
// TODO: 17000msくらいかかる...
|
||||||
test('をポリシーで定められた上限いっぱい(200)を超えて追加はできない。', async () => {
|
test('をポリシーで定められた上限いっぱい(200)を超えて追加はできない。', async () => {
|
||||||
const noteLimit = DEFAULT_POLICIES.noteEachClipsLimit + 1;
|
const noteLimit = DEFAULT_POLICIES.noteEachClipsLimit;
|
||||||
const noteList = await Promise.all([...Array(noteLimit)].map((_, i) => post(alice, {
|
const noteList = await Promise.all([...Array(noteLimit)].map((_, i) => post(alice, {
|
||||||
text: `test ${i}`,
|
text: `test ${i}`,
|
||||||
}) as unknown)) as Misskey.entities.Note[];
|
}) as unknown)) as Misskey.entities.Note[];
|
||||||
|
|
|
@ -153,6 +153,23 @@ describe('Webリソース', () => {
|
||||||
path: path('nonexisting'),
|
path: path('nonexisting'),
|
||||||
status: 404,
|
status: 404,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe(' has entry such ', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
post(alice, { text: "**a**" })
|
||||||
|
});
|
||||||
|
|
||||||
|
test('MFMを含まない。', async () => {
|
||||||
|
const content = await simpleGet(path(alice.username), "*/*", undefined, res => res.text());
|
||||||
|
const _body: unknown = content.body;
|
||||||
|
// JSONフィードのときは改めて文字列化する
|
||||||
|
const body: string = typeof (_body) === "object" ? JSON.stringify(_body) : _body as string;
|
||||||
|
|
||||||
|
if (body.includes("**a**")) {
|
||||||
|
throw new Error("MFM shouldn't be included");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.each([{ path: '/api/foo' }])('$path', ({ path }) => {
|
describe.each([{ path: '/api/foo' }])('$path', ({ path }) => {
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
// pnpm jest -- e2e/timelines.ts
|
// pnpm jest -- e2e/timelines.ts
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
import { Redis } from 'ioredis';
|
||||||
|
import { loadConfig } from '@/config.js';
|
||||||
import { api, post, randomString, sendEnvUpdateRequest, signup, sleep, uploadUrl } from '../utils.js';
|
import { api, post, randomString, sendEnvUpdateRequest, signup, sleep, uploadUrl } from '../utils.js';
|
||||||
|
|
||||||
function genHost() {
|
function genHost() {
|
||||||
|
@ -17,7 +19,13 @@ function waitForPushToTl() {
|
||||||
return sleep(500);
|
return sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let redisForTimelines: Redis;
|
||||||
|
|
||||||
describe('Timelines', () => {
|
describe('Timelines', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
redisForTimelines = new Redis(loadConfig().redisForTimelines);
|
||||||
|
});
|
||||||
|
|
||||||
describe('Home TL', () => {
|
describe('Home TL', () => {
|
||||||
test.concurrent('自分の visibility: followers なノートが含まれる', async () => {
|
test.concurrent('自分の visibility: followers なノートが含まれる', async () => {
|
||||||
const [alice] = await Promise.all([signup()]);
|
const [alice] = await Promise.all([signup()]);
|
||||||
|
@ -1272,6 +1280,33 @@ describe('Timelines', () => {
|
||||||
|
|
||||||
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), false);
|
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** @see https://github.com/misskey-dev/misskey/issues/14000 */
|
||||||
|
test.concurrent('FTT: sinceId にキャッシュより古いノートを指定しても、sinceId による絞り込みが正しく動作する', async () => {
|
||||||
|
const alice = await signup();
|
||||||
|
const noteSince = await post(alice, { text: 'Note where id will be `sinceId`.' });
|
||||||
|
const note1 = await post(alice, { text: '1' });
|
||||||
|
const note2 = await post(alice, { text: '2' });
|
||||||
|
await redisForTimelines.del('list:userTimeline:' + alice.id);
|
||||||
|
const note3 = await post(alice, { text: '3' });
|
||||||
|
|
||||||
|
const res = await api('users/notes', { userId: alice.id, sinceId: noteSince.id });
|
||||||
|
assert.deepStrictEqual(res.body, [note1, note2, note3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.concurrent('FTT: sinceId にキャッシュより古いノートを指定しても、sinceId と untilId による絞り込みが正しく動作する', async () => {
|
||||||
|
const alice = await signup();
|
||||||
|
const noteSince = await post(alice, { text: 'Note where id will be `sinceId`.' });
|
||||||
|
const note1 = await post(alice, { text: '1' });
|
||||||
|
const note2 = await post(alice, { text: '2' });
|
||||||
|
await redisForTimelines.del('list:userTimeline:' + alice.id);
|
||||||
|
const note3 = await post(alice, { text: '3' });
|
||||||
|
const noteUntil = await post(alice, { text: 'Note where id will be `untilId`.' });
|
||||||
|
await post(alice, { text: '4' });
|
||||||
|
|
||||||
|
const res = await api('users/notes', { userId: alice.id, sinceId: noteSince.id, untilId: noteUntil.id });
|
||||||
|
assert.deepStrictEqual(res.body, [note3, note2, note1]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: リノートミュート済みユーザーのテスト
|
// TODO: リノートミュート済みユーザーのテスト
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
import * as assert from 'assert';
|
|
||||||
import { just, nothing } from '../../src/misc/prelude/maybe.js';
|
|
||||||
|
|
||||||
describe('just', () => {
|
|
||||||
test('has a value', () => {
|
|
||||||
assert.deepStrictEqual(just(3).isJust(), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('has the inverse called get', () => {
|
|
||||||
assert.deepStrictEqual(just(3).get(), 3);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('nothing', () => {
|
|
||||||
test('has no value', () => {
|
|
||||||
assert.deepStrictEqual(nothing().isJust(), false);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -17,6 +17,7 @@ import { validateContentTypeSetAsActivityPub } from '@/core/activitypub/misc/val
|
||||||
import { entities } from '../src/postgres.js';
|
import { entities } from '../src/postgres.js';
|
||||||
import { loadConfig } from '../src/config.js';
|
import { loadConfig } from '../src/config.js';
|
||||||
import type * as misskey from 'misskey-js';
|
import type * as misskey from 'misskey-js';
|
||||||
|
import { type Response } from 'node-fetch';
|
||||||
|
|
||||||
export { server as startServer, jobQueue as startJobQueue } from '@/boot/common.js';
|
export { server as startServer, jobQueue as startJobQueue } from '@/boot/common.js';
|
||||||
|
|
||||||
|
@ -454,7 +455,7 @@ export type SimpleGetResponse = {
|
||||||
type: string | null,
|
type: string | null,
|
||||||
location: string | null
|
location: string | null
|
||||||
};
|
};
|
||||||
export const simpleGet = async (path: string, accept = '*/*', cookie: any = undefined): Promise<SimpleGetResponse> => {
|
export const simpleGet = async (path: string, accept = '*/*', cookie: any = undefined, bodyExtractor: (res: Response) => Promise<string | null> = _ => Promise.resolve(null)): Promise<SimpleGetResponse> => {
|
||||||
const res = await relativeFetch(path, {
|
const res = await relativeFetch(path, {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: accept,
|
Accept: accept,
|
||||||
|
@ -482,7 +483,7 @@ export const simpleGet = async (path: string, accept = '*/*', cookie: any = unde
|
||||||
const body =
|
const body =
|
||||||
jsonTypes.includes(res.headers.get('content-type') ?? '') ? await res.json() :
|
jsonTypes.includes(res.headers.get('content-type') ?? '') ? await res.json() :
|
||||||
htmlTypes.includes(res.headers.get('content-type') ?? '') ? new JSDOM(await res.text()) :
|
htmlTypes.includes(res.headers.get('content-type') ?? '') ? new JSDOM(await res.text()) :
|
||||||
null;
|
await bodyExtractor(res);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: res.status,
|
status: res.status,
|
||||||
|
|
|
@ -56,7 +56,7 @@ module.exports = {
|
||||||
'vue/no-dupe-keys': 'warn',
|
'vue/no-dupe-keys': 'warn',
|
||||||
'vue/valid-v-for': 'warn',
|
'vue/valid-v-for': 'warn',
|
||||||
'vue/return-in-computed-property': 'warn',
|
'vue/return-in-computed-property': 'warn',
|
||||||
'vue/no-setup-props-destructure': 'warn',
|
'vue/no-setup-props-reactivity-loss': 'warn',
|
||||||
'vue/max-attributes-per-line': 'off',
|
'vue/max-attributes-per-line': 'off',
|
||||||
'vue/html-self-closing': 'off',
|
'vue/html-self-closing': 'off',
|
||||||
'vue/singleline-html-element-content-newline': 'off',
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { DefaultBodyType, HttpResponse, HttpResponseResolver, JsonBodyType, PathParams, http } from 'msw';
|
||||||
|
import seedrandom from 'seedrandom';
|
||||||
|
import { action } from '@storybook/addon-actions';
|
||||||
|
|
||||||
|
function getChartArray(seed: string, limit: number, option?: { accumulate?: boolean, mul?: number }): number[] {
|
||||||
|
const rng = seedrandom(seed);
|
||||||
|
const max = Math.floor(option?.mul ?? 250 * rng());
|
||||||
|
let accumulation = 0;
|
||||||
|
const array: number[] = [];
|
||||||
|
for (let i = 0; i < limit; i++) {
|
||||||
|
const num = Math.floor((max + 1) * rng());
|
||||||
|
if (option?.accumulate) {
|
||||||
|
accumulation += num;
|
||||||
|
array.unshift(accumulation);
|
||||||
|
} else {
|
||||||
|
array.push(num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getChartResolver(fields: string[], option?: { accumulate?: boolean, mulMap?: Record<string, number> }): HttpResponseResolver<PathParams, DefaultBodyType, JsonBodyType> {
|
||||||
|
return ({ request }) => {
|
||||||
|
action(`GET ${request.url}`)();
|
||||||
|
const limitParam = new URL(request.url).searchParams.get('limit');
|
||||||
|
const limit = limitParam ? parseInt(limitParam) : 30;
|
||||||
|
const res = {};
|
||||||
|
for (const field of fields) {
|
||||||
|
const layers = field.split('.');
|
||||||
|
let current = res;
|
||||||
|
while (layers.length > 1) {
|
||||||
|
const currentKey = layers.shift()!;
|
||||||
|
if (current[currentKey] == null) current[currentKey] = {};
|
||||||
|
current = current[currentKey];
|
||||||
|
}
|
||||||
|
current[layers[0]] = getChartArray(field, limit, {
|
||||||
|
accumulate: option?.accumulate,
|
||||||
|
mul: option?.mulMap != null && field in option.mulMap ? option.mulMap[field] : undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return HttpResponse.json(res);
|
||||||
|
};
|
||||||
|
}
|
|
@ -125,6 +125,35 @@ export function file(isSensitive = false) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function federationInstance(): entities.FederationInstance {
|
||||||
|
return {
|
||||||
|
id: 'someinstanceid',
|
||||||
|
firstRetrievedAt: '2021-01-01T00:00:00.000Z',
|
||||||
|
host: 'misskey-hub.net',
|
||||||
|
usersCount: 10,
|
||||||
|
notesCount: 20,
|
||||||
|
followingCount: 5,
|
||||||
|
followersCount: 15,
|
||||||
|
isNotResponding: false,
|
||||||
|
isSuspended: false,
|
||||||
|
suspensionState: 'none',
|
||||||
|
isBlocked: false,
|
||||||
|
softwareName: 'misskey',
|
||||||
|
softwareVersion: '2024.5.0',
|
||||||
|
openRegistrations: false,
|
||||||
|
name: 'Misskey Hub',
|
||||||
|
description: '',
|
||||||
|
maintainerName: '',
|
||||||
|
maintainerEmail: '',
|
||||||
|
isSilenced: false,
|
||||||
|
iconUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
|
||||||
|
faviconUrl: '',
|
||||||
|
themeColor: '',
|
||||||
|
infoUpdatedAt: '',
|
||||||
|
latestRequestReceivedAt: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function userDetailed(id = 'someuserid', username = 'miskist', host = 'misskey-hub.net', name = 'Misskey User'): entities.UserDetailed {
|
export function userDetailed(id = 'someuserid', username = 'miskist', host = 'misskey-hub.net', name = 'Misskey User'): entities.UserDetailed {
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -403,6 +403,7 @@ function toStories(component: string): Promise<string> {
|
||||||
glob('src/components/MkSignupServerRules.vue'),
|
glob('src/components/MkSignupServerRules.vue'),
|
||||||
glob('src/components/MkUserSetupDialog.vue'),
|
glob('src/components/MkUserSetupDialog.vue'),
|
||||||
glob('src/components/MkUserSetupDialog.*.vue'),
|
glob('src/components/MkUserSetupDialog.*.vue'),
|
||||||
|
glob('src/components/MkInstanceCardMini.vue'),
|
||||||
glob('src/components/MkInviteCode.vue'),
|
glob('src/components/MkInviteCode.vue'),
|
||||||
glob('src/pages/user/home.vue'),
|
glob('src/pages/user/home.vue'),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
"tinycolor2": "1.6.0",
|
"tinycolor2": "1.6.0",
|
||||||
"tsc-alias": "1.8.8",
|
"tsc-alias": "1.8.8",
|
||||||
"tsconfig-paths": "4.2.0",
|
"tsconfig-paths": "4.2.0",
|
||||||
"typescript": "5.4.5",
|
"typescript": "5.5.2",
|
||||||
"uuid": "9.0.1",
|
"uuid": "9.0.1",
|
||||||
"v-code-diff": "1.11.0",
|
"v-code-diff": "1.11.0",
|
||||||
"vite": "5.2.11",
|
"vite": "5.2.11",
|
||||||
|
|
|
@ -120,7 +120,7 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
|
||||||
res.json().then(done2, fail2);
|
res.json().then(done2, fail2);
|
||||||
}))
|
}))
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
if (res.error) {
|
if ('error' in res) {
|
||||||
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
|
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
|
||||||
// SUSPENDED
|
// SUSPENDED
|
||||||
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
|
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
|
||||||
|
|
|
@ -6,52 +6,11 @@
|
||||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
/* eslint-disable import/no-default-export */
|
/* eslint-disable import/no-default-export */
|
||||||
import { StoryObj } from '@storybook/vue3';
|
import { StoryObj } from '@storybook/vue3';
|
||||||
import { DefaultBodyType, HttpResponse, HttpResponseResolver, JsonBodyType, PathParams, http } from 'msw';
|
import { http } from 'msw';
|
||||||
import seedrandom from 'seedrandom';
|
|
||||||
import { action } from '@storybook/addon-actions';
|
|
||||||
import { commonHandlers } from '../../.storybook/mocks.js';
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||||
|
import { getChartResolver } from '../../.storybook/charts.js';
|
||||||
import MkChart from './MkChart.vue';
|
import MkChart from './MkChart.vue';
|
||||||
|
|
||||||
function getChartArray(seed: string, limit: number, option?: { accumulate?: boolean, mul?: number }): number[] {
|
|
||||||
const rng = seedrandom(seed);
|
|
||||||
const max = Math.floor(option?.mul ?? 250 * rng());
|
|
||||||
let accumulation = 0;
|
|
||||||
const array: number[] = [];
|
|
||||||
for (let i = 0; i < limit; i++) {
|
|
||||||
const num = Math.floor((max + 1) * rng());
|
|
||||||
if (option?.accumulate) {
|
|
||||||
accumulation += num;
|
|
||||||
array.unshift(accumulation);
|
|
||||||
} else {
|
|
||||||
array.push(num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getChartResolver(fields: string[], option?: { accumulate?: boolean, mulMap?: Record<string, number> }): HttpResponseResolver<PathParams, DefaultBodyType, JsonBodyType> {
|
|
||||||
return ({ request }) => {
|
|
||||||
action(`GET ${request.url}`)();
|
|
||||||
const limitParam = new URL(request.url).searchParams.get('limit');
|
|
||||||
const limit = limitParam ? parseInt(limitParam) : 30;
|
|
||||||
const res = {};
|
|
||||||
for (const field of fields) {
|
|
||||||
const layers = field.split('.');
|
|
||||||
let current = res;
|
|
||||||
while (layers.length > 1) {
|
|
||||||
const currentKey = layers.shift()!;
|
|
||||||
if (current[currentKey] == null) current[currentKey] = {};
|
|
||||||
current = current[currentKey];
|
|
||||||
}
|
|
||||||
current[layers[0]] = getChartArray(field, limit, {
|
|
||||||
accumulate: option?.accumulate,
|
|
||||||
mul: option?.mulMap != null && field in option.mulMap ? option.mulMap[field] : undefined,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return HttpResponse.json(res);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const Base = {
|
const Base = {
|
||||||
render(args) {
|
render(args) {
|
||||||
return {
|
return {
|
||||||
|
@ -76,6 +35,7 @@ const Base = {
|
||||||
args: {
|
args: {
|
||||||
src: 'federation',
|
src: 'federation',
|
||||||
span: 'hour',
|
span: 'hour',
|
||||||
|
nowForChromatic: 1716263640000,
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
|
@ -100,18 +60,21 @@ const Base = {
|
||||||
export const FederationChart = {
|
export const FederationChart = {
|
||||||
...Base,
|
...Base,
|
||||||
args: {
|
args: {
|
||||||
|
...Base.args,
|
||||||
src: 'federation',
|
src: 'federation',
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkChart>;
|
} satisfies StoryObj<typeof MkChart>;
|
||||||
export const NotesTotalChart = {
|
export const NotesTotalChart = {
|
||||||
...Base,
|
...Base,
|
||||||
args: {
|
args: {
|
||||||
|
...Base.args,
|
||||||
src: 'notes-total',
|
src: 'notes-total',
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkChart>;
|
} satisfies StoryObj<typeof MkChart>;
|
||||||
export const DriveChart = {
|
export const DriveChart = {
|
||||||
...Base,
|
...Base,
|
||||||
args: {
|
args: {
|
||||||
|
...Base.args,
|
||||||
src: 'drive',
|
src: 'drive',
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkChart>;
|
} satisfies StoryObj<typeof MkChart>;
|
||||||
|
|
|
@ -77,6 +77,7 @@ const props = withDefaults(defineProps<{
|
||||||
stacked?: boolean;
|
stacked?: boolean;
|
||||||
bar?: boolean;
|
bar?: boolean;
|
||||||
aspectRatio?: number | null;
|
aspectRatio?: number | null;
|
||||||
|
nowForChromatic?: number;
|
||||||
}>(), {
|
}>(), {
|
||||||
args: undefined,
|
args: undefined,
|
||||||
limit: 90,
|
limit: 90,
|
||||||
|
@ -84,6 +85,13 @@ const props = withDefaults(defineProps<{
|
||||||
stacked: false,
|
stacked: false,
|
||||||
bar: false,
|
bar: false,
|
||||||
aspectRatio: null,
|
aspectRatio: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc Overwrites current date to fix background lines of chart.
|
||||||
|
* @ignore Only used for Chromatic. Don't use this for production.
|
||||||
|
* @see https://github.com/misskey-dev/misskey/pull/13830#issuecomment-2155886151
|
||||||
|
*/
|
||||||
|
nowForChromatic: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const legendEl = shallowRef<InstanceType<typeof MkChartLegend>>();
|
const legendEl = shallowRef<InstanceType<typeof MkChartLegend>>();
|
||||||
|
@ -106,7 +114,8 @@ const getColor = (i) => {
|
||||||
return colorSets[i % colorSets.length];
|
return colorSets[i % colorSets.length];
|
||||||
};
|
};
|
||||||
|
|
||||||
const now = new Date();
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
|
const now = props.nowForChromatic != null ? new Date(props.nowForChromatic) : new Date();
|
||||||
let chartInstance: Chart | null = null;
|
let chartInstance: Chart | null = null;
|
||||||
let chartData: {
|
let chartData: {
|
||||||
series: {
|
series: {
|
||||||
|
|
|
@ -130,7 +130,7 @@ export default defineComponent({
|
||||||
el.style.left = '';
|
el.style.left = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const classes = {
|
const classes = {
|
||||||
[$style['date-separated-list']]: true,
|
[$style['date-separated-list']]: true,
|
||||||
[$style['date-separated-list-nogap']]: props.noGap,
|
[$style['date-separated-list-nogap']]: props.noGap,
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
|
import { StoryObj } from '@storybook/vue3';
|
||||||
|
import { HttpResponse, http } from 'msw';
|
||||||
|
import { federationInstance } from '../../.storybook/fakes.js';
|
||||||
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||||
|
import { getChartResolver } from '../../.storybook/charts.js';
|
||||||
|
import MkInstanceCardMini from './MkInstanceCardMini.vue';
|
||||||
|
|
||||||
|
export const Default = {
|
||||||
|
render(args) {
|
||||||
|
return {
|
||||||
|
components: {
|
||||||
|
MkInstanceCardMini,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
args,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
props() {
|
||||||
|
return {
|
||||||
|
...this.args,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
template: '<MkInstanceCardMini v-bind="props" />',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
args: {
|
||||||
|
instance: federationInstance(),
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
layout: 'centered',
|
||||||
|
msw: {
|
||||||
|
handlers: [
|
||||||
|
...commonHandlers,
|
||||||
|
http.get('/undefined/preview.webp', async ({ request }) => {
|
||||||
|
const urlStr = new URL(request.url).searchParams.get('url');
|
||||||
|
if (urlStr == null) {
|
||||||
|
return new HttpResponse(null, { status: 404 });
|
||||||
|
}
|
||||||
|
const url = new URL(urlStr);
|
||||||
|
|
||||||
|
if (url.href.startsWith('https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/')) {
|
||||||
|
const image = await (await fetch(`client-assets/${url.pathname.split('/').pop()}`)).blob();
|
||||||
|
return new HttpResponse(image, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'image/jpeg',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return new HttpResponse(null, { status: 404 });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
http.get('/api/charts/instance', getChartResolver(['requests.received'])),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} satisfies StoryObj<typeof MkInstanceCardMini>;
|
|
@ -29,8 +29,8 @@ const chartValues = ref<number[] | null>(null);
|
||||||
|
|
||||||
misskeyApiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
|
misskeyApiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
|
||||||
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
||||||
res['requests.received'].splice(0, 1);
|
res.requests.received.splice(0, 1);
|
||||||
chartValues.value = res['requests.received'];
|
chartValues.value = res.requests.received;
|
||||||
});
|
});
|
||||||
|
|
||||||
function getInstanceIcon(instance): string {
|
function getInstanceIcon(instance): string {
|
||||||
|
|
|
@ -126,7 +126,7 @@ function hasFocus() {
|
||||||
const playerEl = shallowRef<HTMLDivElement>();
|
const playerEl = shallowRef<HTMLDivElement>();
|
||||||
const audioEl = shallowRef<HTMLAudioElement>();
|
const audioEl = shallowRef<HTMLAudioElement>();
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.audio.isSensitive && defaultStore.state.nsfw !== 'ignore'));
|
const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.audio.isSensitive && defaultStore.state.nsfw !== 'ignore'));
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
|
|
|
@ -160,7 +160,7 @@ function hasFocus() {
|
||||||
return playerEl.value === document.activeElement || playerEl.value.contains(document.activeElement);
|
return playerEl.value === document.activeElement || playerEl.value.contains(document.activeElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore'));
|
const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore'));
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
|
|
|
@ -6,14 +6,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template>
|
<template>
|
||||||
<div :class="$style.root">
|
<div :class="$style.root">
|
||||||
<div :class="$style.head">
|
<div :class="$style.head">
|
||||||
<MkAvatar v-if="['pollEnded', 'note'].includes(notification.type) && notification.note" :class="$style.icon" :user="notification.note.user" link preview/>
|
<MkAvatar v-if="['pollEnded', 'note'].includes(notification.type) && 'note' in notification" :class="$style.icon" :user="notification.note.user" link preview/>
|
||||||
<MkAvatar v-else-if="['roleAssigned', 'achievementEarned'].includes(notification.type)" :class="$style.icon" :user="$i" link preview/>
|
<MkAvatar v-else-if="['roleAssigned', 'achievementEarned'].includes(notification.type)" :class="$style.icon" :user="$i" link preview/>
|
||||||
<div v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'" :class="[$style.icon, $style.icon_reactionGroupHeart]"><i class="ti ti-heart" style="line-height: 1;"></i></div>
|
<div v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'" :class="[$style.icon, $style.icon_reactionGroupHeart]"><i class="ti ti-heart" style="line-height: 1;"></i></div>
|
||||||
<div v-else-if="notification.type === 'reaction:grouped'" :class="[$style.icon, $style.icon_reactionGroup]"><i class="ti ti-plus" style="line-height: 1;"></i></div>
|
<div v-else-if="notification.type === 'reaction:grouped'" :class="[$style.icon, $style.icon_reactionGroup]"><i class="ti ti-plus" style="line-height: 1;"></i></div>
|
||||||
<div v-else-if="notification.type === 'renote:grouped'" :class="[$style.icon, $style.icon_renoteGroup]"><i class="ti ti-repeat" style="line-height: 1;"></i></div>
|
<div v-else-if="notification.type === 'renote:grouped'" :class="[$style.icon, $style.icon_renoteGroup]"><i class="ti ti-repeat" style="line-height: 1;"></i></div>
|
||||||
<img v-else-if="notification.type === 'test'" :class="$style.icon" :src="infoImageUrl"/>
|
<img v-else-if="notification.type === 'test'" :class="$style.icon" :src="infoImageUrl"/>
|
||||||
<MkAvatar v-else-if="notification.user" :class="$style.icon" :user="notification.user" link preview/>
|
<MkAvatar v-else-if="'user' in notification" :class="$style.icon" :user="notification.user" link preview/>
|
||||||
<img v-else-if="notification.icon" :class="[$style.icon, $style.icon_app]" :src="notification.icon" alt=""/>
|
<img v-else-if="'icon' in notification" :class="[$style.icon, $style.icon_app]" :src="notification.icon" alt=""/>
|
||||||
<div
|
<div
|
||||||
:class="[$style.subIcon, {
|
:class="[$style.subIcon, {
|
||||||
[$style.t_follow]: notification.type === 'follow',
|
[$style.t_follow]: notification.type === 'follow',
|
||||||
|
@ -164,13 +164,13 @@ const props = withDefaults(defineProps<{
|
||||||
const followRequestDone = ref(false);
|
const followRequestDone = ref(false);
|
||||||
|
|
||||||
const acceptFollowRequest = () => {
|
const acceptFollowRequest = () => {
|
||||||
if (props.notification.user == null) return;
|
if (!('user' in props.notification)) return;
|
||||||
followRequestDone.value = true;
|
followRequestDone.value = true;
|
||||||
misskeyApi('following/requests/accept', { userId: props.notification.user.id });
|
misskeyApi('following/requests/accept', { userId: props.notification.user.id });
|
||||||
};
|
};
|
||||||
|
|
||||||
const rejectFollowRequest = () => {
|
const rejectFollowRequest = () => {
|
||||||
if (props.notification.user == null) return;
|
if (!('user' in props.notification)) return;
|
||||||
followRequestDone.value = true;
|
followRequestDone.value = true;
|
||||||
misskeyApi('following/requests/reject', { userId: props.notification.user.id });
|
misskeyApi('following/requests/reject', { userId: props.notification.user.id });
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,7 +172,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const page = ref(props.initialPage ?? 0);
|
const page = ref(props.initialPage ?? 0);
|
||||||
|
|
||||||
watch(page, (to) => {
|
watch(page, (to) => {
|
||||||
|
|
|
@ -148,7 +148,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const page = ref(defaultStore.state.accountSetupWizard);
|
const page = ref(defaultStore.state.accountSetupWizard);
|
||||||
|
|
||||||
watch(page, () => {
|
watch(page, () => {
|
||||||
|
|
|
@ -41,12 +41,12 @@ function getDateSafe(n: Date | string | number) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const _time = props.time == null ? NaN : getDateSafe(props.time).getTime();
|
const _time = props.time == null ? NaN : getDateSafe(props.time).getTime();
|
||||||
const invalid = Number.isNaN(_time);
|
const invalid = Number.isNaN(_time);
|
||||||
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
|
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const now = ref(props.origin?.getTime() ?? Date.now());
|
const now = ref(props.origin?.getTime() ?? Date.now());
|
||||||
const ago = computed(() => (now.value - _time) / 1000/*ms*/);
|
const ago = computed(() => (now.value - _time) / 1000/*ms*/);
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,15 @@ definePageMetadata(() => ({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
.fadeEnterActive,
|
||||||
|
.fadeLeaveActive {
|
||||||
|
transition: opacity 0.125s ease;
|
||||||
|
}
|
||||||
|
.fadeEnterFrom,
|
||||||
|
.fadeLeaveTo {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.announcement {
|
.announcement {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ const props = defineProps<{
|
||||||
const showBoardLabels = ref<boolean>(false);
|
const showBoardLabels = ref<boolean>(false);
|
||||||
const useAvatarAsStone = ref<boolean>(true);
|
const useAvatarAsStone = ref<boolean>(true);
|
||||||
const autoplaying = ref<boolean>(false);
|
const autoplaying = ref<boolean>(false);
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||||
const game = ref<Misskey.entities.ReversiGameDetailed & { logs: Reversi.Serializer.SerializedLog[] }>(deepClone(props.game));
|
const game = ref<Misskey.entities.ReversiGameDetailed & { logs: Reversi.Serializer.SerializedLog[] }>(deepClone(props.game));
|
||||||
const logPos = ref<number>(game.value.logs.length);
|
const logPos = ref<number>(game.value.logs.length);
|
||||||
const engine = shallowRef<Reversi.Game>(Reversi.Serializer.restoreGame({
|
const engine = shallowRef<Reversi.Game>(Reversi.Serializer.restoreGame({
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { useStream } from '@/stream.js';
|
||||||
import { signinRequired } from '@/account.js';
|
import { signinRequired } from '@/account.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
import { url } from '@/config.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { useInterval } from '@/scripts/use-interval.js';
|
import { useInterval } from '@/scripts/use-interval.js';
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ function start(_game: Misskey.entities.ReversiGameDetailed) {
|
||||||
|
|
||||||
if (shareWhenStart.value) {
|
if (shareWhenStart.value) {
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
text: i18n.ts._reversi.iStartedAGame + '\n' + location.href,
|
text: `${i18n.ts._reversi.iStartedAGame}\n${url}/reversi/g/${props.gameId}`,
|
||||||
visibility: 'home',
|
visibility: 'home',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="user.fields.length > 0" class="fields">
|
<div v-if="user.fields.length > 0" class="fields">
|
||||||
<dl v-for="(field, i) in user.fields" :key="i" class="field">
|
<dl v-for="(field, i) in user.fields" :key="i" class="field">
|
||||||
<dt class="name">
|
<dt class="name">
|
||||||
<Mfm :text="field.name" :plain="true" :colored="false"/>
|
<Mfm :text="field.name" :author="user" :plain="true" :colored="false"/>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="value">
|
<dd class="value">
|
||||||
<Mfm :text="field.value" :author="user" :colored="false"/>
|
<Mfm :text="field.value" :author="user" :colored="false"/>
|
||||||
|
@ -392,11 +392,12 @@ onUnmounted(() => {
|
||||||
|
|
||||||
> .name {
|
> .name {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0;
|
margin: -10px;
|
||||||
|
padding: 10px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.8em;
|
font-size: 1.8em;
|
||||||
text-shadow: 0 0 8px #000;
|
filter: drop-shadow(0 0 4px #000);
|
||||||
}
|
}
|
||||||
|
|
||||||
> .bottom {
|
> .bottom {
|
||||||
|
|
|
@ -81,16 +81,19 @@ defineExpose<WidgetComponentExpose>({
|
||||||
.body {
|
.body {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
|
margin-left: -10px;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
filter: drop-shadow(0 0 4px #000);
|
filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 0.1px rgba(0, 0, 0, 0.5));
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.host {
|
.host {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
filter: drop-shadow(0 0 4px #000);
|
filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 0.1px rgba(0, 0, 0, 0.5));
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -82,16 +82,19 @@ defineExpose<WidgetComponentExpose>({
|
||||||
.body {
|
.body {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
|
margin-left: -10px;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
filter: drop-shadow(0 0 4px #000);
|
filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 0.1px rgba(0, 0, 0, 0.5));
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
filter: drop-shadow(0 0 4px #000);
|
filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 0.1px rgba(0, 0, 0, 0.5));
|
||||||
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"esnext",
|
"esnext",
|
||||||
"dom"
|
"dom",
|
||||||
|
"dom.iterable"
|
||||||
],
|
],
|
||||||
"jsx": "preserve"
|
"jsx": "preserve"
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { type UserConfig, defineConfig } from 'vite';
|
||||||
|
|
||||||
import locales from '../../locales/index.js';
|
import locales from '../../locales/index.js';
|
||||||
import meta from '../../package.json';
|
import meta from '../../package.json';
|
||||||
import packageInfo from './package.json' assert { type: 'json' };
|
import packageInfo from './package.json' with { type: 'json' };
|
||||||
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name.js';
|
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name.js';
|
||||||
import pluginJson5 from './vite.json5.js';
|
import pluginJson5 from './vite.json5.js';
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
"nodemon": "3.1.0",
|
"nodemon": "3.1.0",
|
||||||
"execa": "8.0.1",
|
"execa": "8.0.1",
|
||||||
"tsd": "0.30.7",
|
"tsd": "0.30.7",
|
||||||
"typescript": "5.4.5",
|
"typescript": "5.5.2",
|
||||||
"esbuild": "0.19.11",
|
"esbuild": "0.19.11",
|
||||||
"glob": "10.3.12"
|
"glob": "10.3.12"
|
||||||
},
|
},
|
||||||
|
|
|
@ -5881,15 +5881,15 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
id: string;
|
id: string;
|
||||||
memo: string;
|
memo?: string;
|
||||||
url: string;
|
url?: string;
|
||||||
imageUrl: string;
|
imageUrl?: string;
|
||||||
place: string;
|
place?: string;
|
||||||
priority: string;
|
priority?: string;
|
||||||
ratio: number;
|
ratio?: number;
|
||||||
expiresAt: number;
|
expiresAt?: number;
|
||||||
startsAt: number;
|
startsAt?: number;
|
||||||
dayOfWeek: number;
|
dayOfWeek?: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -9744,21 +9744,21 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
roleId: string;
|
roleId: string;
|
||||||
name: string;
|
name?: string;
|
||||||
description: string;
|
description?: string;
|
||||||
color: string | null;
|
color?: string | null;
|
||||||
iconUrl: string | null;
|
iconUrl?: string | null;
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
target: 'manual' | 'conditional';
|
target?: 'manual' | 'conditional';
|
||||||
condFormula: Record<string, never>;
|
condFormula?: Record<string, never>;
|
||||||
isPublic: boolean;
|
isPublic?: boolean;
|
||||||
isModerator: boolean;
|
isModerator?: boolean;
|
||||||
isAdministrator: boolean;
|
isAdministrator?: boolean;
|
||||||
isExplorable?: boolean;
|
isExplorable?: boolean;
|
||||||
asBadge: boolean;
|
asBadge?: boolean;
|
||||||
canEditMembersByModerator: boolean;
|
canEditMembersByModerator?: boolean;
|
||||||
displayOrder: number;
|
displayOrder?: number;
|
||||||
policies: Record<string, never>;
|
policies?: Record<string, never>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -13400,7 +13400,7 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
clipId: string;
|
clipId: string;
|
||||||
name: string;
|
name?: string;
|
||||||
isPublic?: boolean;
|
isPublic?: boolean;
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
};
|
};
|
||||||
|
@ -16247,9 +16247,9 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
postId: string;
|
postId: string;
|
||||||
title: string;
|
title?: string;
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
fileIds: string[];
|
fileIds?: string[];
|
||||||
/** @default false */
|
/** @default false */
|
||||||
isSensitive?: boolean;
|
isSensitive?: boolean;
|
||||||
};
|
};
|
||||||
|
@ -20030,12 +20030,11 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
webhookId: string;
|
webhookId: string;
|
||||||
name: string;
|
name?: string;
|
||||||
url: string;
|
url?: string;
|
||||||
/** @default */
|
secret?: string | null;
|
||||||
secret?: string;
|
on?: ('mention' | 'unfollow' | 'follow' | 'followed' | 'note' | 'reply' | 'renote' | 'reaction')[];
|
||||||
on: ('mention' | 'unfollow' | 'follow' | 'followed' | 'note' | 'reply' | 'renote' | 'reaction')[];
|
active?: boolean;
|
||||||
active: boolean;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -23404,16 +23403,16 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
pageId: string;
|
pageId: string;
|
||||||
title: string;
|
title?: string;
|
||||||
name: string;
|
name?: string;
|
||||||
summary?: string | null;
|
summary?: string | null;
|
||||||
content: {
|
content?: {
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}[];
|
}[];
|
||||||
variables: {
|
variables?: {
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}[];
|
}[];
|
||||||
script: string;
|
script?: string;
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
eyeCatchingImageId?: string | null;
|
eyeCatchingImageId?: string | null;
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import * as esbuild from 'esbuild';
|
import * as esbuild from 'esbuild';
|
||||||
import locales from '../../locales/index.js';
|
import locales from '../../locales/index.js';
|
||||||
import meta from '../../package.json' assert { type: "json" };
|
import meta from '../../package.json' with { type: "json" };
|
||||||
const watch = process.argv[2]?.includes('watch');
|
const watch = process.argv[2]?.includes('watch');
|
||||||
|
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"eslint": "8.57.0",
|
"eslint": "8.57.0",
|
||||||
"eslint-plugin-import": "2.29.1",
|
"eslint-plugin-import": "2.29.1",
|
||||||
"nodemon": "3.1.0",
|
"nodemon": "3.1.0",
|
||||||
"typescript": "5.4.5"
|
"typescript": "5.5.2"
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
|
384
pnpm-lock.yaml
384
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -13,7 +13,7 @@ import * as terser from 'terser';
|
||||||
|
|
||||||
import { build as buildLocales } from '../locales/index.js';
|
import { build as buildLocales } from '../locales/index.js';
|
||||||
import generateDTS from '../locales/generateDTS.js';
|
import generateDTS from '../locales/generateDTS.js';
|
||||||
import meta from '../package.json' assert { type: "json" };
|
import meta from '../package.json' with { type: "json" };
|
||||||
import buildTarball from './tarball.mjs';
|
import buildTarball from './tarball.mjs';
|
||||||
|
|
||||||
const configDir = fileURLToPath(new URL('../.config', import.meta.url));
|
const configDir = fileURLToPath(new URL('../.config', import.meta.url));
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { fileURLToPath } from 'node:url';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import walk from 'ignore-walk';
|
import walk from 'ignore-walk';
|
||||||
import Pack from 'tar/lib/pack.js';
|
import Pack from 'tar/lib/pack.js';
|
||||||
import meta from '../package.json' assert { type: "json" };
|
import meta from '../package.json' with { type: "json" };
|
||||||
|
|
||||||
const cwd = fileURLToPath(new URL('..', import.meta.url));
|
const cwd = fileURLToPath(new URL('..', import.meta.url));
|
||||||
const ignore = [
|
const ignore = [
|
||||||
|
|
Loading…
Reference in New Issue