aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/context.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-03-10 12:01:21 +0100
committerChocobozzz <me@florianbigard.com>2023-03-10 14:42:18 +0100
commit866b5d3f5230204d611a556260102996c1aefe10 (patch)
treed6d1e900ce81a7f1edc121089c10a67abba855eb /server/lib/activitypub/context.ts
parent4265d90b0061399e23b816e3880ee1be47ead96f (diff)
downloadPeerTube-866b5d3f5230204d611a556260102996c1aefe10.tar.gz
PeerTube-866b5d3f5230204d611a556260102996c1aefe10.tar.zst
PeerTube-866b5d3f5230204d611a556260102996c1aefe10.zip
Add ability for plugins to alter video jsonld
Diffstat (limited to 'server/lib/activitypub/context.ts')
-rw-r--r--server/lib/activitypub/context.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/server/lib/activitypub/context.ts b/server/lib/activitypub/context.ts
index 349c4d227..a3ca52a31 100644
--- a/server/lib/activitypub/context.ts
+++ b/server/lib/activitypub/context.ts
@@ -1,7 +1,8 @@
1import { ContextType } from '@shared/models' 1import { ContextType } from '@shared/models'
2import { Hooks } from '../plugins/hooks'
2 3
3function activityPubContextify <T> (data: T, type: ContextType) { 4async function activityPubContextify <T> (data: T, type: ContextType) {
4 return { ...getContextData(type), ...data } 5 return { ...await getContextData(type), ...data }
5} 6}
6 7
7// --------------------------------------------------------------------------- 8// ---------------------------------------------------------------------------
@@ -165,10 +166,13 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string
165 Rate: buildContext() 166 Rate: buildContext()
166} 167}
167 168
168function getContextData (type: ContextType) { 169async function getContextData (type: ContextType) {
169 return { 170 const contextData = await Hooks.wrapObject(
170 '@context': contextStore[type] 171 contextStore[type],
171 } 172 'filter:activity-pub.activity.context.build.result'
173 )
174
175 return { '@context': contextData }
172} 176}
173 177
174function buildContext (contextValue?: ContextValue) { 178function buildContext (contextValue?: ContextValue) {