X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fcontext.ts;h=a3ca52a31569227246b5eff8816e474bc751eab9;hb=d4fff51d96925b5704c97dd673dd779030b1aced;hp=5308d32feda5e98dd73fb6e4bfd5d2c42f08e00b;hpb=3d2e4f037125deb4711616ef6f9fa463b432ff3d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/context.ts b/server/lib/activitypub/context.ts index 5308d32fe..a3ca52a31 100644 --- a/server/lib/activitypub/context.ts +++ b/server/lib/activitypub/context.ts @@ -1,7 +1,8 @@ import { ContextType } from '@shared/models' +import { Hooks } from '../plugins/hooks' -function activityPubContextify (data: T, type: ContextType) { - return { ...getContextData(type), ...data } +async function activityPubContextify (data: T, type: ContextType) { + return { ...await getContextData(type), ...data } } // --------------------------------------------------------------------------- @@ -127,7 +128,14 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string playlists: { '@id': 'pt:playlists', '@type': '@id' - } + }, + support: { + '@type': 'sc:Text', + '@id': 'pt:support' + }, + + // TODO: remove in a few versions, introduced in 4.2 + icons: 'as:icon' }), WatchAction: buildContext({ @@ -158,10 +166,13 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string Rate: buildContext() } -function getContextData (type: ContextType) { - return { - '@context': contextStore[type] - } +async function getContextData (type: ContextType) { + const contextData = await Hooks.wrapObject( + contextStore[type], + 'filter:activity-pub.activity.context.build.result' + ) + + return { '@context': contextData } } function buildContext (contextValue?: ContextValue) {