diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-10 14:06:19 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | ffb321bedca46d6987c7b31dd58e5dea96ea2ea2 (patch) | |
tree | 019f0427c1860ae0b00694c43f1be8d5fe1aa995 /server/lib/plugins/theme-utils.ts | |
parent | 7cd4d2ba10106c10602c86f74f55743ded588896 (diff) | |
download | PeerTube-ffb321bedca46d6987c7b31dd58e5dea96ea2ea2.tar.gz PeerTube-ffb321bedca46d6987c7b31dd58e5dea96ea2ea2.tar.zst PeerTube-ffb321bedca46d6987c7b31dd58e5dea96ea2ea2.zip |
WIP plugins: load theme on client side
Diffstat (limited to 'server/lib/plugins/theme-utils.ts')
-rw-r--r-- | server/lib/plugins/theme-utils.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/lib/plugins/theme-utils.ts b/server/lib/plugins/theme-utils.ts index 066339e65..76c671f1c 100644 --- a/server/lib/plugins/theme-utils.ts +++ b/server/lib/plugins/theme-utils.ts | |||
@@ -1,18 +1,18 @@ | |||
1 | import { DEFAULT_THEME } from '../../initializers/constants' | 1 | import { DEFAULT_THEME_NAME, DEFAULT_USER_THEME_NAME } from '../../initializers/constants' |
2 | import { PluginManager } from './plugin-manager' | 2 | import { PluginManager } from './plugin-manager' |
3 | import { CONFIG } from '../../initializers/config' | 3 | import { CONFIG } from '../../initializers/config' |
4 | 4 | ||
5 | function getThemeOrDefault (name: string) { | 5 | function getThemeOrDefault (name: string, defaultTheme: string) { |
6 | if (isThemeRegistered(name)) return name | 6 | if (isThemeRegistered(name)) return name |
7 | 7 | ||
8 | // Fallback to admin default theme | 8 | // Fallback to admin default theme |
9 | if (name !== CONFIG.THEME.DEFAULT) return getThemeOrDefault(CONFIG.THEME.DEFAULT) | 9 | if (name !== CONFIG.THEME.DEFAULT) return getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME) |
10 | 10 | ||
11 | return DEFAULT_THEME | 11 | return defaultTheme |
12 | } | 12 | } |
13 | 13 | ||
14 | function isThemeRegistered (name: string) { | 14 | function isThemeRegistered (name: string) { |
15 | if (name === DEFAULT_THEME) return true | 15 | if (name === DEFAULT_THEME_NAME || name === DEFAULT_USER_THEME_NAME) return true |
16 | 16 | ||
17 | return !!PluginManager.Instance.getRegisteredThemes() | 17 | return !!PluginManager.Instance.getRegisteredThemes() |
18 | .find(r => r.name === name) | 18 | .find(r => r.name === name) |