mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix default values for invalid config.json files
This commit is contained in:
parent
78fec5e880
commit
9dd1683892
1 changed files with 22 additions and 6 deletions
|
@ -78,7 +78,7 @@ async function getDefaultConfig() {
|
||||||
|
|
||||||
export function getIncludeCorsCredentials() {
|
export function getIncludeCorsCredentials() {
|
||||||
return getConfig()
|
return getConfig()
|
||||||
.then(config => config.includeCorsCredentials)
|
.then(config => !!config.includeCorsCredentials)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log('cannot get web config:', error);
|
console.log('cannot get web config:', error);
|
||||||
return false;
|
return false;
|
||||||
|
@ -87,7 +87,7 @@ export function getIncludeCorsCredentials() {
|
||||||
|
|
||||||
export function getMultiServer() {
|
export function getMultiServer() {
|
||||||
return getConfig().then(config => {
|
return getConfig().then(config => {
|
||||||
return config.multiserver;
|
return !!config.multiserver;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('cannot get web config:', error);
|
console.log('cannot get web config:', error);
|
||||||
return false;
|
return false;
|
||||||
|
@ -126,23 +126,39 @@ const checkDefaultTheme = (themes) => {
|
||||||
|
|
||||||
export function getThemes() {
|
export function getThemes() {
|
||||||
return getConfig().then(config => {
|
return getConfig().then(config => {
|
||||||
const themes = Array.isArray(config.themes) ? config.themes : [];
|
const themes = Array.isArray(config.themes) ? config.themes : [ baseDefaultTheme ];
|
||||||
checkDefaultTheme(themes);
|
checkDefaultTheme(themes);
|
||||||
return themes;
|
return themes;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('cannot get web config:', error);
|
console.log('cannot get web config:', error);
|
||||||
checkDefaultTheme();
|
checkDefaultTheme();
|
||||||
return [];
|
return [ baseDefaultTheme ];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDefaultTheme = () => internalDefaultTheme;
|
export const getDefaultTheme = () => internalDefaultTheme;
|
||||||
|
|
||||||
|
const defaultPlugins = [
|
||||||
|
'playAccessValidation/plugin',
|
||||||
|
'experimentalWarnings/plugin',
|
||||||
|
'htmlAudioPlayer/plugin',
|
||||||
|
'htmlVideoPlayer/plugin',
|
||||||
|
'photoPlayer/plugin',
|
||||||
|
'comicsPlayer/plugin',
|
||||||
|
'bookPlayer/plugin',
|
||||||
|
'youtubePlayer/plugin',
|
||||||
|
'backdropScreensaver/plugin',
|
||||||
|
'pdfPlayer/plugin',
|
||||||
|
'logoScreensaver/plugin',
|
||||||
|
'sessionPlayer/plugin',
|
||||||
|
'chromecastPlayer/plugin'
|
||||||
|
];
|
||||||
|
|
||||||
export function getPlugins() {
|
export function getPlugins() {
|
||||||
return getConfig().then(config => {
|
return getConfig().then(config => {
|
||||||
return config.plugins;
|
return config.plugins || defaultPlugins;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('cannot get web config:', error);
|
console.log('cannot get web config:', error);
|
||||||
return [];
|
return defaultPlugins;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue