refactor: call verify if request is POST

This commit is contained in:
Barış Soner Uşaklı
2025-05-12 10:28:26 -04:00
parent 16504bad81
commit dfa213298b

View File

@@ -33,10 +33,12 @@ middleware.verify = async function (req, res, next) {
return next();
}
const verified = await activitypub.verify(req);
if (!verified && req.method === 'POST') {
activitypub.helpers.log('[middleware/activitypub] HTTP signature verification failed.');
return res.sendStatus(400);
if (req.method === 'POST') {
const verified = await activitypub.verify(req);
if (!verified) {
activitypub.helpers.log('[middleware/activitypub] HTTP signature verification failed.');
return res.sendStatus(400);
}
}
// Set calling user