feat: Announce(Note) and Undo(Announce)

This commit is contained in:
Julian Lam
2024-02-06 14:57:44 -05:00
parent 21a2876e9c
commit 415b4fe11a
4 changed files with 85 additions and 36 deletions

View File

@@ -112,42 +112,11 @@ Controller.getInbox = async (req, res) => {
Controller.postInbox = async (req, res) => {
// Note: underlying methods are internal use only, hence no exposure via src/api
switch (req.body.type) {
case 'Create': {
await activitypub.inbox.create(req);
break;
}
case 'Update': {
await activitypub.inbox.update(req);
break;
}
case 'Like': {
await activitypub.inbox.like(req);
break;
}
case 'Follow': {
await activitypub.inbox.follow(req);
break;
}
case 'Accept': {
await activitypub.inbox.accept(req);
break;
}
case 'Undo': {
await activitypub.inbox.undo(req);
break;
}
default: {
res.sendStatus(501);
break;
}
const method = String(req.body.type).toLowerCase();
if (req.body.hasOwnProperty(method)) {
return res.sendStatus(501);
}
await activitypub.inbox[method](req);
res.sendStatus(200);
};