1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

passed default theme handling to webSettings

This commit is contained in:
vitorsemeano 2020-11-07 11:56:46 +00:00
parent 03a6269b5f
commit 1171bc1cdf
2 changed files with 23 additions and 12 deletions

View file

@ -1,4 +1,3 @@
let data;
const urlResolver = document.createElement('a');
@ -86,12 +85,32 @@ export function getMultiServer() {
});
}
const defaultTheme = {
'name': 'Dark',
'id': 'dark',
'default': true
};
const checkDefaultTheme = (themes) => {
if (themes) {
const defaultTheme = themes.find((theme) => theme.default);
if (!defaultTheme) {
themes.push(defaultTheme);
}
return themes;
}
return [defaultTheme];
};
export function getThemes() {
return getConfig().then(config => {
return config.themes;
return checkDefaultTheme(Array.isArray(config.themes) ? config.themes : []);
}).catch(error => {
console.log('cannot get web config:', error);
return [];
return checkDefaultTheme();
});
}