add readline to client api request crafter
This commit is contained in:
parent
61bc5fd34b
commit
15379a7c2f
4 changed files with 37 additions and 2 deletions
|
@ -7,6 +7,9 @@
|
|||
<div class="quickview-block">
|
||||
Inserting blocks: <span id="insertingBlocks">unknown</span>
|
||||
</div>
|
||||
<div class="quickview-block">
|
||||
Blocks to upload: <span id="uploadBlocks">unknown</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="button is-primary is-hidden sidebarBtn" data-show="quickview" data-target="quickviewDefault">Show quickview</button>
|
||||
|
|
|
@ -19,6 +19,7 @@ window.addEventListener("keydown", function(event) {
|
|||
let refreshSideBar = function(){
|
||||
if (document.hidden){return}
|
||||
var existingValue = document.getElementById("insertingBlocks").innerText
|
||||
var existingUploadValue = document.getElementById("uploadBlocks")
|
||||
fetch('/getgeneratingblocks', {
|
||||
"method": "get",
|
||||
headers: {
|
||||
|
@ -36,6 +37,23 @@ window.addEventListener("keydown", function(event) {
|
|||
}
|
||||
document.getElementById("insertingBlocks").innerText = resp.split(',').length - 1
|
||||
})
|
||||
fetch('/getblockstoupload', {
|
||||
"method": "get",
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text())
|
||||
.then(function(resp) {
|
||||
console.debug(resp.length, existingUploadValue)
|
||||
if (resp.length <= 2 && existingUploadValue !== "0"){
|
||||
document.getElementById("uploadBlocks").innerText = "0"
|
||||
return
|
||||
}
|
||||
if (existingUploadValue === resp.split(',').length){
|
||||
return
|
||||
}
|
||||
document.getElementById("uploadBlocks").innerText = resp.split(',').length - 1
|
||||
})
|
||||
}
|
||||
setInterval(refreshSideBar, 3000)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue