mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-25 01:30:40 +01:00
Settings import function improved (#1234)
This commit is contained in:
parent
809e96bb41
commit
366fee286a
@ -121,17 +121,10 @@ storageManager.startImportFilePicker = function () {
|
||||
|
||||
storageManager.handleImportFilePicker = function () {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
let file = document.getElementById('import-file-picker').files[0];
|
||||
storageManager._readFile(file)
|
||||
.then(JSON.parse)
|
||||
.then(storageManager._validation);
|
||||
resolve();
|
||||
|
||||
} catch (err) {
|
||||
console.error(`[ LocalCDN ] ${err}`);
|
||||
alert(err);
|
||||
}
|
||||
let file = document.getElementById('import-file-picker').files[0];
|
||||
storageManager._readFile(file)
|
||||
.then(storageManager._validation);
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
@ -164,6 +157,13 @@ storageManager._readFile = function (file) {
|
||||
storageManager._validation = function (content) {
|
||||
let imported = {};
|
||||
|
||||
try {
|
||||
JSON.parse(content);
|
||||
} catch (err) {
|
||||
console.error(`[ LocalCDN ] ${err}`);
|
||||
alert(err);
|
||||
}
|
||||
|
||||
// Delete old keys
|
||||
if (content.whitelistedDomains !== undefined) {
|
||||
content.allowlistedDomains = content.whitelistedDomains;
|
||||
|
@ -54,6 +54,7 @@
|
||||
<p>Improved</p>
|
||||
<ul>
|
||||
<li>Block all non GET requests to CDN (<a href="https://codeberg.org/nobody/LocalCDN/issues/1226">#1226</a>)</li>
|
||||
<li>Settings import function improved (<a href="https://codeberg.org/nobody/LocalCDN/issues/1234">#1234</a>)</li>
|
||||
</ul>
|
||||
<p>Fixed</p>
|
||||
<ul>
|
||||
|
Loading…
Reference in New Issue
Block a user