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,11 +33,13 @@ middleware.verify = async function (req, res, next) {
return next(); return next();
} }
if (req.method === 'POST') {
const verified = await activitypub.verify(req); const verified = await activitypub.verify(req);
if (!verified && req.method === 'POST') { if (!verified) {
activitypub.helpers.log('[middleware/activitypub] HTTP signature verification failed.'); activitypub.helpers.log('[middleware/activitypub] HTTP signature verification failed.');
return res.sendStatus(400); return res.sendStatus(400);
} }
}
// Set calling user // Set calling user
if (req.headers.signature) { if (req.headers.signature) {