diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-22 16:31:47 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 7663e55a2cc46a413bceee2787d48902b15ae642 (patch) | |
tree | c54d620617040642d962f9b8c74c7b8e2d745692 /client/src/app/core | |
parent | e8f902c05cb35f6d5e9b75a23ddabd51c220a976 (diff) | |
download | PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.gz PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.zst PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.zip |
Log error on unknown hook
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/plugins/plugin.service.ts | 7 |
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' | |||
8 | import { ReplaySubject } from 'rxjs' | 8 | import { ReplaySubject } from 'rxjs' |
9 | import { first, shareReplay } from 'rxjs/operators' | 9 | import { first, shareReplay } from 'rxjs/operators' |
10 | import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' | 10 | import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' |
11 | import { ClientHook, ClientHookName } from '@shared/models/plugins/client-hook.model' | 11 | import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plugins/client-hook.model' |
12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' | 12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' |
13 | 13 | ||
14 | interface HookStructValue extends RegisterHookOptions { | 14 | interface 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({ |