diff --git a/tools.js b/tools.js index 4a2ef35..575e756 100644 --- a/tools.js +++ b/tools.js @@ -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(){ diff --git a/views/layout.twig b/views/layout.twig index af50265..6912c82 100644 --- a/views/layout.twig +++ b/views/layout.twig @@ -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('') } }); @@ -191,7 +188,7 @@ $("#mountbtn").removeClass("btn-warning"); $("#mountbtn").removeClass("btn-danger"); $("#mountbtn").addClass("btn-success"); - $("#mountbtn").html(` | Mount status:
`) + $("#mountbtn").html(` | Mount status:
Connected.`) $("#mountbtn").onclick = function() {return false;} } else { $("#mountrefresh").removeClass("fa-spin");