update deps and fix

This commit is contained in:
まっちゃとーにゅ 2024-04-29 06:28:05 +09:00
parent fd696a9621
commit 96abc31bfc
No known key found for this signature in database
GPG Key ID: 6AFBBF529601C1DB
12 changed files with 649 additions and 466 deletions

View File

@ -52,7 +52,7 @@
"sharp": "0.33.3"
},
"dependencies": {
"cssnano": "6.1.2",
"cssnano": "7.0.1",
"execa": "8.0.1",
"js-yaml": "4.1.0",
"postcss": "8.4.38",

View File

@ -12,9 +12,9 @@
"migrate": "pnpm typeorm migration:run -d ormconfig.js",
"revert": "pnpm typeorm migration:revert -d ormconfig.js",
"check:connect": "node ./scripts/check_connect.js",
"build": "swc src -d built -D",
"build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc",
"watch:swc": "swc src -d built -D -w",
"build": "swc src -d built -D --strip-leading-paths",
"build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc --strip-leading-paths",
"watch:swc": "swc src -d built -D -w --strip-leading-paths",
"build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
"watch": "node ./scripts/watch.mjs",
"restart": "pnpm build && pnpm start",
@ -35,17 +35,17 @@
},
"optionalDependencies": {
"@swc/core-android-arm64": "1.3.11",
"@swc/core-darwin-arm64": "1.3.107",
"@swc/core-darwin-x64": "1.3.107",
"@swc/core-darwin-arm64": "1.5.2",
"@swc/core-darwin-x64": "1.5.0",
"@swc/core-freebsd-x64": "1.3.11",
"@swc/core-linux-arm-gnueabihf": "1.3.107",
"@swc/core-linux-arm64-gnu": "1.3.107",
"@swc/core-linux-arm64-musl": "1.3.107",
"@swc/core-linux-x64-gnu": "1.3.107",
"@swc/core-linux-x64-musl": "1.3.107",
"@swc/core-win32-arm64-msvc": "1.3.107",
"@swc/core-win32-ia32-msvc": "1.3.107",
"@swc/core-win32-x64-msvc": "1.3.107",
"@swc/core-linux-arm-gnueabihf": "1.5.2",
"@swc/core-linux-arm64-gnu": "1.5.2",
"@swc/core-linux-arm64-musl": "1.5.2",
"@swc/core-linux-x64-gnu": "1.5.2",
"@swc/core-linux-x64-musl": "1.5.2",
"@swc/core-win32-arm64-msvc": "1.5.2",
"@swc/core-win32-ia32-msvc": "1.5.2",
"@swc/core-win32-x64-msvc": "1.5.2",
"@tensorflow/tfjs": "4.18.0",
"@tensorflow/tfjs-node": "4.18.0",
"bufferutil": "4.0.8",
@ -83,6 +83,7 @@
"@fastify/view": "9.0.0",
"@misskey-dev/sharp-read-bmp": "1.2.0",
"@misskey-dev/summaly": "5.1.0",
"@napi-rs/canvas": "0.1.52",
"@nestjs/common": "10.3.8",
"@nestjs/core": "10.3.8",
"@nestjs/testing": "10.3.8",
@ -90,13 +91,13 @@
"@simplewebauthn/server": "10.0.0",
"@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "2.5.0",
"@swc/cli": "0.1.65",
"@swc/core": "1.3.107",
"@swc/cli": "0.3.12",
"@swc/core": "1.4.17",
"@twemoji/parser": "15.1.1",
"accepts": "1.3.8",
"ajv": "8.12.0",
"archiver": "6.0.1",
"async-mutex": "0.4.1",
"archiver": "7.0.1",
"async-mutex": "0.5.0",
"bcryptjs": "2.4.3",
"blurhash": "2.0.5",
"body-parser": "1.20.2",
@ -119,7 +120,7 @@
"fluent-ffmpeg": "2.1.2",
"form-data": "4.0.0",
"got": "14.2.1",
"happy-dom": "10.0.3",
"happy-dom": "14.7.1",
"hpagent": "1.2.0",
"htmlescape": "1.1.1",
"http-link-header": "1.1.3",
@ -129,7 +130,7 @@
"is-svg": "5.0.0",
"jose": "5.2.4",
"js-yaml": "4.1.0",
"jsdom": "23.2.0",
"jsdom": "24.0.0",
"json5": "2.2.3",
"jsonld": "8.3.2",
"jsrsasign": "11.1.0",
@ -153,14 +154,13 @@
"otpauth": "9.2.3",
"parse5": "7.1.2",
"pg": "8.11.5",
"pino": "8.20.0",
"pino": "9.0.0",
"pino-pretty": "11.0.0",
"pkce-challenge": "4.1.0",
"probe-image-size": "7.2.3",
"promise-limit": "2.7.0",
"pug": "3.0.2",
"punycode": "2.3.1",
"pureimage": "0.3.17",
"qrcode": "1.5.3",
"random-seed": "0.3.0",
"ratelimiter": "3.4.1",
@ -187,7 +187,7 @@
"ulid": "2.3.0",
"vary": "1.1.2",
"web-push": "3.6.7",
"ws": "8.16.0",
"ws": "8.17.0",
"xev": "3.0.2",
"xmlbuilder": "15.1.1"
},

