From e6da506d6ec61bb2f10fd81f266398e1f097f358 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Sat, 6 Jun 2020 20:15:43 -0500 Subject: [PATCH] Fixed auth and allowed quality to be nullable --- SettingsHelper.js | 8 +++++++- src/store/modules/plex/actions.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SettingsHelper.js b/SettingsHelper.js index 3be7fe2b..df038e74 100644 --- a/SettingsHelper.js +++ b/SettingsHelper.js @@ -121,6 +121,8 @@ const fields = [ env: 'SLPLAYERQUALITY', default: defaultSettings.slPlayerQuality, type: 'number', + // null is allowed because null quality indicates Original + nullable: true, }, { // Valid values are in the range [0, 1] @@ -139,6 +141,10 @@ const fields = [ // Returns the parsed setting or default value if wrong type or unable to be parsed const parseSetting = (value, setting) => { + if (setting.nullable && value === null || value === 'null') { + return null; + } + if (setting.type === 'array') { // If setting is array. (Have to treat arrays differently since typeof array is 'object') if (Array.isArray(value)) { @@ -173,7 +179,7 @@ const parseSetting = (value, setting) => { } console.error( - `Error parsing [${setting.type}]: ${e.message} Reverting to default. Value: '${value}'`, + `Error parsing [${setting.type}]: Reverting to default. Value: '${value}'`, ); return setting.default; }; diff --git a/src/store/modules/plex/actions.js b/src/store/modules/plex/actions.js index 28af8a69..37d4e2c6 100644 --- a/src/store/modules/plex/actions.js +++ b/src/store/modules/plex/actions.js @@ -351,6 +351,6 @@ export default { return authenticationPassed; } - return null; + return true; }, };