diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 14:39:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | fc21ef5c62d845576a916414468b3a57370a57b2 (patch) | |
tree | 818102bc909210870f9a28692361f7b5cbe219de /client/src/app/app.component.ts | |
parent | 2989628b7913383b39ac34c7db8666a21f8e5037 (diff) | |
download | PeerTube-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.ts | 19 |
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 @@ | |||
1 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 1 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
2 | import { concat } from 'rxjs' | 2 | import { filter, map, pairwise, switchMap } from 'rxjs/operators' |
3 | import { filter, first, map, pairwise, switchMap } from 'rxjs/operators' | ||
4 | import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common' | 3 | import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common' |
5 | import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' | 4 | import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' |
6 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' | 5 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' |
@@ -14,7 +13,7 @@ import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' | |||
14 | import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap' | 13 | import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap' |
15 | import { LoadingBarService } from '@ngx-loading-bar/core' | 14 | import { LoadingBarService } from '@ngx-loading-bar/core' |
16 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 15 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
17 | import { getShortLocale, is18nPath } from '@shared/core-utils/i18n' | 16 | import { getShortLocale } from '@shared/core-utils/i18n' |
18 | import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models' | 17 | import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models' |
19 | import { MenuService } from './core/menu/menu.service' | 18 | import { MenuService } from './core/menu/menu.service' |
20 | import { POP_STATE_MODAL_DISMISS } from './helpers' | 19 | import { 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( |