aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/context.ts
diff options
context:
space:
mode:
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) {