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