Fixed settings check issues

This commit is contained in:
RemixDev 2021-05-21 13:03:07 +02:00
parent e93981fcf9
commit 229d3d764e

View file

@ -49,7 +49,7 @@ const DEFAULTS = {
syncedLyrics: false, syncedLyrics: false,
embeddedArtworkSize: 800, embeddedArtworkSize: 800,
embeddedArtworkPNG: false, embeddedArtworkPNG: false,
localArtworkSize: 1400, localArtworkSize: 1200,
localArtworkFormat: "jpg", localArtworkFormat: "jpg",
saveArtwork: true, saveArtwork: true,
coverImageTemplate: "cover", coverImageTemplate: "cover",
@ -121,13 +121,13 @@ function load(configFolder){
function check(settings){ function check(settings){
let changes = 0 let changes = 0
Object.keys(DEFAULTS).forEach( _iSet => { Object.keys(DEFAULTS).forEach( _iSet => {
if (! settings[_iSet] || typeof settings[_iSet] != DEFAULTS[_iSet]){ if (settings[_iSet] === undefined || typeof settings[_iSet] != typeof DEFAULTS[_iSet]){
settings[_iSet] = DEFAULTS[_iSet] settings[_iSet] = DEFAULTS[_iSet]
changes++ changes++
} }
}) })
Object.keys(DEFAULTS.tags).forEach( _iSet => { Object.keys(DEFAULTS.tags).forEach( _iSet => {
if (! settings.tags[_iSet] || typeof settings.tags[_iSet] != DEFAULTS.tags[_iSet]){ if (settings.tags[_iSet] === undefined || typeof settings.tags[_iSet] != typeof DEFAULTS.tags[_iSet]){
settings.tags[_iSet] = DEFAULTS.tags[_iSet] settings.tags[_iSet] = DEFAULTS.tags[_iSet]
changes++ changes++
} }