Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0d55438
wip
kakkokari-gtyih Apr 22, 2026
d6ce153
migrate test-server
kakkokari-gtyih Apr 22, 2026
ff7095f
migrate urlpreviewservice
kakkokari-gtyih Apr 22, 2026
0a1af2a
wip: migrate client server
kakkokari-gtyih Apr 22, 2026
0061f6e
fix
kakkokari-gtyih Apr 22, 2026
fe2dbec
fix
kakkokari-gtyih Apr 22, 2026
411066a
wip: migrate file server
kakkokari-gtyih Apr 22, 2026
ddbc00b
Merge branch 'develop' into enh-be-server-hono
kakkokari-gtyih May 16, 2026
ebfd356
wip
kakkokari-gtyih May 16, 2026
e3c256e
wip
kakkokari-gtyih May 16, 2026
5c831c0
wip
kakkokari-gtyih May 16, 2026
03a6bc3
wip
kakkokari-gtyih May 16, 2026
2dc2245
fix
kakkokari-gtyih May 17, 2026
2994e4f
wip
kakkokari-gtyih May 17, 2026
c0031dd
wip
kakkokari-gtyih May 17, 2026
c4544b8
update hono
kakkokari-gtyih May 17, 2026
58c91ae
fix
kakkokari-gtyih May 17, 2026
5917ea9
fix
kakkokari-gtyih May 17, 2026
787e3f5
fix
kakkokari-gtyih May 17, 2026
3810032
fix
kakkokari-gtyih May 17, 2026
c7df7c4
fix
kakkokari-gtyih May 17, 2026
9bc288b
Merge branch 'develop' into enh-be-server-hono
kakkokari-gtyih May 29, 2026
6c4f4a7
fix lockfile
kakkokari-gtyih May 29, 2026
ec1c836
oauth2providerserviceをhonoに移行
kakkokari-gtyih May 29, 2026
4e0d3f1
attempt to fix
kakkokari-gtyih May 29, 2026
0022d8d
clean up
kakkokari-gtyih May 29, 2026
9f988f8
fix
kakkokari-gtyih May 29, 2026
45ed102
chore: remove vary
kakkokari-gtyih May 29, 2026
8acdd80
refactor
kakkokari-gtyih May 29, 2026
00d7c03
fix test
kakkokari-gtyih May 29, 2026
4d18e45
fix
kakkokari-gtyih May 29, 2026
9e04812
fix
kakkokari-gtyih May 29, 2026
53dd4f5
fix
kakkokari-gtyih May 29, 2026
1b9761b
Merge branch 'develop' into enh-be-server-hono
kakkokari-gtyih Jun 3, 2026
38f4c5d
remove fastify
kakkokari-gtyih Jun 3, 2026
b3e3574
fix test
kakkokari-gtyih Jun 3, 2026
d876110
fix test
kakkokari-gtyih Jun 3, 2026
3558262
fix test
kakkokari-gtyih Jun 3, 2026
473e46a
Merge branch 'develop' into enh-be-server-hono
kakkokari-gtyih Jun 7, 2026
773d98c
update deps
kakkokari-gtyih Jun 7, 2026
f5317af
fix: wsに繋がらない問題を修正
kakkokari-gtyih Jun 7, 2026
372f433
fix
kakkokari-gtyih Jun 7, 2026
ef5d562
perf: improve api route performance
kakkokari-gtyih Jun 7, 2026
5014c4e
perf
kakkokari-gtyih Jun 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@
"dependencies": {
"@aws-sdk/client-s3": "3.1057.0",
"@aws-sdk/lib-storage": "3.1057.0",
"@fastify/accepts": "5.0.4",
"@fastify/cors": "11.2.0",
"@fastify/http-proxy": "11.4.4",
"@fastify/multipart": "10.0.0",
"@fastify/static": "9.1.3",
"@kitajs/html": "4.2.13",
"@fastify/proxy-addr": "5.1.0",
"@hono/node-server": "2.0.4",
"@misskey-dev/emoji-assets": "17.0.3",
"@misskey-dev/emoji-data": "17.0.3",
"@misskey-dev/sharp-read-bmp": "1.2.0",
Expand Down Expand Up @@ -91,13 +87,12 @@
"content-disposition": "2.0.1",
"date-fns": "4.4.0",
"deep-email-validator": "0.1.27",
"fastify": "5.8.5",
"fastify-raw-body": "5.0.0",
"feed": "5.2.1",
"file-type": "22.0.1",
"fluent-ffmpeg": "2.1.3",
"form-data": "4.0.5",
"got": "15.0.5",
"hono": "4.12.23",
"hpagent": "1.2.0",
"http-link-header": "1.1.3",
"i18n": "workspace:*",
Expand Down Expand Up @@ -147,13 +142,11 @@
"tsc-alias": "1.8.17",
"typeorm": "1.0.0",
"ulid": "3.0.2",
"vary": "1.1.2",
"web-push": "3.6.7",
"ws": "8.21.0",
"xev": "3.0.2"
},
"devDependencies": {
"@kitajs/ts-html-plugin": "4.1.4",
"@nestjs/platform-express": "11.1.24",
"@rollup/plugin-esm-shim": "0.1.8",
"@sentry/vue": "10.55.0",
Expand Down
7 changes: 4 additions & 3 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
import { type FastifyServerOptions } from 'fastify';
import type * as Sentry from '@sentry/node';
import type * as SentryVue from '@sentry/vue';
import type { RedisOptions } from 'ioredis';

type TrustProxyOption = boolean | string | string[] | ((address: string, hop: number) => boolean);

type RedisOptionsSource = Partial<RedisOptions> & {
host: string;
port: number;
Expand All @@ -27,7 +28,7 @@ type Source = {
url?: string;
port?: number;
socket?: string;
trustProxy?: FastifyServerOptions['trustProxy'];
trustProxy?: TrustProxyOption;
chmodSocket?: string;
enableIpRateLimit?: boolean;
disableHsts?: boolean;
Expand Down Expand Up @@ -121,7 +122,7 @@ export type Config = {
url: string;
port: number;
socket: string | undefined;
trustProxy: NonNullable<FastifyServerOptions['trustProxy']>;
trustProxy: NonNullable<TrustProxyOption>
chmodSocket: string | undefined;
enableIpRateLimit: boolean;
disableHsts: boolean | undefined;
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/core/DownloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as stream from 'node:stream/promises';
import { Inject, Injectable } from '@nestjs/common';
import chalk from 'chalk';
import got, * as Got from 'got';
import type { StatusCode } from 'hono/utils/http-status';
import { parse } from 'content-disposition';
import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
Expand Down Expand Up @@ -100,7 +101,7 @@ export class DownloadService {
await stream.pipeline(req, fs.createWriteStream(path));
} catch (e) {
if (e instanceof Got.HTTPError) {
throw new StatusError(`${e.response.statusCode} ${e.response.statusMessage}`, e.response.statusCode, e.response.statusMessage);
throw new StatusError(`${e.response.statusCode} ${e.response.statusMessage}`, e.response.statusCode as StatusCode, e.response.statusMessage);
} else {
throw e;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/core/HttpRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as net from 'node:net';
import * as stream from 'node:stream';
import ipaddr from 'ipaddr.js';
import CacheableLookup from 'cacheable-lookup';
import type { StatusCode } from 'hono/utils/http-status';
import fetch from 'node-fetch';
import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';
import { Inject, Injectable } from '@nestjs/common';
Expand Down Expand Up @@ -344,7 +345,7 @@ export class HttpRequestService {
});

if (!res.ok && extra.throwErrorWhenResponseNotOk) {
throw new StatusError(`${res.status} ${res.statusText}`, res.status, res.statusText);
throw new StatusError(`${res.status} ${res.statusText}`, res.status as StatusCode, res.statusText);
}

if (res.ok) {
Expand Down
14 changes: 0 additions & 14 deletions packages/backend/src/misc/fastify-hook-handlers.ts

This file was deleted.

15 changes: 15 additions & 0 deletions packages/backend/src/misc/hono-middleware-handlers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { createMiddleware } from 'hono/factory';

export const handleRequestRedirectToOmitSearch = createMiddleware(async (c, next) => {
if (c.req.url.includes('?')) {
return c.redirect(c.req.path, 301);
}

await next();
return;
});
18 changes: 18 additions & 0 deletions packages/backend/src/misc/hono-vary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

import type { Context as HonoContext } from 'hono';

export function vary(c: HonoContext, field: string) {
const varyHeader = c.res.headers.get('Vary');
if (varyHeader != null) {
const fields = varyHeader.split(',').map((f) => f.trim());
if (!fields.includes(field)) {
c.res.headers.set('Vary', `${varyHeader}, ${field}`);
}
} else {
c.res.headers.set('Vary', field);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

// https://www.fastify.io/docs/latest/Reference/Reply/#async-await-and-promises
export class FastifyReplyError extends Error {
export class HttpStatusError extends Error {
public message: string;
public statusCode: number;

Expand Down
5 changes: 3 additions & 2 deletions packages/backend/src/misc/status-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { StatusCode } from 'hono/utils/http-status';

export class StatusError extends Error {
public statusCode: number;
public statusCode: StatusCode;
public statusMessage?: string;
public isClientError: boolean;
public isRetryable: boolean;

constructor(message: string, statusCode: number, statusMessage?: string) {
constructor(message: string, statusCode: StatusCode, statusMessage?: string) {
super(message);
this.name = 'StatusError';
this.statusCode = statusCode;
Expand Down
Loading
Loading