1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/scripts/settings/webSettings.js
2020-08-02 17:28:25 +09:00

46 lines
1.1 KiB
JavaScript

let data;
function getConfig() {
if (data) return Promise.resolve(data);
return fetch('config.json?nocache=' + new Date().getUTCMilliseconds()).then(response => {
data = response.json();
return data;
}).catch(error => {
console.warn('web config file is missing so the template will be used');
return getDefaultConfig();
});
}
function getDefaultConfig() {
return fetch('config.template.json').then(function (response) {
data = response.json();
return data;
});
}
export function getMultiServer() {
return getConfig().then(config => {
return config.multiserver;
}).catch(error => {
console.log('cannot get web config:', error);
return false;
});
}
export function getThemes() {
return getConfig().then(config => {
return config.themes;
}).catch(error => {
console.log('cannot get web config:', error);
return [];
});
}
export function getPlugins() {
return getConfig().then(config => {
return config.plugins;
}).catch(error => {
console.log('cannot get web config:', error);
return [];
});
}