+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<U, T> = (params: U) => T
@Injectable()
export class HooksService {
- constructor (
- private server: ServerService,
- private pluginService: PluginService
- ) { }
+ constructor (private pluginService: PluginService) { }
wrapObsFun
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
common: new ReplaySubject<boolean>(1),
search: new ReplaySubject<boolean>(1),
'video-watch': new ReplaySubject<boolean>(1),
- signup: new ReplaySubject<boolean>(1)
+ signup: new ReplaySubject<boolean>(1),
+ login: new ReplaySubject<boolean>(1)
}
translationsObservable: Observable<PluginTranslation>
</div>
<ng-container *ngIf="!externalAuthError && !isAuthenticatedWithExternalAuth">
- <div class="alert alert-info" *ngIf="signupAllowed === false" role="alert">
+ <div class="looking-for-account alert alert-info" *ngIf="signupAllowed === false" role="alert">
<h6 class="alert-heading" i18n>
If you are looking for an account…
</h6>
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',
private userService: UserService,
private redirectService: RedirectService,
private notifier: Notifier,
+ private hooks: HooksService,
private i18n: I18n
) {
super()
if (this.usernameInput) {
this.usernameInput.nativeElement.focus()
}
+
+ this.hooks.runAction('action:login.init', 'login')
}
getExternalLogins () {
// 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,
-export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup'
+export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup' | 'login'