mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Log error on unknown hook
This commit is contained in:
@@ -8,7 +8,7 @@ import { RegisterHookOptions } from '@shared/models/plugins/register-hook.model'
|
||||
import { ReplaySubject } from 'rxjs'
|
||||
import { first, shareReplay } from 'rxjs/operators'
|
||||
import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'
|
||||
import { ClientHook, ClientHookName } from '@shared/models/plugins/client-hook.model'
|
||||
import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plugins/client-hook.model'
|
||||
import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
|
||||
|
||||
interface HookStructValue extends RegisterHookOptions {
|
||||
@@ -155,6 +155,11 @@ export class PluginService implements ClientHook {
|
||||
const { plugin, clientScript } = pluginInfo
|
||||
|
||||
const registerHook = (options: RegisterHookOptions) => {
|
||||
if (clientHookObject[options.target] !== true) {
|
||||
console.error('Unknown hook %s of plugin %s. Skipping.', options.target, plugin.name)
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.hooks[options.target]) this.hooks[options.target] = []
|
||||
|
||||
this.hooks[options.target].push({
|
||||
|
||||
@@ -79,6 +79,8 @@ export class SearchComponent implements OnInit, OnDestroy {
|
||||
|
||||
err => this.notifier.error(err.text)
|
||||
)
|
||||
|
||||
this.hooks.runAction('action:search.init')
|
||||
}
|
||||
|
||||
ngOnDestroy () {
|
||||
|
||||
@@ -69,8 +69,8 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
|
||||
this.videoService.getVideos.bind(this.videoService),
|
||||
params,
|
||||
'common',
|
||||
'filter:api.videos.list.local.params',
|
||||
'filter:api.videos.list.local.result'
|
||||
'filter:api.local-videos.videos.list.params',
|
||||
'filter:api.local-videos.videos.list.result'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
|
||||
this.videoService.getVideos.bind(this.videoService),
|
||||
params,
|
||||
'common',
|
||||
'filter:api.videos.list.recently-added.params',
|
||||
'filter:api.videos.list.recently-added.result'
|
||||
'filter:api.recently-added-videos.videos.list.params',
|
||||
'filter:api.recently-added-videos.videos.list.result'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
|
||||
this.videoService.getVideos.bind(this.videoService),
|
||||
params,
|
||||
'common',
|
||||
'filter:api.videos.list.trending.params',
|
||||
'filter:api.videos.list.trending.result'
|
||||
'filter:api.trending-videos.videos.list.params',
|
||||
'filter:api.trending-videos.videos.list.result'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
|
||||
this.videoService.getUserSubscriptionVideos.bind(this.videoService),
|
||||
params,
|
||||
'common',
|
||||
'filter:api.videos.list.user-subscriptions.params',
|
||||
'filter:api.videos.list.user-subscriptions.result'
|
||||
'filter:api.user-subscriptions-videos.videos.list.params',
|
||||
'filter:api.user-subscriptions-videos.videos.list.result'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user