mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-10 13:36:54 +03:00
.
This commit is contained in:
@@ -30,7 +30,7 @@ input[type=number] {
|
|||||||
|
|
||||||
<body style="font-family: arial; padding: 0px 10px;">
|
<body style="font-family: arial; padding: 0px 10px;">
|
||||||
<h2>Backup Configuration</h2>
|
<h2>Backup Configuration</h2>
|
||||||
<p>With the following action the config folder on the SD-card gets zipped and provided as a download.</p>
|
<p>With the following action the <a href="/fileserver/config/" target="_self">config</a> folder on the SD-card gets zipped and provided as a download.</p>
|
||||||
|
|
||||||
<table border="0">
|
<table border="0">
|
||||||
</tr>
|
</tr>
|
||||||
@@ -44,8 +44,7 @@ input[type=number] {
|
|||||||
</table>
|
</table>
|
||||||
<hr>
|
<hr>
|
||||||
<h2>Restore Configuration</h2>
|
<h2>Restore Configuration</h2>
|
||||||
<p>Not implemented yet.<br>
|
<p>Use the <a href="/fileserver/config/" target="_self">File Server</a> to upload individual files.</p>
|
||||||
But you can use the <a href="/fileserver/config" target="_self">File Server</a> to upload individual files.</p>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
||||||
@@ -54,15 +53,19 @@ But you can use the <a href="/fileserver/config" target="_self">File Server</a>
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
function doBackup() {
|
function doBackup() {
|
||||||
|
|
||||||
document.getElementById("progress").innerHTML = "Creating backup...";
|
document.getElementById("progress").innerHTML = "Creating backup...";
|
||||||
|
|
||||||
// Get hostname
|
// Get hostname
|
||||||
var xhttp = new XMLHttpRequest();
|
try {
|
||||||
xhttp.open("GET", "/version?type=Hostname", false);
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.send();
|
xhttp.open("GET", "/version?type=Hostname", false);
|
||||||
|
xhttp.send();
|
||||||
hostname = xhttp.responseText;
|
hostname = xhttp.responseText;
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
alert("Failed to fetch hostname: " + err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get date/time
|
// get date/time
|
||||||
var dateTime = new Date().toJSON().slice(0,10) + "_" + new Date().toJSON().slice(11,19).replaceAll(":", "-");
|
var dateTime = new Date().toJSON().slice(0,10) + "_" + new Date().toJSON().slice(11,19).replaceAll(":", "-");
|
||||||
@@ -71,12 +74,17 @@ function doBackup() {
|
|||||||
console.log(zipFilename);
|
console.log(zipFilename);
|
||||||
|
|
||||||
// Get files list
|
// Get files list
|
||||||
var xhttp = new XMLHttpRequest();
|
try {
|
||||||
xhttp.open("GET", "/fileserver/config/", false);
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.send();
|
xhttp.open("GET", "/fileserver/config/", false);
|
||||||
|
xhttp.send();
|
||||||
var parser = new DOMParser();
|
|
||||||
var content = parser.parseFromString(xhttp.responseText, 'text/html');
|
var parser = new DOMParser();
|
||||||
|
var content = parser.parseFromString(xhttp.responseText, 'text/html'); }
|
||||||
|
catch(err) {
|
||||||
|
alert("Failed to fetch files list: " + err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const list = content.querySelectorAll("a");
|
const list = content.querySelectorAll("a");
|
||||||
|
|
||||||
@@ -88,7 +96,13 @@ function doBackup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pack as zip and download
|
// Pack as zip and download
|
||||||
saveZip(zipFilename, urls);
|
try {
|
||||||
|
saveZip(zipFilename, urls);
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
alert("Failed to zip files: " + err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,5 +137,4 @@ const saveZip = (filename, urls) => {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user