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

Handle correctly formatted AP attributedTo

This commit is contained in:
Chocobozzz 2023-06-05 16:18:57 +02:00
parent cefe22cf7c
commit 7f7e9d4e90
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 41 additions and 28 deletions

View file

@ -18,8 +18,7 @@ import {
MVideoThumbnail
} from '@server/types/models'
import { ActivityTagObject, ThumbnailType, VideoObject, VideoStreamingPlaylistType } from '@shared/models'
import { getOrCreateAPActor } from '../../actors'
import { checkUrlsSameHost } from '../../url'
import { findOwner, getOrCreateAPActor } from '../../actors'
import {
getCaptionAttributesFromObject,
getFileAttributesFromUrl,
@ -37,13 +36,9 @@ export abstract class APVideoAbstractBuilder {
protected abstract lTags: LoggerTagsFn
protected async getOrCreateVideoChannelFromVideoObject () {
const channel = this.videoObject.attributedTo.find(a => a.type === 'Group')
const channel = await findOwner(this.videoObject.id, this.videoObject.attributedTo, 'Group')
if (!channel) throw new Error('Cannot find associated video channel to video ' + this.videoObject.url)
if (checkUrlsSameHost(channel.id, this.videoObject.id) !== true) {
throw new Error(`Video channel url ${channel.id} does not have the same host than video object id ${this.videoObject.id}`)
}
return getOrCreateAPActor(channel.id, 'all')
}