From 866b5d3f5230204d611a556260102996c1aefe10 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Mar 2023 12:01:21 +0100 Subject: Add ability for plugins to alter video jsonld --- server/models/account/account.ts | 4 ++-- server/models/video/video-channel.ts | 4 ++-- server/models/video/video.ts | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'server/models') diff --git a/server/models/account/account.ts b/server/models/account/account.ts index dc989417b..5bf29f45a 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -447,8 +447,8 @@ export class AccountModel extends Model>> { } } - toActivityPubObject (this: MAccountAP) { - const obj = this.Actor.toActivityPubObject(this.name) + async toActivityPubObject (this: MAccountAP) { + const obj = await this.Actor.toActivityPubObject(this.name) return Object.assign(obj, { summary: this.description diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index b71f5a197..67fccab68 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -809,8 +809,8 @@ export class VideoChannelModel extends Model { + const obj = await this.Actor.toActivityPubObject(this.name) return Object.assign(obj, { summary: this.description, diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1a10d2da2..7fe2ec293 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -137,6 +137,7 @@ import { VideoShareModel } from './video-share' import { VideoSourceModel } from './video-source' import { VideoStreamingPlaylistModel } from './video-streaming-playlist' import { VideoTagModel } from './video-tag' +import { Hooks } from '@server/lib/plugins/hooks' export enum ScopeNames { FOR_API = 'FOR_API', @@ -1713,8 +1714,12 @@ export class VideoModel extends Model>> { return files } - toActivityPubObject (this: MVideoAP): VideoObject { - return videoModelToActivityPubObject(this) + toActivityPubObject (this: MVideoAP): Promise { + return Hooks.wrapObject( + videoModelToActivityPubObject(this), + 'filter:activity-pub.video.jsonld.build.result', + { video: this } + ) } getTruncatedDescription () { -- cgit v1.2.3