Merge pull request #19 from mediaformat/outbox

implements noop outbox
This commit is contained in:
Darius Kazemi 2023-05-20 13:08:06 +01:00 committed by GitHub
commit 9bd6bf59c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View file

@ -14,6 +14,7 @@ function createActor(name, domain, pubkey) {
'type': 'Person', 'type': 'Person',
'preferredUsername': `${name}`, 'preferredUsername': `${name}`,
'inbox': `https://${domain}/api/inbox`, 'inbox': `https://${domain}/api/inbox`,
'outbox': `https://${domain}/u/${name}/outbox`,
'followers': `https://${domain}/u/${name}/followers`, 'followers': `https://${domain}/u/${name}/followers`,
'publicKey': { '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; module.exports = router;