aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/plugins/plugin.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-22 16:31:47 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit7663e55a2cc46a413bceee2787d48902b15ae642 (patch)
treec54d620617040642d962f9b8c74c7b8e2d745692 /client/src/app/core/plugins/plugin.service.ts
parente8f902c05cb35f6d5e9b75a23ddabd51c220a976 (diff)
downloadPeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.gz
PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.zst
PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.zip
Log error on unknown hook
Diffstat (limited to 'client/src/app/core/plugins/plugin.service.ts')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 7c1d69bec..90ebe5669 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -8,7 +8,7 @@ import { RegisterHookOptions } from '@shared/models/plugins/register-hook.model'
8import { ReplaySubject } from 'rxjs' 8import { ReplaySubject } from 'rxjs'
9import { first, shareReplay } from 'rxjs/operators' 9import { first, shareReplay } from 'rxjs/operators'
10import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' 10import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'
11import { ClientHook, ClientHookName } from '@shared/models/plugins/client-hook.model' 11import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plugins/client-hook.model'
12import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' 12import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
13 13
14interface HookStructValue extends RegisterHookOptions { 14interface HookStructValue extends RegisterHookOptions {
@@ -155,6 +155,11 @@ export class PluginService implements ClientHook {
155 const { plugin, clientScript } = pluginInfo 155 const { plugin, clientScript } = pluginInfo
156 156
157 const registerHook = (options: RegisterHookOptions) => { 157 const registerHook = (options: RegisterHookOptions) => {
158 if (clientHookObject[options.target] !== true) {
159 console.error('Unknown hook %s of plugin %s. Skipping.', options.target, plugin.name)
160 return
161 }
162
158 if (!this.hooks[options.target]) this.hooks[options.target] = [] 163 if (!this.hooks[options.target]) this.hooks[options.target] = []
159 164
160 this.hooks[options.target].push({ 165 this.hooks[options.target].push({