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:
parent
4899138ec5
commit
3b504f6ed4
16 changed files with 91 additions and 94 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue