1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Stronger actor association typing in AP functions

This commit is contained in:
Chocobozzz 2019-08-09 08:17:16 +02:00
parent 511765c9f8
commit 5224c394b3
No known key found for this signature in database
GPG key ID: 583A612D890159BE
31 changed files with 146 additions and 89 deletions

View file

@ -16,6 +16,7 @@ import { processDislikeActivity } from './process-dislike'
import { processFlagActivity } from './process-flag'
import { processViewActivity } from './process-view'
import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
import { SignatureActorModel } from '../../../typings/models'
const processActivity: { [ P in ActivityType ]: (options: APProcessorOptions<Activity>) => Promise<any> } = {
Create: processCreateActivity,
@ -35,7 +36,7 @@ const processActivity: { [ P in ActivityType ]: (options: APProcessorOptions<Act
async function processActivities (
activities: Activity[],
options: {
signatureActor?: ActorModel
signatureActor?: SignatureActorModel
inboxActor?: ActorModel
outboxUrl?: string
fromFetch?: boolean
@ -43,7 +44,7 @@ async function processActivities (
) {
const { outboxUrl, signatureActor, inboxActor, fromFetch = false } = options
const actorsCache: { [ url: string ]: ActorModel } = {}
const actorsCache: { [ url: string ]: SignatureActorModel } = {}
for (const activity of activities) {
if (!signatureActor && [ 'Create', 'Announce', 'Like' ].includes(activity.type) === false) {