diff --git a/src/die.ts b/src/die.ts index 0dccad0..219616d 100644 --- a/src/die.ts +++ b/src/die.ts @@ -1,6 +1,6 @@ import { Context } from 'koa'; -export const die = (ctx: Context, error: string): Promise => { - ctx.status = 400; +export const die = (ctx: Context, error: string, status = 400): Promise => { + ctx.status = status; return ctx.render('error', { error }); }; diff --git a/src/router.ts b/src/router.ts index efcee7f..2f0b70a 100644 --- a/src/router.ts +++ b/src/router.ts @@ -5,6 +5,7 @@ import { v4 as uuid } from 'uuid'; import { config } from './config'; import axios from 'axios'; import { upsertUser, getUser, getUserCount, updateUser } from './users'; +import { api } from './misskey'; export const router = new Router(); @@ -98,6 +99,5 @@ router.get('/legacy-auth', async ctx => { // Return 404 for other pages router.all('(.*)', async ctx => { - ctx.status = 404; - await die(ctx, 'ページが見つかりませんでした'); + await die(ctx, 'ページが見つかりませんでした', 404); }); \ No newline at end of file