import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
-import { ServerConfig, UserRight, VideoConstant } from '@shared/models'
+import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
const logger = debug('peertube:menu:MenuComponent')
commonMenuLinks: MenuLink[] = []
private languages: VideoConstant<string>[] = []
+
+ private htmlServerConfig: HTMLServerConfig
private serverConfig: ServerConfig
+
private routesPerRight: { [role in UserRight]?: string } = {
[UserRight.MANAGE_USERS]: '/admin/users',
[UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',
}
get instanceName () {
- return this.serverConfig.instance.name
+ return this.htmlServerConfig.instance.name
}
ngOnInit () {
- this.serverConfig = this.serverService.getTmpConfig()
- this.serverService.getConfig()
- .subscribe(config => {
- this.serverConfig = config
- this.buildMenuLinks()
- })
+ this.htmlServerConfig = this.serverService.getHTMLConfig()
+ this.buildMenuLinks()
this.isLoggedIn = this.authService.isLoggedIn()
if (this.isLoggedIn === true) {
}
isRegistrationAllowed () {
+ if (!this.serverConfig) return false
+
return this.serverConfig.signup.allowed &&
this.serverConfig.signup.allowedForCurrentIP
}
}
private buildMenuLinks () {
- this.commonMenuLinks = this.menuService.buildCommonLinks(this.serverConfig)
+ this.commonMenuLinks = this.menuService.buildCommonLinks(this.htmlServerConfig)
}
private buildUserLanguages () {