diff options
Diffstat (limited to 'server/lib/activitypub/context.ts')
-rw-r--r-- | server/lib/activitypub/context.ts | 16 |
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 @@ | |||
1 | import { ContextType } from '@shared/models' | 1 | import { ContextType } from '@shared/models' |
2 | import { Hooks } from '../plugins/hooks' | ||
2 | 3 | ||
3 | function activityPubContextify <T> (data: T, type: ContextType) { | 4 | async 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 | ||
168 | function getContextData (type: ContextType) { | 169 | async 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 | ||
174 | function buildContext (contextValue?: ContextValue) { | 178 | function buildContext (contextValue?: ContextValue) { |