1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Add ability for plugins to alter video jsonld

This commit is contained in:
Chocobozzz 2023-03-10 12:01:21 +01:00
parent 4899138ec5
commit 3b504f6ed4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
16 changed files with 91 additions and 94 deletions

View 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 }
}
// ---------------------------------------------------------------------------
@ -165,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) {