Improved: Backup and restore validation (#174)

This commit is contained in:
nobody 2020-12-06 07:54:26 +01:00
parent d045e9d9cc
commit 87120aceba
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
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!';
}
}

View File

@ -27,6 +27,7 @@
<ul>
<li>Fixed: HTML filter (<a href="https://codeberg.org/nobody/LocalCDN/issues/192">#192</a>)</li>
<li>Updated: bootstrap-table v1.18.0 -> v1.18.1 (<a href="https://codeberg.org/nobody/LocalCDN/issues/193">#193</a>)</li>
<li>Improved: Backup and restore validation (<a href="https://codeberg.org/nobody/LocalCDN/issues/174">#174</a>)</li>
</ul>
<div id="generator-section">
<div class="topic-label">