From a9bfa85d2cdf13670aaced740da5b493fbeddfce Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 15 Dec 2021 15:58:10 +0100 Subject: Add ability for admins to set default p2p policy --- client/src/app/app.component.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'client/src/app/app.component.ts') diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 95af89b19..a60138af9 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -14,7 +14,8 @@ import { ScrollService, ServerService, ThemeService, - User + User, + UserLocalStorageService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' import { PluginService } from '@app/core/plugins/plugin.service' @@ -70,6 +71,7 @@ export class AppComponent implements OnInit, AfterViewInit { private ngbConfig: NgbConfig, private loadingBar: LoadingBarService, private scrollService: ScrollService, + private userLocalStorage: UserLocalStorageService, public menu: MenuService ) { this.ngbConfig.animation = false @@ -86,6 +88,8 @@ export class AppComponent implements OnInit, AfterViewInit { ngOnInit () { document.getElementById('incompatible-browser').className += ' browser-ok' + this.loadUser() + this.serverConfig = this.serverService.getHTMLConfig() this.hooks.runAction('action:application.init', 'common') @@ -300,4 +304,15 @@ export class AppComponent implements OnInit, AfterViewInit { }, undefined, $localize`Go to the videos upload page`) ]) } + + private loadUser () { + const tokens = this.userLocalStorage.getTokens() + if (!tokens) return + + const user = this.userLocalStorage.getLoggedInUser() + if (!user) return + + // Initialize user + this.authService.buildAuthUser(user, tokens) + } } -- cgit v1.2.3