]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/app.component.ts
Fix subscribe hotkey
[github/Chocobozzz/PeerTube.git] / client / src / app / app.component.ts
index 6884068f6da8e3a1801ca7905bf44d07aac0373c..c1e2961820a255a08f8664669bfccb6b6df67ef3 100644 (file)
@@ -1,7 +1,6 @@
 import { Hotkey, HotkeysService } from 'angular2-hotkeys'
-import { concat } from 'rxjs'
-import { filter, first, map, pairwise, switchMap } from 'rxjs/operators'
-import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common'
+import { filter, map, pairwise, switchMap } from 'rxjs/operators'
+import { DOCUMENT, getLocaleDirection, PlatformLocation, ViewportScroller } from '@angular/common'
 import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
 import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
 import { Event, GuardsCheckStart, NavigationEnd, RouteConfigLoadEnd, RouteConfigLoadStart, Router, Scroll } from '@angular/router'
@@ -14,7 +13,7 @@ import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
 import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap'
 import { LoadingBarService } from '@ngx-loading-bar/core'
 import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
-import { getShortLocale, is18nPath } from '@shared/core-utils/i18n'
+import { getShortLocale } from '@shared/core-utils/i18n'
 import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models'
 import { MenuService } from './core/menu/menu.service'
 import { POP_STATE_MODAL_DISMISS } from './helpers'
@@ -75,7 +74,7 @@ export class AppComponent implements OnInit, AfterViewInit {
 
     this.serverConfig = this.serverService.getHTMLConfig()
 
-    this.loadPlugins()
+    this.hooks.runAction('action:application.init', 'common')
     this.themeService.initialize()
 
     this.authService.loadClientCredentials()
@@ -108,6 +107,7 @@ export class AppComponent implements OnInit, AfterViewInit {
     this.openModalsIfNeeded()
 
     this.document.documentElement.lang = getShortLocale(this.localeId)
+    this.document.documentElement.dir = getLocaleDirection(this.localeId)
   }
 
   ngAfterViewInit () {
@@ -190,12 +190,6 @@ export class AppComponent implements OnInit, AfterViewInit {
                         }
                       })
 
-    // Homepage redirection
-    navigationEndEvent.pipe(
-      map(() => window.location.pathname),
-      filter(pathname => !pathname || pathname === '/' || is18nPath(pathname))
-    ).subscribe(() => this.redirectService.redirectToHomepage(true))
-
     // Plugin hooks
     navigationEndEvent.subscribe(e => {
       this.hooks.runAction('action:router.navigation-end', 'common', { path: e.url })
@@ -268,12 +262,6 @@ export class AppComponent implements OnInit, AfterViewInit {
     }
   }
 
-  private async loadPlugins () {
-    this.pluginService.initializePlugins()
-
-    this.hooks.runAction('action:application.init', 'common')
-  }
-
   private async openModalsIfNeeded () {
     this.authService.userInformationLoaded
         .pipe(