implements noop outbox

This commit is contained in:
Django Doucet 2023-05-19 22:54:03 -06:00
parent 8c2349ade6
commit 0f35295981
2 changed files with 26 additions and 0 deletions

View file

@ -14,6 +14,7 @@ function createActor(name, domain, pubkey) {
'type': 'Person',
'preferredUsername': `${name}`,
'inbox': `https://${domain}/api/inbox`,
'outbox': `https://${domain}/u/${name}/outbox`,
'followers': `https://${domain}/u/${name}/followers`,
'publicKey': {

View file

@ -57,4 +57,29 @@ router.get('/:name/followers', function (req, res) {
}
});
router.get('/:name/outbox', function (req, res) {
let name = req.params.name;
if (!name) {
return res.status(400).send('Bad request.');
}
else {
let domain = req.app.get('domain');
let messages = [];
let outboxCollection = {
"type":"OrderedCollection",
"totalItems":messages.length,
"id":`https://${domain}/u/${name}/outbox`,
"first": {
"type":"OrderedCollectionPage",
"totalItems":messages.length,
"partOf":`https://${domain}/u/${name}/outbox`,
"orderedItems": messages,
"id":`https://${domain}/u/${name}/outbox?page=1`
},
"@context":["https://www.w3.org/ns/activitystreams"]
};
res.json(outboxCollection);
}
});
module.exports = router;