From 6e5453f0e269ad9e7a82924e0802f15a5ab4866f Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Mon, 23 Sep 2019 22:33:21 -0500 Subject: [PATCH] auto-announce objects from received Create activities --- routes/inbox.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/routes/inbox.js b/routes/inbox.js index 83151ac..97e6c05 100644 --- a/routes/inbox.js +++ b/routes/inbox.js @@ -22,6 +22,18 @@ router.post('/', net.validators.activity, net.security.verifySignature, function }) .catch(e => console.log(e)) break + case 'Create': + pub.actor.getOrCreateActor(req.user, true) + .then(user => { + const to = [user.followers] + const cc = [ + pub.utils.actorFromActivity(req.body), + 'https://www.w3.org/ns/activitystreams#Public' + ] + const accept = pub.activity.build('Announce', user.id, req.body.id, to, cc) + return pub.activity.addToOutbox(user, accept) + }).catch(e => console.log(e)) + break } Promise.all([ pub.object.resolve(req.body.object),