mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixed bugs for default theme handling
fixed import for headroom.js
This commit is contained in:
parent
194bbf1ff1
commit
b23e625c20
3 changed files with 30 additions and 17 deletions
|
@ -85,35 +85,41 @@ export function getMultiServer() {
|
|||
});
|
||||
}
|
||||
|
||||
const defaultTheme = {
|
||||
const baseDefaultTheme = {
|
||||
'name': 'Dark',
|
||||
'id': 'dark',
|
||||
'default': true
|
||||
};
|
||||
|
||||
let internalDefaultTheme = baseDefaultTheme;
|
||||
|
||||
const checkDefaultTheme = (themes) => {
|
||||
if (themes) {
|
||||
const defaultTheme = themes.find((theme) => theme.default);
|
||||
|
||||
if (!defaultTheme) {
|
||||
themes.push(defaultTheme);
|
||||
if (defaultTheme) {
|
||||
internalDefaultTheme = defaultTheme;
|
||||
return;
|
||||
}
|
||||
|
||||
return themes;
|
||||
}
|
||||
|
||||
return [defaultTheme];
|
||||
internalDefaultTheme = baseDefaultTheme;
|
||||
};
|
||||
|
||||
export function getThemes() {
|
||||
return getConfig().then(config => {
|
||||
return checkDefaultTheme(Array.isArray(config.themes) ? config.themes : []);
|
||||
const themes = Array.isArray(config.themes) ? config.themes : [];
|
||||
checkDefaultTheme(themes);
|
||||
return themes;
|
||||
}).catch(error => {
|
||||
console.log('cannot get web config:', error);
|
||||
return checkDefaultTheme();
|
||||
checkDefaultTheme();
|
||||
return [];
|
||||
});
|
||||
}
|
||||
|
||||
export const getDefaultTheme = () => internalDefaultTheme;
|
||||
|
||||
export function getPlugins() {
|
||||
return getConfig().then(config => {
|
||||
return config.plugins;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue