aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/core/plugins/hooks.service.ts10
-rw-r--r--client/src/app/core/plugins/plugin.service.ts3
-rw-r--r--client/src/app/login/login.component.html2
-rw-r--r--client/src/app/login/login.component.ts4
-rw-r--r--shared/models/plugins/client-hook.model.ts3
-rw-r--r--shared/models/plugins/plugin-client-scope.type.ts2
6 files changed, 14 insertions, 10 deletions
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 @@
1import { from, Observable } from 'rxjs'
2import { mergeMap, switchMap } from 'rxjs/operators'
1import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
2import { PluginService } from '@app/core/plugins/plugin.service' 4import { PluginService } from '@app/core/plugins/plugin.service'
3import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model' 5import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model'
4import { from, Observable } from 'rxjs'
5import { mergeMap, switchMap } from 'rxjs/operators'
6import { ServerService } from '@app/core/server'
7import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' 6import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
8 7
9type RawFunction<U, T> = (params: U) => T 8type RawFunction<U, T> = (params: U) => T
@@ -11,10 +10,7 @@ type ObservableFunction<U, T> = RawFunction<U, Observable<T>>
11 10
12@Injectable() 11@Injectable()
13export class HooksService { 12export class HooksService {
14 constructor ( 13 constructor (private pluginService: PluginService) { }
15 private server: ServerService,
16 private pluginService: PluginService
17 ) { }
18 14
19 wrapObsFun 15 wrapObsFun
20 <P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName> 16 <P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
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 {
47 common: new ReplaySubject<boolean>(1), 47 common: new ReplaySubject<boolean>(1),
48 search: new ReplaySubject<boolean>(1), 48 search: new ReplaySubject<boolean>(1),
49 'video-watch': new ReplaySubject<boolean>(1), 49 'video-watch': new ReplaySubject<boolean>(1),
50 signup: new ReplaySubject<boolean>(1) 50 signup: new ReplaySubject<boolean>(1),
51 login: new ReplaySubject<boolean>(1)
51 } 52 }
52 53
53 translationsObservable: Observable<PluginTranslation> 54 translationsObservable: Observable<PluginTranslation>
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index a935c86c3..599b203ae 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -8,7 +8,7 @@
8 </div> 8 </div>
9 9
10 <ng-container *ngIf="!externalAuthError && !isAuthenticatedWithExternalAuth"> 10 <ng-container *ngIf="!externalAuthError && !isAuthenticatedWithExternalAuth">
11 <div class="alert alert-info" *ngIf="signupAllowed === false" role="alert"> 11 <div class="looking-for-account alert alert-info" *ngIf="signupAllowed === false" role="alert">
12 <h6 class="alert-heading" i18n> 12 <h6 class="alert-heading" i18n>
13 If you are looking for an account… 13 If you are looking for an account…
14 </h6> 14 </h6>
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'
10import { ActivatedRoute } from '@angular/router' 10import { ActivatedRoute } from '@angular/router'
11import { ServerConfig, RegisteredExternalAuthConfig } from '@shared/models/server/server-config.model' 11import { ServerConfig, RegisteredExternalAuthConfig } from '@shared/models/server/server-config.model'
12import { environment } from 'src/environments/environment' 12import { environment } from 'src/environments/environment'
13import { HooksService } from '@app/core/plugins/hooks.service'
13 14
14@Component({ 15@Component({
15 selector: 'my-login', 16 selector: 'my-login',
@@ -40,6 +41,7 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
40 private userService: UserService, 41 private userService: UserService,
41 private redirectService: RedirectService, 42 private redirectService: RedirectService,
42 private notifier: Notifier, 43 private notifier: Notifier,
44 private hooks: HooksService,
43 private i18n: I18n 45 private i18n: I18n
44 ) { 46 ) {
45 super() 47 super()
@@ -78,6 +80,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
78 if (this.usernameInput) { 80 if (this.usernameInput) {
79 this.usernameInput.nativeElement.focus() 81 this.usernameInput.nativeElement.focus()
80 } 82 }
83
84 this.hooks.runAction('action:login.init', 'login')
81 } 85 }
82 86
83 getExternalLogins () { 87 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 = {
70 // Fired when a user click on 'View x replies' and they're loaded 70 // Fired when a user click on 'View x replies' and they're loaded
71 'action:video-watch.video-thread-replies.loaded': true, 71 'action:video-watch.video-thread-replies.loaded': true,
72 72
73 // Fired when the login page is being initialized
74 'action:login.init': true,
75
73 // Fired when the search page is being initialized 76 // Fired when the search page is being initialized
74 'action:search.init': true, 77 'action:search.init': true,
75 78
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'