mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
Merge pull request #1795 from MrTimscampi/themes-fix
Fix themes not loading unless signed in
This commit is contained in:
commit
98d8566aad
@ -3,6 +3,10 @@ import skinManager from 'skinManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import events from 'events';
|
||||
|
||||
// Set the default theme when loading
|
||||
skinManager.setTheme(userSettings.theme());
|
||||
|
||||
// Set the user's prefered theme when signing in
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
skinManager.setTheme(userSettings.theme());
|
||||
});
|
||||
|
@ -1,21 +1,40 @@
|
||||
let data;
|
||||
|
||||
function getConfig() {
|
||||
async 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();
|
||||
try {
|
||||
const response = await fetch('config.json', {
|
||||
cache: 'no-cache'
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('network response was not ok');
|
||||
}
|
||||
|
||||
function getDefaultConfig() {
|
||||
return fetch('config.template.json').then(function (response) {
|
||||
data = response.json();
|
||||
data = await response.json();
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.warn('failed to fetch the web config file:', error);
|
||||
return getDefaultConfig();
|
||||
}
|
||||
}
|
||||
|
||||
async function getDefaultConfig() {
|
||||
try {
|
||||
const response = await fetch('config.template.json', {
|
||||
cache: 'no-cache'
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('network response was not ok');
|
||||
}
|
||||
|
||||
data = await response.json();
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error('failed to fetch the default web config file:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export function getMultiServer() {
|
||||
|
Loading…
Reference in New Issue
Block a user