import { ServerService } from '@app/core/server'
import { environment } from '../../../environments/environment'
import { PluginService } from '@app/core/plugins/plugin.service'
-import { ServerConfigTheme } from '@shared/models'
+import { ServerConfig, ServerConfigTheme } from '@shared/models'
import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage'
import { first } from 'rxjs/operators'
private themeFromLocalStorage: ServerConfigTheme
private themeDOMLinksFromLocalStorage: HTMLLinkElement[] = []
+ private serverConfig: ServerConfig
+
constructor (
private auth: AuthService,
private pluginService: PluginService,
// Try to load from local storage first, so we don't have to wait network requests
this.loadAndSetFromLocalStorage()
- this.server.configLoaded
- .subscribe(() => {
- const themes = this.server.getConfig().theme.registered
+ this.serverConfig = this.server.getTmpConfig()
+ this.server.getConfig()
+ .subscribe(config => {
+ this.serverConfig = config
+
+ const themes = this.serverConfig.theme.registered
this.removeThemeFromLocalStorageIfNeeded(themes)
this.injectThemes(themes)
if (theme !== 'instance-default') return theme
}
- return this.server.getConfig().theme.default
+ return this.serverConfig.theme.default
}
private loadTheme (name: string) {