Skip to content

Commit

Permalink
Added request to reboot after uploading a zip file.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMueller2003 committed Jan 14, 2025
1 parent 58e77e5 commit 19a585a
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var System_Config = null;
var Fseq_File_List = [];
var selector = [];
var target = document.location.host;
// target = "192.168.10.220";
// target = "192.168.10.188";

var SdCardIsInstalled = false;
var FseqFileTransferStartTime = new Date();
Expand Down Expand Up @@ -379,27 +379,39 @@ $(function () {
init: function () {
this.on('success', function (file, resp) {
// console.log("Success");
// console.log(file);
// console.log("File: " + file.name);
// console.log(resp);
Dropzone.forElement('#filemanagementupload').removeAllFiles(true)
RequestListOfFiles();
});

this.on('complete', function (file, resp) {
// console.log("complete");
// console.log(file);
// console.log("File: " + file.name);
// console.log(resp);
$('#fseqprogress_fg').addClass("hidden");

let DeltaTime = (new Date().getTime() - FseqFileTransferStartTime.getTime()) / 1000;
let rate = Math.floor((file.size / DeltaTime) / 1000);
let extensionPosition = file.name.lastIndexOf(".");
if(extensionPosition !== -1)
{
let extension = file.name.toLowerCase().slice(extensionPosition + 1);
if("zip" === extension)
{
let RebootNow = confirm("Downloaded a zip file. Unzip requires a reboot.\nClick 'OK' to Reboot NOW.");
if(RebootNow)
{
reboot();
}
}
}
// let DeltaTime = (new Date().getTime() - FseqFileTransferStartTime.getTime()) / 1000;
// let rate = Math.floor((file.size / DeltaTime) / 1000);
// console.debug("Final Transfer Rate: " + rate + "KBps");
});

this.on('addedfile', function (file, resp) {
// console.log("addedfile");
// console.log(file);
// console.log(resp);
// console.log("File: " + file.name);
// console.log("resp: " + resp);
FseqFileTransferStartTime = new Date();
});

Expand All @@ -418,7 +430,7 @@ $(function () {

accept: function (file, done) {
// console.log("accept");
// console.log(file);
// console.log("File: " + file.name);
return done(); // triggers a send
}
});
Expand Down

0 comments on commit 19a585a

Please sign in to comment.