aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/theme
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-04 13:31:41 +0200
committerChocobozzz <me@florianbigard.com>2021-06-04 15:45:44 +0200
commit2989628b7913383b39ac34c7db8666a21f8e5037 (patch)
treeac7759177c04e524e7845143fd685aefb49e810e /client/src/app/core/theme
parent8e08d415f9473b6b72fef698729453e726da16e7 (diff)
downloadPeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz
PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst
PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip
Use HTML config when possible
Diffstat (limited to 'client/src/app/core/theme')
-rw-r--r--client/src/app/core/theme/theme.service.ts19
1 files changed, 7 insertions, 12 deletions
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index e7a5ae17a..0c7dec0a1 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -1,7 +1,7 @@
1import { first } from 'rxjs/operators' 1import { first } from 'rxjs/operators'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { UserLocalStorageKeys } from '@root-helpers/users' 3import { UserLocalStorageKeys } from '@root-helpers/users'
4import { ServerConfig, ServerConfigTheme } from '@shared/models' 4import { HTMLServerConfig, ServerConfigTheme } from '@shared/models'
5import { environment } from '../../../environments/environment' 5import { environment } from '../../../environments/environment'
6import { AuthService } from '../auth' 6import { AuthService } from '../auth'
7import { PluginService } from '../plugins/plugin.service' 7import { PluginService } from '../plugins/plugin.service'
@@ -18,7 +18,7 @@ export class ThemeService {
18 private themeFromLocalStorage: ServerConfigTheme 18 private themeFromLocalStorage: ServerConfigTheme
19 private themeDOMLinksFromLocalStorage: HTMLLinkElement[] = [] 19 private themeDOMLinksFromLocalStorage: HTMLLinkElement[] = []
20 20
21 private serverConfig: ServerConfig 21 private serverConfig: HTMLServerConfig
22 22
23 constructor ( 23 constructor (
24 private auth: AuthService, 24 private auth: AuthService,
@@ -32,18 +32,13 @@ export class ThemeService {
32 // Try to load from local storage first, so we don't have to wait network requests 32 // Try to load from local storage first, so we don't have to wait network requests
33 this.loadAndSetFromLocalStorage() 33 this.loadAndSetFromLocalStorage()
34 34
35 this.serverConfig = this.server.getTmpConfig() 35 this.serverConfig = this.server.getHTMLConfig()
36 this.server.getConfig() 36 const themes = this.serverConfig.theme.registered
37 .subscribe(config => {
38 this.serverConfig = config
39 37
40 const themes = this.serverConfig.theme.registered 38 this.removeThemeFromLocalStorageIfNeeded(themes)
39 this.injectThemes(themes)
41 40
42 this.removeThemeFromLocalStorageIfNeeded(themes) 41 this.listenUserTheme()
43 this.injectThemes(themes)
44
45 this.listenUserTheme()
46 })
47 } 42 }
48 43
49 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) { 44 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) {