activities = activities.filter(a => isActivityValid(a))
logger.debug('We keep %d activities.', activities.length, { activities })
- await processActivities(activities, res.locals.account)
+ await processActivities(activities, res.locals.signature.account, res.locals.account)
res.status(204).end()
}
Like: processLikeActivity
}
-async function processActivities (activities: Activity[], inboxAccount?: AccountInstance) {
+async function processActivities (activities: Activity[], signatureAccount?: AccountInstance, inboxAccount?: AccountInstance) {
for (const activity of activities) {
+ // When we fetch remote data, we don't have signature
+ if (signatureAccount && activity.actor !== signatureAccount.url) {
+ logger.warn('Signature mismatch between %s and %s.', activity.actor, signatureAccount.url)
+ continue
+ }
+
const activityProcessor = processActivity[activity.type]
if (activityProcessor === undefined) {
logger.warn('Unknown activity type %s.', activity.type, { activityId: activity.id })