Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add ability to override login signup message

Chocobozzzf375bb3db401
diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts
index a6a444c326..2fbf406d11 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<U, T> = (params: U) => T
@@ -11,10 +10,7 @@ type ObservableFunction<U, T> = RawFunction<U, Observable<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>
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 3ed23160df..c6efcac6d3 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<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>
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index a935c86c37..599b203ae7 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -8,7 +8,7 @@
</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>
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 5d935cb49d..fff4b43f6f 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 62f6070d79..b53b8de99c 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 1c6d884f0f..d112434e89 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'