mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
Enable custom css on login pages until a user with it disabled logs in.
This commit is contained in:
parent
b8f8633ffd
commit
99c902a1a1
@ -217,30 +217,42 @@ function onAppReady() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cssHasLoadedTrigger;
|
||||||
|
const cssHasLoadedPromise = new Promise(resolve => {
|
||||||
|
cssHasLoadedTrigger = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
|
const apiClient = ServerConnections.currentApiClient();
|
||||||
|
if (apiClient) {
|
||||||
|
fetch(apiClient.getUrl('Branding/Css'))
|
||||||
|
.then(function(response) {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(response.status + ' ' + response.statusText);
|
||||||
|
}
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(function(css) {
|
||||||
|
let style = document.querySelector('#cssBranding');
|
||||||
|
if (!style) {
|
||||||
|
// Inject the branding css as a dom element in body so it will take
|
||||||
|
// precedence over other stylesheets
|
||||||
|
style = document.createElement('style');
|
||||||
|
style.id = 'cssBranding';
|
||||||
|
document.body.appendChild(style);
|
||||||
|
}
|
||||||
|
style.textContent = css;
|
||||||
|
cssHasLoadedTrigger(style);
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
console.warn('Error applying custom css', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
currentSettings.userIsSet().then(() => {
|
currentSettings.userIsSet().then(() => {
|
||||||
const apiClient = ServerConnections.currentApiClient();
|
if (currentSettings.disableCustomCss()) {
|
||||||
if (apiClient && !currentSettings.disableCustomCss()) {
|
cssHasLoadedPromise.then(style => {
|
||||||
fetch(apiClient.getUrl('Branding/Css'))
|
style.textContent = '';
|
||||||
.then(function(response) {
|
});
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(response.status + ' ' + response.statusText);
|
|
||||||
}
|
|
||||||
return response.text();
|
|
||||||
})
|
|
||||||
.then(function(css) {
|
|
||||||
let style = document.querySelector('#cssBranding');
|
|
||||||
if (!style) {
|
|
||||||
// Inject the branding css as a dom element in body so it will take
|
|
||||||
// precedence over other stylesheets
|
|
||||||
style = document.createElement('style');
|
|
||||||
style.id = 'cssBranding';
|
|
||||||
document.body.appendChild(style);
|
|
||||||
}
|
|
||||||
style.textContent = css;
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
console.warn('Error applying custom css', err);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const localCss = currentSettings.customCss();
|
const localCss = currentSettings.customCss();
|
||||||
|
Loading…
Reference in New Issue
Block a user