From 3b504f6ed4e890bebb46d0481aba15b43050323a 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/lib/activitypub/send/http.ts | 4 ++-- server/lib/activitypub/send/send-create.ts | 2 +- server/lib/activitypub/send/send-update.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'server/lib/activitypub/send') diff --git a/server/lib/activitypub/send/http.ts b/server/lib/activitypub/send/http.ts index d8d0b8542..ad7869853 100644 --- a/server/lib/activitypub/send/http.ts +++ b/server/lib/activitypub/send/http.ts @@ -52,9 +52,9 @@ function buildGlobalHeaders (body: any) { } } -function signAndContextify (byActor: MActor, data: T, contextType: ContextType | null) { +async function signAndContextify (byActor: MActor, data: T, contextType: ContextType | null) { const activity = contextType - ? activityPubContextify(data, contextType) + ? await activityPubContextify(data, contextType) : data return signJsonLDObject(byActor, activity) diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts index 7c3a6bdd0..0e996ab80 100644 --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts @@ -33,7 +33,7 @@ async function sendCreateVideo (video: MVideoAP, transaction: Transaction) { logger.info('Creating job to send video creation of %s.', video.url, lTags(video.uuid)) const byActor = video.VideoChannel.Account.Actor - const videoObject = video.toActivityPubObject() + const videoObject = await video.toActivityPubObject() const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC) const createActivity = buildCreateActivity(video.url, byActor, videoObject, audience) diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 24983dd19..5a66294e6 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts @@ -36,7 +36,7 @@ async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, transaction: T video.VideoCaptions = await video.$get('VideoCaptions', { transaction }) } - const videoObject = video.toActivityPubObject() + const videoObject = await video.toActivityPubObject() const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC) const updateActivity = buildUpdateActivity(url, byActor, videoObject, audience) -- cgit v1.2.3