mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-02-18 12:50:49 +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 () {
|
storageManager.handleImportFilePicker = function () {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
try {
|
let file = document.getElementById('import-file-picker').files[0];
|
||||||
let file = document.getElementById('import-file-picker').files[0];
|
storageManager._readFile(file)
|
||||||
storageManager._readFile(file)
|
.then(storageManager._validation);
|
||||||
.then(JSON.parse)
|
resolve();
|
||||||
.then(storageManager._validation);
|
|
||||||
resolve();
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error(`[ LocalCDN ] ${err}`);
|
|
||||||
alert(err);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -164,6 +157,13 @@ storageManager._readFile = function (file) {
|
|||||||
storageManager._validation = function (content) {
|
storageManager._validation = function (content) {
|
||||||
let imported = {};
|
let imported = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSON.parse(content);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`[ LocalCDN ] ${err}`);
|
||||||
|
alert(err);
|
||||||
|
}
|
||||||
|
|
||||||
// Delete old keys
|
// Delete old keys
|
||||||
if (content.whitelistedDomains !== undefined) {
|
if (content.whitelistedDomains !== undefined) {
|
||||||
content.allowlistedDomains = content.whitelistedDomains;
|
content.allowlistedDomains = content.whitelistedDomains;
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
<p>Improved</p>
|
<p>Improved</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Block all non GET requests to CDN (<a href="https://codeberg.org/nobody/LocalCDN/issues/1226">#1226</a>)</li>
|
<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>
|
</ul>
|
||||||
<p>Fixed</p>
|
<p>Fixed</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user