Add AP proxy endpoint

This commit is contained in:
Yarmo Mackenbach 2022-10-01 09:53:36 +02:00
parent c992b4fe28
commit 007282ef22
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -246,4 +246,26 @@ router.get(
} }
) )
// ActivityPub route
router.get(
'/get/activitypub',
query('username').isString(),
query('domain').isFQDN(),
async (req, res) => {
const errors = validationResult(req)
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() })
}
fetcher.activitypub
.fn(req.query, opts)
.then((data) => {
return res.status(200).send(data)
})
.catch((err) => {
return res.status(400).json({ errors: err.message ? err.message : err })
})
}
)
module.exports = router module.exports = router