aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
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
parente8f902c05cb35f6d5e9b75a23ddabd51c220a976 (diff)
downloadPeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.gz
PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.zst
PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.zip
Log error on unknown hook
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts7
-rw-r--r--client/src/app/search/search.component.ts2
-rw-r--r--client/src/app/videos/video-list/video-local.component.ts4
-rw-r--r--client/src/app/videos/video-list/video-recently-added.component.ts4
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts4
-rw-r--r--client/src/app/videos/video-list/video-user-subscriptions.component.ts4
6 files changed, 16 insertions, 9 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({
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index 55637771e..691e57619 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -79,6 +79,8 @@ export class SearchComponent implements OnInit, OnDestroy {
79 79
80 err => this.notifier.error(err.text) 80 err => this.notifier.error(err.text)
81 ) 81 )
82
83 this.hooks.runAction('action:search.init')
82 } 84 }
83 85
84 ngOnDestroy () { 86 ngOnDestroy () {
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts
index 81b6ce493..b96e46e6a 100644
--- a/client/src/app/videos/video-list/video-local.component.ts
+++ b/client/src/app/videos/video-list/video-local.component.ts
@@ -69,8 +69,8 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
69 this.videoService.getVideos.bind(this.videoService), 69 this.videoService.getVideos.bind(this.videoService),
70 params, 70 params,
71 'common', 71 'common',
72 'filter:api.videos.list.local.params', 72 'filter:api.local-videos.videos.list.params',
73 'filter:api.videos.list.local.result' 73 'filter:api.local-videos.videos.list.result'
74 ) 74 )
75 } 75 }
76 76
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts
index 638e7caed..5c50fd396 100644
--- a/client/src/app/videos/video-list/video-recently-added.component.ts
+++ b/client/src/app/videos/video-list/video-recently-added.component.ts
@@ -61,8 +61,8 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
61 this.videoService.getVideos.bind(this.videoService), 61 this.videoService.getVideos.bind(this.videoService),
62 params, 62 params,
63 'common', 63 'common',
64 'filter:api.videos.list.recently-added.params', 64 'filter:api.recently-added-videos.videos.list.params',
65 'filter:api.videos.list.recently-added.result' 65 'filter:api.recently-added-videos.videos.list.result'
66 ) 66 )
67 } 67 }
68 68
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts
index 0e69bfd64..19324da63 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -74,8 +74,8 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
74 this.videoService.getVideos.bind(this.videoService), 74 this.videoService.getVideos.bind(this.videoService),
75 params, 75 params,
76 'common', 76 'common',
77 'filter:api.videos.list.trending.params', 77 'filter:api.trending-videos.videos.list.params',
78 'filter:api.videos.list.trending.result' 78 'filter:api.trending-videos.videos.list.result'
79 ) 79 )
80 } 80 }
81 81
diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts
index ac325aeff..b36c85766 100644
--- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts
+++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts
@@ -57,8 +57,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
57 this.videoService.getUserSubscriptionVideos.bind(this.videoService), 57 this.videoService.getUserSubscriptionVideos.bind(this.videoService),
58 params, 58 params,
59 'common', 59 'common',
60 'filter:api.videos.list.user-subscriptions.params', 60 'filter:api.user-subscriptions-videos.videos.list.params',
61 'filter:api.videos.list.user-subscriptions.result' 61 'filter:api.user-subscriptions-videos.videos.list.result'
62 ) 62 )
63 } 63 }
64 64