aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/menu')
-rw-r--r--client/src/app/menu/menu.component.ts19
1 files changed, 10 insertions, 9 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 2f7e0cf07..c767f19b2 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -20,7 +20,7 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
20import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' 20import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
21import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service' 21import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
22import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 22import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
23import { ServerConfig, UserRight, VideoConstant } from '@shared/models' 23import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
24 24
25const logger = debug('peertube:menu:MenuComponent') 25const logger = debug('peertube:menu:MenuComponent')
26 26
@@ -48,7 +48,10 @@ export class MenuComponent implements OnInit {
48 commonMenuLinks: MenuLink[] = [] 48 commonMenuLinks: MenuLink[] = []
49 49
50 private languages: VideoConstant<string>[] = [] 50 private languages: VideoConstant<string>[] = []
51
52 private htmlServerConfig: HTMLServerConfig
51 private serverConfig: ServerConfig 53 private serverConfig: ServerConfig
54
52 private routesPerRight: { [role in UserRight]?: string } = { 55 private routesPerRight: { [role in UserRight]?: string } = {
53 [UserRight.MANAGE_USERS]: '/admin/users', 56 [UserRight.MANAGE_USERS]: '/admin/users',
54 [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', 57 [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',
@@ -86,16 +89,12 @@ export class MenuComponent implements OnInit {
86 } 89 }
87 90
88 get instanceName () { 91 get instanceName () {
89 return this.serverConfig.instance.name 92 return this.htmlServerConfig.instance.name
90 } 93 }
91 94
92 ngOnInit () { 95 ngOnInit () {
93 this.serverConfig = this.serverService.getTmpConfig() 96 this.htmlServerConfig = this.serverService.getHTMLConfig()
94 this.serverService.getConfig() 97 this.buildMenuLinks()
95 .subscribe(config => {
96 this.serverConfig = config
97 this.buildMenuLinks()
98 })
99 98
100 this.isLoggedIn = this.authService.isLoggedIn() 99 this.isLoggedIn = this.authService.isLoggedIn()
101 if (this.isLoggedIn === true) { 100 if (this.isLoggedIn === true) {
@@ -148,6 +147,8 @@ export class MenuComponent implements OnInit {
148 } 147 }
149 148
150 isRegistrationAllowed () { 149 isRegistrationAllowed () {
150 if (!this.serverConfig) return false
151
151 return this.serverConfig.signup.allowed && 152 return this.serverConfig.signup.allowed &&
152 this.serverConfig.signup.allowedForCurrentIP 153 this.serverConfig.signup.allowedForCurrentIP
153 } 154 }
@@ -257,7 +258,7 @@ export class MenuComponent implements OnInit {
257 } 258 }
258 259
259 private buildMenuLinks () { 260 private buildMenuLinks () {
260 this.commonMenuLinks = this.menuService.buildCommonLinks(this.serverConfig) 261 this.commonMenuLinks = this.menuService.buildCommonLinks(this.htmlServerConfig)
261 } 262 }
262 263
263 private buildUserLanguages () { 264 private buildUserLanguages () {