mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -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 connectionManager from 'connectionManager';
|
||||||
import events from 'events';
|
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) {
|
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||||
skinManager.setTheme(userSettings.theme());
|
skinManager.setTheme(userSettings.theme());
|
||||||
});
|
});
|
||||||
|
@ -1,21 +1,40 @@
|
|||||||
let data;
|
let data;
|
||||||
|
|
||||||
function getConfig() {
|
async function getConfig() {
|
||||||
if (data) return Promise.resolve(data);
|
if (data) return Promise.resolve(data);
|
||||||
return fetch('config.json?nocache=' + new Date().getUTCMilliseconds()).then(response => {
|
try {
|
||||||
data = response.json();
|
const response = await fetch('config.json', {
|
||||||
return data;
|
cache: 'no-cache'
|
||||||
}).catch(error => {
|
|
||||||
console.warn('web config file is missing so the template will be used');
|
|
||||||
return getDefaultConfig();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('network response was not ok');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultConfig() {
|
data = await response.json();
|
||||||
return fetch('config.template.json').then(function (response) {
|
|
||||||
data = response.json();
|
|
||||||
return data;
|
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() {
|
export function getMultiServer() {
|
||||||
|
Loading…
Reference in New Issue
Block a user