Skip to content

Commit

Permalink
change checkmount
Browse files Browse the repository at this point in the history
  • Loading branch information
whitewhidow committed Dec 28, 2020
1 parent 2d1384d commit e725042
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
46 changes: 30 additions & 16 deletions tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,41 @@ function trackDevices(){
})
}

async function checkMount(){
// async function checkMount(){
// console.log("checkMount()")
// try {
// await fsPromise.readdir(`${mountFolder}`);
// list = await getDir(`${mountFolder}`);
// if (list.length > 0) {
// global.mounted = true
// updateRcloneProgress();
// return true
// }
// global.mounted = false
// return false;
// }
// catch (e) {
// console.log("entering catch block");
// console.log(e);
// console.log("leaving catch block");
// global.mounted = false
// return false
// }
// return false;
// }

async function checkMount() {
console.log("checkMount()")
try {
await fsPromise.readdir(`${mountFolder}`);
list = await getDir(`${mountFolder}`);
if (list.length > 0) {
global.mounted = true
updateRcloneProgress();
return true
}
const resp = await fetch("http://127.0.0.1:5572/rc/noop", {
method: "post",
});
global.mounted = resp.ok
return resp.ok
} catch (e) {
global.mounted = false
return false;
}
catch (e) {
console.log("entering catch block");
console.log(e);
console.log("leaving catch block");
global.mounted = false
return false
}
return false;
}

async function checkDeps(){
Expand Down
5 changes: 1 addition & 4 deletions views/layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@
ipcRenderer.on('rclone_data', (event, arg) => {
data=arg;
//console.log(arg)
if(data.transferring && data.transferring.length > 0) {
$("#progressstatus").text(data.transferring[0].percentage + "% - " + formatBytes(data.transferring[0].speedAvg) + "/s" + " - " + formatEta(data.transferring[0].eta));
$(".mountcopystatus").text("(Downloading: "+data.transferring[0].percentage + "% - " + formatBytes(data.transferring[0].speedAvg) + "/s" + " - " + formatEta(data.transferring[0].eta) + ")");
} else {
$("#progressstatus").text("CONNECTED");
$(".mountcopystatus").text('')
}
});
Expand Down Expand Up @@ -191,7 +188,7 @@
$("#mountbtn").removeClass("btn-warning");
$("#mountbtn").removeClass("btn-danger");
$("#mountbtn").addClass("btn-success");
$("#mountbtn").html(`<i id="mountrefresh" class="fa fa-check-circle-o"></i> | Mount status:</br><span id="progressstatus"></span>`)
$("#mountbtn").html(`<i id="mountrefresh" class="fa fa-check-circle-o"></i> | Mount status:</br>Connected.`)
$("#mountbtn").onclick = function() {return false;}
} else {
$("#mountrefresh").removeClass("fa-spin");
Expand Down

0 comments on commit e725042

Please sign in to comment.