add readline to client api request crafter
parent
61bc5fd34b
commit
15379a7c2f
|
@ -8,7 +8,8 @@ print("Please don't run this script on Onionr networks that include more than yo
|
|||
|
||||
import sys
|
||||
import os
|
||||
os.chdir('../')
|
||||
if not os.path.exists('onionr.sh'):
|
||||
os.chdir('../')
|
||||
sys.path.append("src/")
|
||||
import onionrblocks
|
||||
|
||||
|
|
|
@ -8,6 +8,19 @@ import os
|
|||
if not os.path.exists('onionr.sh'):
|
||||
os.chdir('../')
|
||||
sys.path.append("src/")
|
||||
|
||||
import atexit
|
||||
import readline
|
||||
|
||||
histfile = os.path.join(os.path.expanduser("~"), ".onionr_history")
|
||||
try:
|
||||
readline.read_history_file(histfile)
|
||||
# default history len is -1 (infinite), which may grow unruly
|
||||
readline.set_history_length(1000)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
atexit.register(readline.write_history_file, histfile)
|
||||
from onionrutils.localcommand import local_command
|
||||
from onionrutils.localcommand import get_hostname
|
||||
|
||||
|
@ -16,7 +29,7 @@ try:
|
|||
except TypeError:
|
||||
print('Onionr not running')
|
||||
sys.exit(1)
|
||||
print('1. get request')
|
||||
print('1. get request (default)')
|
||||
print('2. post request')
|
||||
choice = input(">").lower().strip()
|
||||
post = False
|
||||
|
|
|
@ -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…
Reference in New Issue