Fixed auth and allowed quality to be nullable

This commit is contained in:
Travis Shivers 2020-06-06 20:15:43 -05:00
parent cc5970001c
commit e6da506d6e
2 changed files with 8 additions and 2 deletions

View File

@ -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;
};

View File

@ -351,6 +351,6 @@ export default {
return authenticationPassed;
}
return null;
return true;
},
};