diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-10 12:01:21 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-10 14:42:18 +0100 |
commit | 866b5d3f5230204d611a556260102996c1aefe10 (patch) | |
tree | d6d1e900ce81a7f1edc121089c10a67abba855eb /server/models | |
parent | 4265d90b0061399e23b816e3880ee1be47ead96f (diff) | |
download | PeerTube-866b5d3f5230204d611a556260102996c1aefe10.tar.gz PeerTube-866b5d3f5230204d611a556260102996c1aefe10.tar.zst PeerTube-866b5d3f5230204d611a556260102996c1aefe10.zip |
Add ability for plugins to alter video jsonld
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/account.ts | 4 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 4 | ||||
-rw-r--r-- | server/models/video/video.ts | 9 |
3 files changed, 11 insertions, 6 deletions
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<Partial<AttributesOnly<AccountModel>>> { | |||
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | toActivityPubObject (this: MAccountAP) { | 450 | async toActivityPubObject (this: MAccountAP) { |
451 | const obj = this.Actor.toActivityPubObject(this.name) | 451 | const obj = await this.Actor.toActivityPubObject(this.name) |
452 | 452 | ||
453 | return Object.assign(obj, { | 453 | return Object.assign(obj, { |
454 | summary: this.description | 454 | 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<Partial<AttributesOnly<VideoChannel | |||
809 | return Object.assign(actor, videoChannel) | 809 | return Object.assign(actor, videoChannel) |
810 | } | 810 | } |
811 | 811 | ||
812 | toActivityPubObject (this: MChannelAP): ActivityPubActor { | 812 | async toActivityPubObject (this: MChannelAP): Promise<ActivityPubActor> { |
813 | const obj = this.Actor.toActivityPubObject(this.name) | 813 | const obj = await this.Actor.toActivityPubObject(this.name) |
814 | 814 | ||
815 | return Object.assign(obj, { | 815 | return Object.assign(obj, { |
816 | summary: this.description, | 816 | 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' | |||
137 | import { VideoSourceModel } from './video-source' | 137 | import { VideoSourceModel } from './video-source' |
138 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' | 138 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' |
139 | import { VideoTagModel } from './video-tag' | 139 | import { VideoTagModel } from './video-tag' |
140 | import { Hooks } from '@server/lib/plugins/hooks' | ||
140 | 141 | ||
141 | export enum ScopeNames { | 142 | export enum ScopeNames { |
142 | FOR_API = 'FOR_API', | 143 | FOR_API = 'FOR_API', |
@@ -1713,8 +1714,12 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1713 | return files | 1714 | return files |
1714 | } | 1715 | } |
1715 | 1716 | ||
1716 | toActivityPubObject (this: MVideoAP): VideoObject { | 1717 | toActivityPubObject (this: MVideoAP): Promise<VideoObject> { |
1717 | return videoModelToActivityPubObject(this) | 1718 | return Hooks.wrapObject( |
1719 | videoModelToActivityPubObject(this), | ||
1720 | 'filter:activity-pub.video.jsonld.build.result', | ||
1721 | { video: this } | ||
1722 | ) | ||
1718 | } | 1723 | } |
1719 | 1724 | ||
1720 | getTruncatedDescription () { | 1725 | getTruncatedDescription () { |