1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Improve activity pub actors implementation

This commit is contained in:
Chocobozzz 2018-03-22 18:40:33 +01:00
parent 9e841674da
commit 6be84cbcea
No known key found for this signature in database
GPG key ID: 583A612D890159BE
9 changed files with 32 additions and 12 deletions

View file

@ -5,6 +5,7 @@ import * as url from 'url'
import * as uuidv4 from 'uuid/v4'
import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'
import { getActorUrl } from '../../helpers/activitypub'
import { isActorObjectValid } from '../../helpers/custom-validators/activitypub/actor'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils'
@ -34,7 +35,9 @@ function setAsyncActorKeys (actor: ActorModel) {
})
}
async function getOrCreateActorAndServerAndModel (actorUrl: string, recurseIfNeeded = true) {
async function getOrCreateActorAndServerAndModel (activityActor: string | ActivityPubActor, recurseIfNeeded = true) {
const actorUrl = getActorUrl(activityActor)
let actor = await ActorModel.loadByUrl(actorUrl)
// We don't have this actor in our database, fetch it on remote