1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-11 13:34:01 +02:00

Merge branch 'develop' into renovate/major-backend-update-dependencies

This commit is contained in:
kakkokari-gtyih
2025-11-29 19:07:57 +09:00
55 changed files with 2582 additions and 2829 deletions

View File

@@ -70,8 +70,8 @@
"utf-8-validate": "6.0.5"
},
"dependencies": {
"@aws-sdk/client-s3": "3.933.0",
"@aws-sdk/lib-storage": "3.933.0",
"@aws-sdk/client-s3": "3.936.0",
"@aws-sdk/lib-storage": "3.936.0",
"@discordapp/twemoji": "16.0.1",
"@fastify/accepts": "5.0.3",
"@fastify/cookie": "11.0.2",
@@ -88,14 +88,14 @@
"@nestjs/core": "11.1.9",
"@nestjs/testing": "11.1.9",
"@peertube/http-signature": "1.7.0",
"@sentry/node": "10.25.0",
"@sentry/profiling-node": "10.25.0",
"@sentry/node": "10.26.0",
"@sentry/profiling-node": "10.26.0",
"@simplewebauthn/server": "13.2.2",
"@sinonjs/fake-timers": "15.0.0",
"@smithy/node-http-handler": "4.4.5",
"@swc/cli": "0.7.8",
"@swc/cli": "0.7.9",
"@swc/core": "1.15.2",
"@twemoji/parser": "17.0.1",
"@twemoji/parser": "16.0.0",
"@types/redis-info": "3.0.3",
"accepts": "1.3.8",
"ajv": "8.17.1",
@@ -114,10 +114,10 @@
"content-disposition": "1.0.0",
"date-fns": "4.1.0",
"deep-email-validator": "0.1.21",
"fastify": "5.6.1",
"fastify": "5.6.2",
"fastify-raw-body": "5.0.0",
"feed": "5.1.0",
"file-type": "21.1.0",
"file-type": "21.1.1",
"fluent-ffmpeg": "2.1.3",
"form-data": "4.0.5",
"got": "14.6.4",
@@ -161,7 +161,7 @@
"qrcode": "1.5.4",
"random-seed": "0.3.0",
"ratelimiter": "3.4.1",
"re2": "1.22.1",
"re2": "1.22.3",
"redis-info": "3.1.0",
"reflect-metadata": "0.2.2",
"rename": "1.0.4",
@@ -190,7 +190,7 @@
"devDependencies": {
"@jest/globals": "29.7.0",
"@nestjs/platform-express": "11.1.9",
"@sentry/vue": "10.25.0",
"@sentry/vue": "10.26.0",
"@simplewebauthn/types": "12.0.0",
"@swc/jest": "0.2.39",
"@types/accepts": "1.3.7",

View File

@@ -41,7 +41,7 @@ function greet() {
//#endregion
console.log(' Misskey is an open-source decentralized microblogging platform.');
console.log(chalk.rgb(255, 136, 0)(' If you like Misskey, please donate to support development. https://www.patreon.com/syuilo'));
console.log(chalk.rgb(255, 136, 0)(' If you like Misskey, please consider donating to support dev. https://misskey-hub.net/docs/donate/'));
console.log('');
console.log(chalkTemplate`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`);

View File

@@ -7,11 +7,11 @@ import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Injectable } from '@nestjs/common';
import * as nsfw from 'nsfwjs';
import si from 'systeminformation';
import { Mutex } from 'async-mutex';
import fetch from 'node-fetch';
import { bindThis } from '@/decorators.js';
import type { NSFWJS, PredictionType } from 'nsfwjs';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
@@ -21,7 +21,7 @@ let isSupportedCpu: undefined | boolean = undefined;
@Injectable()
export class AiService {
private model: nsfw.NSFWJS;
private model: NSFWJS;
private modelLoadMutex: Mutex = new Mutex();
constructor(
@@ -29,7 +29,7 @@ export class AiService {
}
@bindThis
public async detectSensitive(source: string | Buffer): Promise<nsfw.PredictionType[] | null> {
public async detectSensitive(source: string | Buffer): Promise<PredictionType[] | null> {
try {
if (isSupportedCpu === undefined) {
isSupportedCpu = await this.computeIsSupportedCpu();
@@ -44,6 +44,7 @@ export class AiService {
tf.env().global.fetch = fetch;
if (this.model == null) {
const nsfw = await import('nsfwjs');
await this.modelLoadMutex.runExclusive(async () => {
if (this.model == null) {
this.model = await nsfw.load(`file://${_dirname}/../../nsfw-model/`, { size: 299 });

View File

@@ -5,7 +5,6 @@
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { QueryService } from '@/core/QueryService.js';
import type { ClipFavoritesRepository } from '@/models/_.js';
import { DI } from '@/di-symbols.js';
import { ClipEntityService } from '@/core/entities/ClipEntityService.js';
@@ -31,11 +30,6 @@ export const meta = {
export const paramDef = {
type: 'object',
properties: {
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
sinceDate: { type: 'integer' },
untilDate: { type: 'integer' },
},
required: [],
} as const;
@@ -46,16 +40,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@Inject(DI.clipFavoritesRepository)
private clipFavoritesRepository: ClipFavoritesRepository,
private queryService: QueryService,
private clipEntityService: ClipEntityService,
) {
super(meta, paramDef, async (ps, me) => {
const query = this.queryService.makePaginationQuery(this.clipFavoritesRepository.createQueryBuilder('favorite'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
const query = this.clipFavoritesRepository.createQueryBuilder('favorite')
.andWhere('favorite.userId = :meId', { meId: me.id })
.leftJoinAndSelect('favorite.clip', 'clip');
const favorites = await query
.limit(ps.limit)
.getMany();
return this.clipEntityService.packMany(favorites.map(x => x.clip!), me);

View File

@@ -295,8 +295,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (ps.chatScope !== undefined) updates.chatScope = ps.chatScope;
function checkMuteWordCount(mutedWords: (string[] | string)[], limit: number) {
// TODO: ちゃんと数える
const length = JSON.stringify(mutedWords).length;
const count = (arr: (string[] | string)[]) => {
let length = 0;
for (const item of arr) {
if (typeof item === 'string') {
length += item.length;
} else if (Array.isArray(item)) {
for (const subItem of item) {
length += subItem.length;
}
}
}
return length;
};
const length = count(mutedWords);
if (length > limit) {
throw new ApiError(meta.errors.tooManyMutedWords);
}

View File

@@ -135,6 +135,18 @@ export const meta = {
code: 'CANNOT_RENOTE_TO_EXTERNAL',
id: 'ed1952ac-2d26-4957-8b30-2deda76bedf7',
},
scheduledAtRequired: {
message: 'scheduledAt is required when isActuallyScheduled is true.',
code: 'SCHEDULED_AT_REQUIRED',
id: '15e28a55-e74c-4d65-89b7-8880cdaaa87d',
},
scheduledAtMustBeInFuture: {
message: 'scheduledAt must be in the future.',
code: 'SCHEDULED_AT_MUST_BE_IN_FUTURE',
id: 'e4bed6c9-017e-4934-aed0-01c22cc60ec1',
},
},
limit: {
@@ -252,6 +264,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.cannotReplyToSpecifiedVisibilityNoteWithExtendedVisibility);
case 'c3275f19-4558-4c59-83e1-4f684b5fab66':
throw new ApiError(meta.errors.tooManyScheduledNotes);
case '94a89a43-3591-400a-9c17-dd166e71fdfa':
throw new ApiError(meta.errors.scheduledAtRequired);
case 'b34d0c1b-996f-4e34-a428-c636d98df457':
throw new ApiError(meta.errors.scheduledAtMustBeInFuture);
default:
throw err;
}

View File

@@ -165,6 +165,18 @@ export const meta = {
code: 'TOO_MANY_SCHEDULED_NOTES',
id: '02f5df79-08ae-4a33-8524-f1503c8f6212',
},
scheduledAtRequired: {
message: 'scheduledAt is required when isActuallyScheduled is true.',
code: 'SCHEDULED_AT_REQUIRED',
id: 'fe9737d5-cc41-498c-af9d-149207307530',
},
scheduledAtMustBeInFuture: {
message: 'scheduledAt must be in the future.',
code: 'SCHEDULED_AT_MUST_BE_IN_FUTURE',
id: 'ed1a6673-d0d1-4364-aaae-9bf3f139cbc5',
},
},
limit: {
@@ -295,6 +307,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.containsTooManyMentions);
case 'bacdf856-5c51-4159-b88a-804fa5103be5':
throw new ApiError(meta.errors.tooManyScheduledNotes);
case '94a89a43-3591-400a-9c17-dd166e71fdfa':
throw new ApiError(meta.errors.scheduledAtRequired);
case 'b34d0c1b-996f-4e34-a428-c636d98df457':
throw new ApiError(meta.errors.scheduledAtMustBeInFuture);
default:
throw err;
}

View File

@@ -50,7 +50,7 @@ import { AnnouncementEntityService } from '@/core/entities/AnnouncementEntitySer
import { FeedService } from './FeedService.js';
import { UrlPreviewService } from './UrlPreviewService.js';
import { ClientLoggerService } from './ClientLoggerService.js';
import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
import type { FastifyError, FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
@@ -918,7 +918,7 @@ export class ClientServerService {
return await renderBase(reply);
});
fastify.setErrorHandler(async (error, request, reply) => {
fastify.setErrorHandler<FastifyError>(async (error, request, reply) => {
const errId = randomUUID();
this.clientLoggerService.logger.error(`Internal error occurred in ${request.routeOptions.url}: ${error.message}`, {
path: request.routeOptions.url,

View File

@@ -28,7 +28,7 @@ html
meta(name='theme-color-orig' content= themeColor || '#86b300')
meta(property='og:site_name' content= instanceName || 'Misskey')
meta(property='instance_url' content= instanceUrl)
meta(name='viewport' content='width=device-width, initial-scale=1')
meta(name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover')
meta(name='format-detection' content='telephone=no,date=no,address=no,email=no,url=no')
link(rel='icon' href= icon || '/favicon.ico')
link(rel='apple-touch-icon' href= appleTouchIcon || '/apple-touch-icon.png')

View File

@@ -95,7 +95,7 @@ services:
retries: 20
db:
image: postgres:15-alpine
image: postgres:18-alpine
env_file:
- ./.config/docker.env
volumes:

View File

@@ -5,7 +5,7 @@ services:
- "127.0.0.1:56312:6379"
dbtest:
image: postgres:15
image: postgres:18
ports:
- "127.0.0.1:54312:5432"
environment:

View File

@@ -506,10 +506,10 @@ describe('クリップ', () => {
});
};
const myFavorites = async (parameters: Misskey.entities.ClipsMyFavoritesRequest, request: Partial<ApiRequest<'clips/my-favorites'>> = {}): Promise<Misskey.entities.Clip[]> => {
const myFavorites = async (request: Partial<ApiRequest<'clips/my-favorites'>> = {}): Promise<Misskey.entities.Clip[]> => {
return successfulApiCall({
endpoint: 'clips/my-favorites',
parameters,
parameters: {},
user: alice,
...request,
});
@@ -562,9 +562,8 @@ describe('クリップ', () => {
await favorite({ clipId: clip.id });
}
const favorited = await myFavorites({
limit: 30,
});
// pagenationはない。全部一気にとれる。
const favorited = await myFavorites();
assert.strictEqual(favorited.length, clips.length);
for (const clip of favorited) {
assert.strictEqual(clip.favoritedCount, 1);
@@ -618,7 +617,7 @@ describe('クリップ', () => {
const clip = await show({ clipId: aliceClip.id });
assert.strictEqual(clip.favoritedCount, 0);
assert.strictEqual(clip.isFavorited, false);
assert.deepStrictEqual(await myFavorites({}), []);
assert.deepStrictEqual(await myFavorites(), []);
});
test.each([
@@ -652,13 +651,13 @@ describe('クリップ', () => {
test('を取得できる。', async () => {
await favorite({ clipId: aliceClip.id });
const favorited = await myFavorites({});
const favorited = await myFavorites();
assert.deepStrictEqual(favorited, [await show({ clipId: aliceClip.id })]);
});
test('を取得したとき他人のお気に入りは含まない。', async () => {
await favorite({ clipId: aliceClip.id });
const favorited = await myFavorites({}, { user: bob });
const favorited = await myFavorites({ user: bob });
assert.deepStrictEqual(favorited, []);
});
});