diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-15 15:58:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-16 10:08:55 +0100 |
commit | a9bfa85d2cdf13670aaced740da5b493fbeddfce (patch) | |
tree | 3781c9218d4cc7786b6589365c0efbed2151703d /client/src/app/app.component.ts | |
parent | c77fdc605b3ccc1ab6890f889d8200fbe9372949 (diff) | |
download | PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.gz PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.zst PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.zip |
Add ability for admins to set default p2p policy
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r-- | client/src/app/app.component.ts | 17 |
1 files changed, 16 insertions, 1 deletions
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 { | |||
14 | ScrollService, | 14 | ScrollService, |
15 | ServerService, | 15 | ServerService, |
16 | ThemeService, | 16 | ThemeService, |
17 | User | 17 | User, |
18 | UserLocalStorageService | ||
18 | } from '@app/core' | 19 | } from '@app/core' |
19 | import { HooksService } from '@app/core/plugins/hooks.service' | 20 | import { HooksService } from '@app/core/plugins/hooks.service' |
20 | import { PluginService } from '@app/core/plugins/plugin.service' | 21 | import { PluginService } from '@app/core/plugins/plugin.service' |
@@ -70,6 +71,7 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
70 | private ngbConfig: NgbConfig, | 71 | private ngbConfig: NgbConfig, |
71 | private loadingBar: LoadingBarService, | 72 | private loadingBar: LoadingBarService, |
72 | private scrollService: ScrollService, | 73 | private scrollService: ScrollService, |
74 | private userLocalStorage: UserLocalStorageService, | ||
73 | public menu: MenuService | 75 | public menu: MenuService |
74 | ) { | 76 | ) { |
75 | this.ngbConfig.animation = false | 77 | this.ngbConfig.animation = false |
@@ -86,6 +88,8 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
86 | ngOnInit () { | 88 | ngOnInit () { |
87 | document.getElementById('incompatible-browser').className += ' browser-ok' | 89 | document.getElementById('incompatible-browser').className += ' browser-ok' |
88 | 90 | ||
91 | this.loadUser() | ||
92 | |||
89 | this.serverConfig = this.serverService.getHTMLConfig() | 93 | this.serverConfig = this.serverService.getHTMLConfig() |
90 | 94 | ||
91 | this.hooks.runAction('action:application.init', 'common') | 95 | this.hooks.runAction('action:application.init', 'common') |
@@ -300,4 +304,15 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
300 | }, undefined, $localize`Go to the videos upload page`) | 304 | }, undefined, $localize`Go to the videos upload page`) |
301 | ]) | 305 | ]) |
302 | } | 306 | } |
307 | |||
308 | private loadUser () { | ||
309 | const tokens = this.userLocalStorage.getTokens() | ||
310 | if (!tokens) return | ||
311 | |||
312 | const user = this.userLocalStorage.getLoggedInUser() | ||
313 | if (!user) return | ||
314 | |||
315 | // Initialize user | ||
316 | this.authService.buildAuthUser(user, tokens) | ||
317 | } | ||
303 | } | 318 | } |