]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/context.ts
Translated using Weblate (Persian)
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / context.ts
index 5308d32feda5e98dd73fb6e4bfd5d2c42f08e00b..a3ca52a31569227246b5eff8816e474bc751eab9 100644 (file)
@@ -1,7 +1,8 @@
 import { ContextType } from '@shared/models'
+import { Hooks } from '../plugins/hooks'
 
-function activityPubContextify <T> (data: T, type: ContextType) {
-  return { ...getContextData(type), ...data }
+async function activityPubContextify <T> (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) {