X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2Fmenu%2Fmenu.component.ts;h=c767f19b27186f957905802063127e747fd36e80;hb=2989628b7913383b39ac34c7db8666a21f8e5037;hp=2f7e0cf07bea2699929d169934e03fdfc62b2d25;hpb=8e08d415f9473b6b72fef698729453e726da16e7;p=github%2FChocobozzz%2FPeerTube.git 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' 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') @@ -48,7 +48,10 @@ export class MenuComponent implements OnInit { commonMenuLinks: MenuLink[] = [] private languages: VideoConstant[] = [] + + private htmlServerConfig: HTMLServerConfig private serverConfig: ServerConfig + private routesPerRight: { [role in UserRight]?: string } = { [UserRight.MANAGE_USERS]: '/admin/users', [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', @@ -86,16 +89,12 @@ export class MenuComponent implements OnInit { } 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) { @@ -148,6 +147,8 @@ export class MenuComponent implements OnInit { } isRegistrationAllowed () { + if (!this.serverConfig) return false + return this.serverConfig.signup.allowed && this.serverConfig.signup.allowedForCurrentIP } @@ -257,7 +258,7 @@ export class MenuComponent implements OnInit { } private buildMenuLinks () { - this.commonMenuLinks = this.menuService.buildCommonLinks(this.serverConfig) + this.commonMenuLinks = this.menuService.buildCommonLinks(this.htmlServerConfig) } private buildUserLanguages () {