aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/plugins/plugin.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-20 16:18:16 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-21 15:39:51 +0200
commit7294aab0c879ef96c0fde15c389a2c4c1463d3c7 (patch)
treebad1176720ee04266eba5470e9956e3a7871e349 /client/src/app/core/plugins/plugin.service.ts
parentf95628636b6ccdf3eae2449ca718e075b072f678 (diff)
downloadPeerTube-7294aab0c879ef96c0fde15c389a2c4c1463d3c7.tar.gz
PeerTube-7294aab0c879ef96c0fde15c389a2c4c1463d3c7.tar.zst
PeerTube-7294aab0c879ef96c0fde15c389a2c4c1463d3c7.zip
Add ability to set custom field to video form
Diffstat (limited to 'client/src/app/core/plugins/plugin.service.ts')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 871613b89..4e44a1865 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -9,7 +9,7 @@ import { RestExtractor } from '@app/core/rest'
9import { ServerService } from '@app/core/server/server.service' 9import { ServerService } from '@app/core/server/server.service'
10import { getDevLocale, isOnDevLocale } from '@app/helpers' 10import { getDevLocale, isOnDevLocale } from '@app/helpers'
11import { CustomModalComponent } from '@app/modal/custom-modal.component' 11import { CustomModalComponent } from '@app/modal/custom-modal.component'
12import { Hooks, loadPlugin, PluginInfo, runHook } from '@root-helpers/plugins' 12import { FormFields, Hooks, loadPlugin, PluginInfo, runHook } from '@root-helpers/plugins'
13import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n' 13import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
14import { 14import {
15 ClientHook, 15 ClientHook,
@@ -36,6 +36,7 @@ export class PluginService implements ClientHook {
36 'video-watch': new ReplaySubject<boolean>(1), 36 'video-watch': new ReplaySubject<boolean>(1),
37 signup: new ReplaySubject<boolean>(1), 37 signup: new ReplaySubject<boolean>(1),
38 login: new ReplaySubject<boolean>(1), 38 login: new ReplaySubject<boolean>(1),
39 'video-edit': new ReplaySubject<boolean>(1),
39 embed: new ReplaySubject<boolean>(1) 40 embed: new ReplaySubject<boolean>(1)
40 } 41 }
41 42
@@ -50,6 +51,9 @@ export class PluginService implements ClientHook {
50 private loadingScopes: { [id in PluginClientScope]?: boolean } = {} 51 private loadingScopes: { [id in PluginClientScope]?: boolean } = {}
51 52
52 private hooks: Hooks = {} 53 private hooks: Hooks = {}
54 private formFields: FormFields = {
55 video: []
56 }
53 57
54 constructor ( 58 constructor (
55 private authService: AuthService, 59 private authService: AuthService,
@@ -188,9 +192,18 @@ export class PluginService implements ClientHook {
188 : PluginType.THEME 192 : PluginType.THEME
189 } 193 }
190 194
195 getRegisteredVideoFormFields (type: 'import-url' | 'import-torrent' | 'upload' | 'update') {
196 return this.formFields.video.filter(f => f.videoFormOptions.type === type)
197 }
198
191 private loadPlugin (pluginInfo: PluginInfo) { 199 private loadPlugin (pluginInfo: PluginInfo) {
192 return this.zone.runOutsideAngular(() => { 200 return this.zone.runOutsideAngular(() => {
193 return loadPlugin(this.hooks, pluginInfo, pluginInfo => this.buildPeerTubeHelpers(pluginInfo)) 201 return loadPlugin({
202 hooks: this.hooks,
203 formFields: this.formFields,
204 pluginInfo,
205 peertubeHelpersFactory: pluginInfo => this.buildPeerTubeHelpers(pluginInfo)
206 })
194 }) 207 })
195 } 208 }
196 209