diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts index a6a444c32..2fbf406d1 100644 --- a/client/src/app/core/plugins/hooks.service.ts +++ b/client/src/app/core/plugins/hooks.service.ts @@ -1,9 +1,8 @@ +import { from, Observable } from 'rxjs' +import { mergeMap, switchMap } from 'rxjs/operators' import { Injectable } from '@angular/core' import { PluginService } from '@app/core/plugins/plugin.service' import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model' -import { from, Observable } from 'rxjs' -import { mergeMap, switchMap } from 'rxjs/operators' -import { ServerService } from '@app/core/server' import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' type RawFunction = (params: U) => T @@ -11,10 +10,7 @@ type ObservableFunction = RawFunction> @Injectable() export class HooksService { - constructor ( - private server: ServerService, - private pluginService: PluginService - ) { } + constructor (private pluginService: PluginService) { } wrapObsFun
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 3ed23160d..c6efcac6d 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -47,7 +47,8 @@ export class PluginService implements ClientHook {
common: new ReplaySubject
If you are looking for an account…
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 5d935cb49..fff4b43f6 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -10,6 +10,7 @@ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
import { ActivatedRoute } from '@angular/router'
import { ServerConfig, RegisteredExternalAuthConfig } from '@shared/models/server/server-config.model'
import { environment } from 'src/environments/environment'
+import { HooksService } from '@app/core/plugins/hooks.service'
@Component({
selector: 'my-login',
@@ -40,6 +41,7 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
private userService: UserService,
private redirectService: RedirectService,
private notifier: Notifier,
+ private hooks: HooksService,
private i18n: I18n
) {
super()
@@ -78,6 +80,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
if (this.usernameInput) {
this.usernameInput.nativeElement.focus()
}
+
+ this.hooks.runAction('action:login.init', 'login')
}
getExternalLogins () {
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client-hook.model.ts
index 62f6070d7..b53b8de99 100644
--- a/shared/models/plugins/client-hook.model.ts
+++ b/shared/models/plugins/client-hook.model.ts
@@ -70,6 +70,9 @@ export const clientActionHookObject = {
// Fired when a user click on 'View x replies' and they're loaded
'action:video-watch.video-thread-replies.loaded': true,
+ // Fired when the login page is being initialized
+ 'action:login.init': true,
+
// Fired when the search page is being initialized
'action:search.init': true,
diff --git a/shared/models/plugins/plugin-client-scope.type.ts b/shared/models/plugins/plugin-client-scope.type.ts
index 1c6d884f0..d112434e8 100644
--- a/shared/models/plugins/plugin-client-scope.type.ts
+++ b/shared/models/plugins/plugin-client-scope.type.ts
@@ -1 +1 @@
-export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup'
+export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup' | 'login'