+ private async openModalsIfNeeded () {
+ this.authService.userInformationLoaded
+ .pipe(
+ map(() => this.authService.getUser()),
+ filter(user => user.role === UserRole.ADMINISTRATOR)
+ ).subscribe(user => setTimeout(() => this._openAdminModalsIfNeeded(user))) // setTimeout because of ngIf in template
+ }
+
+ private async _openAdminModalsIfNeeded (user: User) {
+ if (user.noWelcomeModal !== true) return this.welcomeModal.show()
+
+ if (user.noInstanceConfigWarningModal === true || !this.serverConfig.signup.allowed) return
+
+ this.instanceService.getAbout()
+ .subscribe(about => {
+ if (
+ this.serverConfig.instance.name.toLowerCase() === 'peertube' ||
+ !about.instance.terms ||
+ !about.instance.administrator ||
+ !about.instance.maintenanceLifetime
+ ) {
+ this.instanceConfigWarningModal.show(about)
+ }
+ })
+ }
+
+ private initHotkeys () {
+ this.hotkeysService.add([
+ new Hotkey(['/', 's'], (event: KeyboardEvent): boolean => {
+ document.getElementById('search-video').focus()
+ return false
+ }, undefined, this.i18n('Focus the search bar')),
+
+ new Hotkey('b', (event: KeyboardEvent): boolean => {
+ this.menu.toggleMenu()
+ return false
+ }, undefined, this.i18n('Toggle the left menu')),
+
+ new Hotkey('g o', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/videos/overview' ])
+ return false
+ }, undefined, this.i18n('Go to the discover videos page')),
+
+ new Hotkey('g t', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/videos/trending' ])
+ return false
+ }, undefined, this.i18n('Go to the trending videos page')),
+
+ new Hotkey('g r', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/videos/recently-added' ])
+ return false
+ }, undefined, this.i18n('Go to the recently added videos page')),
+
+ new Hotkey('g l', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/videos/local' ])
+ return false
+ }, undefined, this.i18n('Go to the local videos page')),