1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Improved: Backup and restore validation (#174)

This commit is contained in:
nobody
2020-12-06 07:54:26 +01:00
parent d045e9d9cc
commit 87120aceba
2 changed files with 7 additions and 1 deletions

View File

@@ -148,6 +148,11 @@ storageManager._validation = function (content) {
delete content['hideReleaseNotes'];
}
// Convert type of updateNotification
if (typeof content.updateNotification === 'string') {
content.updateNotification = parseInt(content.updateNotification);
}
for (const [key, value] of Object.entries(SettingDefaults)) {
// If type the same as default settings
if (typeof value === typeof content[key]) {
@@ -164,7 +169,7 @@ storageManager._validation = function (content) {
// Set default if not existing in file
imported[key] = value;
} else {
alert(chrome.i18n.getMessage('dialogImportFailed'));
alert(chrome.i18n.getMessage('dialogImportFailed') + '\n\n' + key + ': ' + content[key]);
throw 'Invalid file!';
}
}