mirror of
https://github.com/dariusk/express-activitypub.git
synced 2024-11-21 15:00:58 +00:00
implements noop outbox
This commit is contained in:
parent
8c2349ade6
commit
0f35295981
2 changed files with 26 additions and 0 deletions
|
@ -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': {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue