PeerTube/server/lib/activitypub/fetch.ts

24 lines
602 B
TypeScript
Raw Normal View History

import { logger } from '../../helpers/logger'
import { getServerActor } from '../../helpers/utils'
2017-12-14 17:38:41 +01:00
import { ActorModel } from '../../models/activitypub/actor'
import { JobQueue } from '../job-queue'
2017-11-22 10:29:55 +01:00
async function addFetchOutboxJob (actor: ActorModel) {
// Don't fetch ourselves
const serverActor = await getServerActor()
if (serverActor.id === actor.id) {
logger.error('Cannot fetch our own outbox!')
return
}
const payload = {
2017-12-14 17:38:41 +01:00
uris: [ actor.outboxUrl ]
2017-11-22 10:29:55 +01:00
}
return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })
2017-11-22 10:29:55 +01:00
}
export {
addFetchOutboxJob
}