This commit is contained in:
syuilo 2021-04-26 12:34:41 +09:00
parent d348e211d4
commit 4b205aee91

View file

@ -252,7 +252,7 @@ router.get('/users/:user', async ctx => {
}); });
// Note // Note
router.get('/notes/:note', async ctx => { router.get('/notes/:note', async (ctx, next) => {
const note = await Notes.findOne(ctx.params.note); const note = await Notes.findOne(ctx.params.note);
if (note) { if (note) {
@ -277,11 +277,11 @@ router.get('/notes/:note', async ctx => {
return; return;
} }
ctx.status = 404; await next();
}); });
// Page // Page
router.get('/@:user/pages/:page', async ctx => { router.get('/@:user/pages/:page', async (ctx, next) => {
const { username, host } = parseAcct(ctx.params.user); const { username, host } = parseAcct(ctx.params.user);
const user = await Users.findOne({ const user = await Users.findOne({
usernameLower: username.toLowerCase(), usernameLower: username.toLowerCase(),
@ -314,12 +314,12 @@ router.get('/@:user/pages/:page', async ctx => {
return; return;
} }
ctx.status = 404; await next();
}); });
// Clip // Clip
// TODO: 非publicなclipのハンドリング // TODO: 非publicなclipのハンドリング
router.get('/clips/:clip', async ctx => { router.get('/clips/:clip', async (ctx, next) => {
const clip = await Clips.findOne({ const clip = await Clips.findOne({
id: ctx.params.clip, id: ctx.params.clip,
}); });
@ -339,11 +339,11 @@ router.get('/clips/:clip', async ctx => {
return; return;
} }
ctx.status = 404; await next();
}); });
// Gallery post // Gallery post
router.get('/gallery/:post', async ctx => { router.get('/gallery/:post', async (ctx, next) => {
const post = await GalleryPosts.findOne(ctx.params.post); const post = await GalleryPosts.findOne(ctx.params.post);
if (post) { if (post) {
@ -362,11 +362,11 @@ router.get('/gallery/:post', async ctx => {
return; return;
} }
ctx.status = 404; await next();
}); });
// Channel // Channel
router.get('/channels/:channel', async ctx => { router.get('/channels/:channel', async (ctx, next) => {
const channel = await Channels.findOne({ const channel = await Channels.findOne({
id: ctx.params.channel, id: ctx.params.channel,
}); });
@ -384,7 +384,7 @@ router.get('/channels/:channel', async ctx => {
return; return;
} }
ctx.status = 404; await next();
}); });
//#endregion //#endregion