aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-04 14:39:47 +0200
committerChocobozzz <me@florianbigard.com>2021-06-04 15:45:44 +0200
commitfc21ef5c62d845576a916414468b3a57370a57b2 (patch)
tree818102bc909210870f9a28692361f7b5cbe219de /client/src/app/app.component.ts
parent2989628b7913383b39ac34c7db8666a21f8e5037 (diff)
downloadPeerTube-fc21ef5c62d845576a916414468b3a57370a57b2.tar.gz
PeerTube-fc21ef5c62d845576a916414468b3a57370a57b2.tar.zst
PeerTube-fc21ef5c62d845576a916414468b3a57370a57b2.zip
Speed up plugins loading
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts19
1 files changed, 3 insertions, 16 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 6884068f6..2056d6669 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,6 +1,5 @@
1import { Hotkey, HotkeysService } from 'angular2-hotkeys' 1import { Hotkey, HotkeysService } from 'angular2-hotkeys'
2import { concat } from 'rxjs' 2import { filter, map, pairwise, switchMap } from 'rxjs/operators'
3import { filter, first, map, pairwise, switchMap } from 'rxjs/operators'
4import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common' 3import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common'
5import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' 4import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
6import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 5import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
@@ -14,7 +13,7 @@ import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
14import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap' 13import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap'
15import { LoadingBarService } from '@ngx-loading-bar/core' 14import { LoadingBarService } from '@ngx-loading-bar/core'
16import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 15import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
17import { getShortLocale, is18nPath } from '@shared/core-utils/i18n' 16import { getShortLocale } from '@shared/core-utils/i18n'
18import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models' 17import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models'
19import { MenuService } from './core/menu/menu.service' 18import { MenuService } from './core/menu/menu.service'
20import { POP_STATE_MODAL_DISMISS } from './helpers' 19import { POP_STATE_MODAL_DISMISS } from './helpers'
@@ -75,7 +74,7 @@ export class AppComponent implements OnInit, AfterViewInit {
75 74
76 this.serverConfig = this.serverService.getHTMLConfig() 75 this.serverConfig = this.serverService.getHTMLConfig()
77 76
78 this.loadPlugins() 77 this.hooks.runAction('action:application.init', 'common')
79 this.themeService.initialize() 78 this.themeService.initialize()
80 79
81 this.authService.loadClientCredentials() 80 this.authService.loadClientCredentials()
@@ -190,12 +189,6 @@ export class AppComponent implements OnInit, AfterViewInit {
190 } 189 }
191 }) 190 })
192 191
193 // Homepage redirection
194 navigationEndEvent.pipe(
195 map(() => window.location.pathname),
196 filter(pathname => !pathname || pathname === '/' || is18nPath(pathname))
197 ).subscribe(() => this.redirectService.redirectToHomepage(true))
198
199 // Plugin hooks 192 // Plugin hooks
200 navigationEndEvent.subscribe(e => { 193 navigationEndEvent.subscribe(e => {
201 this.hooks.runAction('action:router.navigation-end', 'common', { path: e.url }) 194 this.hooks.runAction('action:router.navigation-end', 'common', { path: e.url })
@@ -268,12 +261,6 @@ export class AppComponent implements OnInit, AfterViewInit {
268 } 261 }
269 } 262 }
270 263
271 private async loadPlugins () {
272 this.pluginService.initializePlugins()
273
274 this.hooks.runAction('action:application.init', 'common')
275 }
276
277 private async openModalsIfNeeded () { 264 private async openModalsIfNeeded () {
278 this.authService.userInformationLoaded 265 this.authService.userInformationLoaded
279 .pipe( 266 .pipe(