]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
Add ability for plugins to alter video jsonld
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / shared / metadata / video-attributes.component.ts
... / ...
CommitLineData
1import { Component, Input, OnInit } from '@angular/core'
2import { HooksService } from '@app/core'
3import { VideoDetails } from '@app/shared/shared-main'
4
5type PluginMetadata = {
6 label: string
7
8 value?: string
9 safeHTML?: string
10}
11
12@Component({
13 selector: 'my-video-attributes',
14 templateUrl: './video-attributes.component.html',
15 styleUrls: [ './video-attributes.component.scss' ]
16})
17export class VideoAttributesComponent implements OnInit {
18 @Input() video: VideoDetails
19
20 pluginMetadata: PluginMetadata[] = []
21
22 constructor (private hooks: HooksService) { }
23
24 async ngOnInit () {
25 this.pluginMetadata = await this.hooks.wrapObject(
26 this.pluginMetadata,
27 'video-watch',
28 'filter:video-watch.video-plugin-metadata.result',
29 { video: this.video }
30 )
31 }
32
33 getVideoHost () {
34 return this.video.channel.host
35 }
36
37 getVideoTags () {
38 if (!this.video || Array.isArray(this.video.tags) === false) return []
39
40 return this.video.tags
41 }
42}