View File

@ -8,13 +8,12 @@ import * as mfm from 'mfm-js';
import { In, DataSource, IsNull, LessThan } from 'typeorm';
import * as Redis from 'ioredis';
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
import RE2 from 're2';
import { extractMentions } from '@/misc/extract-mentions.js';
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
import { extractHashtags } from '@/misc/extract-hashtags.js';
import type { IMentionedRemoteUsers } from '@/models/Note.js';
import { MiNote } from '@/models/Note.js';
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MiFollowing, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
import type { MiDriveFile } from '@/models/DriveFile.js';
import type { MiApp } from '@/models/App.js';
import { concat } from '@/misc/prelude/array.js';
@ -23,11 +22,8 @@ import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js';
import type { IPoll } from '@/models/Poll.js';
import { MiPoll } from '@/models/Poll.js';
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
import { checkWordMute } from '@/misc/check-word-mute.js';
import type { MiChannel } from '@/models/Channel.js';
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
import { MemorySingleCache } from '@/misc/cache.js';
import type { MiUserProfile } from '@/models/UserProfile.js';
import { RelayService } from '@/core/RelayService.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { DI } from '@/di-symbols.js';
@ -75,7 +71,6 @@ class NotificationManager {
}[];
constructor(
private mutingsRepository: MutingsRepository,
private notificationService: NotificationService,
notifier: { id: MiUser['id']; },
note: MiNote,
@ -172,9 +167,6 @@ export class NoteCreateService implements OnApplicationShutdown {
@Inject(DI.notesRepository)
private notesRepository: NotesRepository,
@Inject(DI.mutingsRepository)
private mutingsRepository: MutingsRepository,
@Inject(DI.instancesRepository)
private instancesRepository: InstancesRepository,
@ -266,7 +258,7 @@ export class NoteCreateService implements OnApplicationShutdown {
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', sensitiveWords)) {
data.visibility = 'home';
this.logger.warn('Visibility changed to home because sensitive words are included', { user: user.id, note: data });
} else if (policies.canPublicNote === false) {
} else if (!policies.canPublicNote) {
data.visibility = 'home';
}
}
@ -389,7 +381,7 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
if (policies.canInitiateConversation === false) {
if (!policies.canInitiateConversation) {
if (
mentionedUsers.some(u => u.id !== user.id)
|| (data.reply && data.reply.userId !== user.id)
@ -648,7 +640,7 @@ export class NoteCreateService implements OnApplicationShutdown {
}
});
const nm = new NotificationManager(this.mutingsRepository, this.notificationService, user, note);
const nm = new NotificationManager(this.notificationService, user, note);
await this.createMentionedEvents(mentionedUsers, note, nm);
@ -796,15 +788,17 @@ export class NoteCreateService implements OnApplicationShutdown {
}
@bindThis
private isQuote(note: Option & { renote: MiNote }): note is Option & { renote: MiNote } & (
private isQuote(note: Option): note is Option & { renote: MiNote } & (
{ text: string } | { cw: string } | { reply: MiNote } | { poll: IPoll } | { files: MiDriveFile[] }
) {
) {
// NOTE: SYNC WITH misc/is-quote.ts
return note.text != null ||
return note.renote != null && (
note.text != null ||
note.reply != null ||
note.cw != null ||
note.poll != null ||
(note.files != null && note.files.length > 0);
(note.files != null && note.files.length > 0)
);
}
@bindThis

View File

@ -8,9 +8,8 @@
* https://en.wikipedia.org/wiki/Identicon
*/
import * as p from 'pureimage';
import { createCanvas } from '@napi-rs/canvas';
import gen from 'random-seed';
import type { WriteStream } from 'node:fs';
const size = 128; // px
const n = 5; // resolution
@ -45,9 +44,9 @@ const sideN = Math.floor(n / 2);
/**
* Generate buffer of an identicon by seed
*/
export function genIdenticon(seed: string, stream: WriteStream): Promise<void> {
export async function genIdenticon(seed: string): Promise<Buffer> {
const rand = gen.create(seed);
const canvas = p.make(size, size, undefined);
const canvas = createCanvas(size, size);
const ctx = canvas.getContext('2d');
const bgColors = colors[rand(colors.length)];
@ -101,5 +100,5 @@ export function genIdenticon(seed: string, stream: WriteStream): Promise<void> {
}
}
return p.encodePNGToStream(canvas, stream);
return await canvas.encode('png');
}

View File

@ -19,7 +19,6 @@ import { DI } from '@/di-symbols.js';
import type Logger from '@/logger.js';
import * as Acct from '@/misc/acct.js';
import { genIdenticon } from '@/misc/gen-identicon.js';
import { createTemp } from '@/misc/create-temp.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { LoggerService } from '@/core/LoggerService.js';
import { bindThis } from '@/decorators.js';
@ -207,9 +206,7 @@ export class ServerService implements OnApplicationShutdown {
reply.header('Cache-Control', 'public, max-age=86400');
if ((await this.metaService.fetch()).enableIdenticonGeneration) {
const [temp, cleanup] = await createTemp();
await genIdenticon(request.params.x, fs.createWriteStream(temp));
return fs.createReadStream(temp).on('close', () => cleanup());
return await genIdenticon(request.params.x);
} else {
return reply.redirect('/static-assets/avatar.png');
}

View File

@ -512,14 +512,14 @@ describe('Streaming', () => {
assert.strictEqual(fired, false);
});
test('withReplies = falseでフォローしてる人によるリプライが流れてくる', async () => {
test('withReplies = falseでフォローしてる人によるリプライが流れない', async () => {
const fired = await waitFire(
ayano, 'globalTimeline', // ayano:Global
() => api('notes/create', { text: 'foo', replyId: kanakoNote.id }, kyoko), // kyoko posts
msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko
);
assert.strictEqual(fired, true);
assert.strictEqual(fired, false);
});
});

View File

@ -14,9 +14,7 @@ import { afterAll, beforeAll, describe, test } from '@jest/globals';
import { GlobalModule } from '@/GlobalModule.js';
import { LoggerService } from '@/core/LoggerService.js';
import { FileInfoService } from '@/core/FileInfoService.js';
//import { DI } from '@/di-symbols.js';
import { AiService } from '@/core/AiService.js';
import { LoggerService } from '@/core/LoggerService.js';
import type { TestingModule } from '@nestjs/testing';
import type { MockFunctionMetadata } from 'jest-mock';

View File

@ -25,6 +25,7 @@ describe('NoteCreateService', () => {
describe('is-renote', () => {
const base: MiNote = {
id: 'some-note-id',
createdAt: new Date(2016, 11, 28, 22, 49, 51),
replyId: null,
reply: null,
renoteId: null,
@ -70,6 +71,7 @@ describe('NoteCreateService', () => {
const file: MiDriveFile = {
id: 'some-file-id',
createdAt: new Date(2016, 11, 28, 22, 49, 51),
userId: null,
user: null,
userHost: null,

View File

@ -8,6 +8,7 @@ import { MiNote } from '@/models/Note.js';
const base: MiNote = {
id: 'some-note-id',
createdAt: new Date(2016, 11, 28, 22, 49, 51),
replyId: null,
reply: null,
renoteId: null,

View File

@ -121,7 +121,7 @@
"eslint-plugin-import": "2.29.1",
"eslint-plugin-vue": "9.25.0",
"fast-glob": "3.3.2",
"happy-dom": "13.6.2",
"happy-dom": "14.7.1",
"intersection-observer": "0.12.2",
"micromatch": "4.0.5",
"msw": "2.2.14",

View File

@ -58,8 +58,8 @@
"built/dts"
],
"dependencies": {
"@swc/cli": "0.1.65",
"@swc/core": "1.3.107",
"@swc/cli": "0.3.12",
"@swc/core": "1.4.17",
"eventemitter3": "5.0.1",
"reconnecting-websocket": "4.4.0"
}

File diff suppressed because it is too large Load Diff