mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update variable declerations for appSettings and userSettings
This commit is contained in:
parent
f296eb3475
commit
0473e549ab
2 changed files with 14 additions and 14 deletions
|
@ -28,7 +28,7 @@ import events from 'events';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
|
export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
|
||||||
var key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
|
const key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
|
||||||
if (val !== undefined) {
|
if (val !== undefined) {
|
||||||
if (isInNetwork && mediaType === 'Audio') {
|
if (isInNetwork && mediaType === 'Audio') {
|
||||||
val = true;
|
val = true;
|
||||||
|
@ -45,7 +45,7 @@ import events from 'events';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function maxStreamingBitrate(isInNetwork, mediaType, val) {
|
export function maxStreamingBitrate(isInNetwork, mediaType, val) {
|
||||||
var key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
|
const key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
|
||||||
if (val !== undefined) {
|
if (val !== undefined) {
|
||||||
if (isInNetwork && mediaType === 'Audio') {
|
if (isInNetwork && mediaType === 'Audio') {
|
||||||
// nothing to do, this is always a max value
|
// nothing to do, this is always a max value
|
||||||
|
@ -67,7 +67,7 @@ import events from 'events';
|
||||||
this.set('maxStaticMusicBitrate', val);
|
this.set('maxStaticMusicBitrate', val);
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultValue = 320000;
|
const defaultValue = 320000;
|
||||||
return parseInt(this.get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
|
return parseInt(this.get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ import events from 'events';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function set(name, value, userId) {
|
export function set(name, value, userId) {
|
||||||
var currentValue = this.get(name, userId);
|
const currentValue = this.get(name, userId);
|
||||||
appStorage.setItem(getKey(name, userId), value);
|
appStorage.setItem(getKey(name, userId), value);
|
||||||
|
|
||||||
if (currentValue !== value) {
|
if (currentValue !== value) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import appSettings from 'appSettings';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
|
|
||||||
function onSaveTimeout() {
|
function onSaveTimeout() {
|
||||||
var self = this;
|
const self = this;
|
||||||
self.saveTimeout = null;
|
self.saveTimeout = null;
|
||||||
self.currentApiClient.updateDisplayPreferences('usersettings', self.displayPrefs, self.currentUserId, 'emby');
|
self.currentApiClient.updateDisplayPreferences('usersettings', self.displayPrefs, self.currentUserId, 'emby');
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ export class UserSettings {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
|
|
||||||
return apiClient.getDisplayPreferences('usersettings', userId, 'emby').then(function (result) {
|
return apiClient.getDisplayPreferences('usersettings', userId, 'emby').then(function (result) {
|
||||||
result.CustomPrefs = result.CustomPrefs || {};
|
result.CustomPrefs = result.CustomPrefs || {};
|
||||||
|
@ -63,9 +63,9 @@ export class UserSettings {
|
||||||
* @param {boolean} enableOnServer - Flag to save preferences on server.
|
* @param {boolean} enableOnServer - Flag to save preferences on server.
|
||||||
*/
|
*/
|
||||||
set(name, value, enableOnServer) {
|
set(name, value, enableOnServer) {
|
||||||
var userId = this.currentUserId;
|
const userId = this.currentUserId;
|
||||||
var currentValue = this.get(name, enableOnServer);
|
const currentValue = this.get(name, enableOnServer);
|
||||||
var result = appSettings.set(name, value, userId);
|
const result = appSettings.set(name, value, userId);
|
||||||
|
|
||||||
if (enableOnServer !== false && this.displayPrefs) {
|
if (enableOnServer !== false && this.displayPrefs) {
|
||||||
this.displayPrefs.CustomPrefs[name] = value == null ? value : value.toString();
|
this.displayPrefs.CustomPrefs[name] = value == null ? value : value.toString();
|
||||||
|
@ -86,7 +86,7 @@ export class UserSettings {
|
||||||
* @return {string} Value of setting.
|
* @return {string} Value of setting.
|
||||||
*/
|
*/
|
||||||
get(name, enableOnServer) {
|
get(name, enableOnServer) {
|
||||||
var userId = this.currentUserId;
|
const userId = this.currentUserId;
|
||||||
if (enableOnServer !== false && this.displayPrefs) {
|
if (enableOnServer !== false && this.displayPrefs) {
|
||||||
return this.displayPrefs.CustomPrefs[name];
|
return this.displayPrefs.CustomPrefs[name];
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ export class UserSettings {
|
||||||
* @return {Object|Promise} Configuration or Promise.
|
* @return {Object|Promise} Configuration or Promise.
|
||||||
*/
|
*/
|
||||||
serverConfig(config) {
|
serverConfig(config) {
|
||||||
var apiClient = this.currentApiClient;
|
const apiClient = this.currentApiClient;
|
||||||
if (config) {
|
if (config) {
|
||||||
return apiClient.updateUserConfiguration(this.currentUserId, config);
|
return apiClient.updateUserConfiguration(this.currentUserId, config);
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ export class UserSettings {
|
||||||
return this.set('libraryPageSize', parseInt(val, 10), false);
|
return this.set('libraryPageSize', parseInt(val, 10), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var libraryPageSize = parseInt(this.get('libraryPageSize', false), 10);
|
const libraryPageSize = parseInt(this.get('libraryPageSize', false), 10);
|
||||||
if (libraryPageSize === 0) {
|
if (libraryPageSize === 0) {
|
||||||
// Explicitly return 0 to avoid returning 100 because 0 is falsy.
|
// Explicitly return 0 to avoid returning 100 because 0 is falsy.
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -378,7 +378,7 @@ export class UserSettings {
|
||||||
* @return {Object} Query.
|
* @return {Object} Query.
|
||||||
*/
|
*/
|
||||||
loadQuerySettings(key, query) {
|
loadQuerySettings(key, query) {
|
||||||
var values = this.get(key);
|
let values = this.get(key);
|
||||||
if (values) {
|
if (values) {
|
||||||
values = JSON.parse(values);
|
values = JSON.parse(values);
|
||||||
return Object.assign(query, values);
|
return Object.assign(query, values);
|
||||||
|
@ -393,7 +393,7 @@ export class UserSettings {
|
||||||
* @param {Object} query - Query.
|
* @param {Object} query - Query.
|
||||||
*/
|
*/
|
||||||
saveQuerySettings(key, query) {
|
saveQuerySettings(key, query) {
|
||||||
var values = {};
|
const values = {};
|
||||||
if (query.SortBy) {
|
if (query.SortBy) {
|
||||||
values.SortBy = query.SortBy;
|
values.SortBy = query.SortBy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue