mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Allow client custom css and disabling global server custom css.
This commit is contained in:
parent
1794ab53fe
commit
8cae67d9b9
6 changed files with 108 additions and 25 deletions
|
@ -21,6 +21,9 @@ const defaultSubtitleAppearanceSettings = {
|
|||
|
||||
export class UserSettings {
|
||||
constructor() {
|
||||
this._userSetPromise = new Promise(resolve => {
|
||||
this._userSetPromiseResolve = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +39,11 @@ export class UserSettings {
|
|||
this.currentUserId = userId;
|
||||
this.currentApiClient = apiClient;
|
||||
|
||||
if (this._userSetPromiseResolve) {
|
||||
this._userSetPromiseResolve();
|
||||
this._userSetPromiseResolve = null;
|
||||
}
|
||||
|
||||
if (!userId) {
|
||||
this.displayPrefs = null;
|
||||
return Promise.resolve();
|
||||
|
@ -59,6 +67,14 @@ export class UserSettings {
|
|||
this.displayPrefs = instance.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows waiting until the user id is set.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
userIsSet() {
|
||||
return this._userSetPromise;
|
||||
}
|
||||
|
||||
// FIXME: 'appSettings.set' doesn't return any value
|
||||
/**
|
||||
* Set value of setting.
|
||||
|
@ -239,6 +255,33 @@ export class UserSettings {
|
|||
return val === 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'disableCustomCss' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'disableCustomCss' or undefined.
|
||||
* @return {boolean} 'disableCustomCss' state.
|
||||
*/
|
||||
disableCustomCss(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('disableCustomCss', val.toString(), false);
|
||||
}
|
||||
|
||||
val = this.get('disableCustomCss', false);
|
||||
return val === 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set customCss.
|
||||
* @param {string|undefined} val - Language.
|
||||
* @return {string} Language.
|
||||
*/
|
||||
customCss(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('customCss', val.toString(), false);
|
||||
}
|
||||
|
||||
return this.get('customCss', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Details Banner' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Details Banner' or undefined.
|
||||
|
@ -511,3 +554,5 @@ export const getSubtitleAppearanceSettings = currentSettings.getSubtitleAppearan
|
|||
export const setSubtitleAppearanceSettings = currentSettings.setSubtitleAppearanceSettings.bind(currentSettings);
|
||||
export const setFilter = currentSettings.setFilter.bind(currentSettings);
|
||||
export const getFilter = currentSettings.getFilter.bind(currentSettings);
|
||||
export const customCss = currentSettings.customCss.bind(currentSettings);
|
||||
export const disableCustomCss = currentSettings.disableCustomCss.bind(currentSettings);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue