Skip to content

Commit

Permalink
💩
Browse files Browse the repository at this point in the history
  • Loading branch information
BeiyanYunyi committed Dec 29, 2023
1 parent f8ed718 commit f28611c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions functions/api/activitypub/inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ export const onRequestPost: PagesFunction<Env> = async (ctx) => {
// try {
const body: AP.Follow | AP.Undo = await ctx.request.json();
if (typeof body.type !== 'string') throw new Error('Not Implemented');
if (!['Follow', 'Undo'].includes(body.type)) throw new Error(`Not Implemented: ${body.type}`);
if (!['Follow', 'Undo'].includes(body.type))
console.error(new Error(`Not Implemented: ${body.type}`));
switch (body.type) {
case 'Follow':
return handleFollow(body as AP.Follow, db, ctx.env);
case 'Undo':
return handleUnfollow(body as AP.Undo, db);
default:
throw new Error(`Not Implemented: ${body.type}`);
console.error(new Error(`Not Implemented: ${body.type}`));
return new Response('Ok');
}
// } catch (e) {
// return new Response('Bad Request', { status: 400 });
Expand Down

0 comments on commit f28611c

Please sign in to comment.