auto-announce objects from received Create activities

This commit is contained in:
Will Murphy 2019-09-23 22:33:21 -05:00
parent a64c44ad46
commit 6e5453f0e2

View file

@ -22,6 +22,18 @@ router.post('/', net.validators.activity, net.security.verifySignature, function
}) })
.catch(e => console.log(e)) .catch(e => console.log(e))
break 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([ Promise.all([
pub.object.resolve(req.body.object), pub.object.resolve(req.body.object),