fixed some stuff

This commit is contained in:
bitscuit 2021-10-31 12:31:56 +00:00
parent 821163eeb3
commit 78f331160a
2 changed files with 18 additions and 4 deletions

View File

@ -33,12 +33,14 @@
<div id="main" class="container" style="text-align: center;">
<h1>Fawkes</h1>
<p>Protect your images from facial recognition.</p>
<p>TODO: add more info</p>
</div>
<div id="manual-area" class="container" style="text-align: center;">
<p>Please upload the images you want to protect.</p>
<p>The table below shows the status for each image you've uploaded. You can select the files you want to protect using the <i>Browse</i> and <i>Upload</i> buttons below.</p>
</div>
<div id="upload-area" class="container">
<div class="row">
<div class="twelve columns">
<label for="input-file">Your Image</label>
@ -63,10 +65,9 @@
<p id="text-no-images" style="text-align: center;">You haven't uploaded any images yet.</p>
<button class="button button-primary" id="button-start"><i class="fas fa-check"></i>&nbsp;&nbsp;&nbsp;Start Fawkes</button>
</div>
<div id="download-area" class="container">
<div id="download-area" class="container" style="text-align: center;">
</div>
<div class="footer">
@ -111,6 +112,9 @@ document.getElementById("button-upload").addEventListener("click", function(){
// Send request to server
socket.emit("FILE_START", {name:id, length:file.size});
// Reset file input
document.getElementById("input-file").value = "";
}else{
// No file selected
alert("Please select a file using the 'Browse' button.");
@ -168,6 +172,11 @@ document.getElementById("button-start").addEventListener("click", function(){
document.getElementById("button-start").style.display = "none";
document.getElementById("upload-area").style.display = "none";
// Display new manual text
var man = "";
man += "<p>Please wait while Fawkes processes your images. This might take a while.</p>";
document.getElementById("manual-area").innerHTML = man;
// Send server request to start Fawkes
socket.emit("FAWKES_START");
});
@ -201,6 +210,8 @@ socket.on("FAWKES_DONE", function(data){
page += "<p>Your images have been protected!</p>";
page += "<a class='button button-primary' href='"+data.downloadUrl+"' target='_blank'><i class='fas fa-download'></i>&nbsp;&nbsp;&nbsp;Download</a>";
document.getElementById("download-area").innerHTML = page;
document.getElementById("table-area").style.display = "none";
document.getElementById("manual-area").style.display = "none";
}else{
// Error
@ -208,6 +219,8 @@ socket.on("FAWKES_DONE", function(data){
page += "<h5><i class='fas fa-exclamation-triangle'></i>&nbsp;&nbsp;&nbsp;Processing Failed</h5>";
page += "<p>"+data.message+"</p>";
document.getElementById("download-area").innerHTML = page;
document.getElementById("table-area").style.display = "none";
document.getElementById("manual-area").style.display = "none";
}
});

View File

@ -276,6 +276,7 @@ io.on("connection", (socket) => {
"tar -czvf fawkes/files/"+archiveName+" -C fawkes/files/"+userId+"cloaked ."
, (error, stdout, stderr) => {
console.log("archive creation done: "+error+", "+stdout+", "+stderr);
// Zip done
if(error){
socket.emit("FAWKES_DONE", {success:false, message:"Internal server error. Couldn't create archive."});