made particles more efficient, finished basic blocks feed
parent
dafa4b6117
commit
34416c07fe
|
@ -57,9 +57,14 @@ def stream_tor_circuits():
|
|||
def stream_recent_blocks():
|
||||
def _compile_json(b_list):
|
||||
js = {}
|
||||
block_obj = None
|
||||
for block in b_list:
|
||||
js[block] = Block(block).btype
|
||||
return ujson.dumps(js, reject_bytes=True)
|
||||
block_obj = Block(block)
|
||||
if block_obj.isEncrypted:
|
||||
js[block] = 'encrypted'
|
||||
else:
|
||||
js[block] = Block(block).btype
|
||||
return ujson.dumps({"blocks": js}, reject_bytes=True)
|
||||
|
||||
def _stream_recent():
|
||||
last_time = Path(block_meta_db).stat().st_ctime
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
"tor": true
|
||||
},
|
||||
"ui": {
|
||||
"animated_background": true,
|
||||
"theme": "dark"
|
||||
}
|
||||
}
|
|
@ -81,25 +81,6 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="column is-7">
|
||||
<div class="field">
|
||||
<div class="field has-addons">
|
||||
<p class="control">
|
||||
<a class="button is-static">
|
||||
<i class="fas fa-fingerprint"></i>
|
||||
</a>
|
||||
</p>
|
||||
<p class="control is-expanded">
|
||||
<input id="myPub" class="input myPub" type="text" readonly>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a id="myPubCopy" class="button is-primary">
|
||||
<span class="icon">
|
||||
<i class="fas fa-copy"></i>
|
||||
</span>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field is-grouped is-grouped-centered">
|
||||
<p class="control">
|
||||
<a class="button is-danger is-outlined" id="shutdownNode">
|
||||
|
@ -202,6 +183,26 @@
|
|||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<div class="field has-addons">
|
||||
<p class="control">
|
||||
<a class="button is-static">
|
||||
<i class="fas fa-fingerprint"></i>
|
||||
</a>
|
||||
</p>
|
||||
<p class="control is-expanded">
|
||||
<input id="myPub" class="input myPub" type="text" readonly>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a id="myPubCopy" class="button is-primary"><i class="fas fa-copy"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<span class="icon">
|
||||
|
@ -248,6 +249,24 @@
|
|||
Total Requests: <span id="totalRec">None since start</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<details>
|
||||
<summary>Transport addresses</summary>
|
||||
<div class="field has-addons torTransportField">
|
||||
<p class="control">
|
||||
<a class="button is-static">
|
||||
<i class="fas fa-adjust"></i>
|
||||
</a>
|
||||
</p>
|
||||
<p class="control is-expanded">
|
||||
<input id="myTor" class="input myTor" type="text" readonly>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a id="myTorCopy" class="button is-primary"><i class="fas fa-copy"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<i class="fas fa-link"></i>
|
||||
Outgoing Connections:
|
||||
<div class="control">
|
||||
|
@ -268,7 +287,7 @@
|
|||
<div class="columns">
|
||||
<div class="column">
|
||||
<p class="buttons">
|
||||
<button class="button is-small">
|
||||
<button class="button is-small recentBlocksBtn">
|
||||
<span class="icon is-small">
|
||||
<i class="fas fa-stream"></i>
|
||||
</span>
|
||||
|
@ -281,7 +300,7 @@
|
|||
<div class="columns">
|
||||
<div class="column">
|
||||
<i class="fas fa-microchip"></i>
|
||||
Current CPU threads: <span id="threads"></span>
|
||||
Current threads: <span id="threads"></span>
|
||||
</div>
|
||||
<div class="column">
|
||||
<i class="fas fa-memory"></i>
|
||||
|
@ -336,7 +355,8 @@
|
|||
<button class="closeRecentModal delete" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body recentBody">
|
||||
Loading... <i class="fas fa-spinner fa-spin"></i>
|
||||
Keep this open to see new blocks!
|
||||
<pre class="recentBlockList"></pre>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
apiOnline = true
|
||||
async function doPing(){
|
||||
if (document.hidden){
|
||||
return
|
||||
}
|
||||
out = setTimeout(function(){
|
||||
if (apiOnline){
|
||||
PNotify.notice('Connection lost with API server')
|
||||
|
|
|
@ -1538,4 +1538,16 @@ var pJS = function(tag_id, params){
|
|||
};
|
||||
xhr.send();
|
||||
|
||||
};
|
||||
};
|
||||
let toggleAnimation = function () {
|
||||
if (document.hidden) {
|
||||
cancelRequestAnimFrame(pJSDom[0].pJS.fn.checkAnimFrame);
|
||||
cancelRequestAnimFrame(pJSDom[0].pJS.fn.drawAnimFrame);
|
||||
pJSDom[0].pJS.fn.particlesEmpty();
|
||||
pJSDom[0].pJS.fn.canvasClear();
|
||||
return;
|
||||
}
|
||||
pJSDom[0].pJS.fn.vendors.start();
|
||||
}
|
||||
|
||||
document.addEventListener("visibilitychange", toggleAnimation, false);
|
|
@ -1,10 +1,51 @@
|
|||
var recentSource = new EventSourcePolyfill('/recentblocks', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
var getRecent = function(){
|
||||
var recentSource = new EventSourcePolyfill('/recentblocks', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
recentSource.onmessage = function(e){
|
||||
if (e.data == "none"){
|
||||
return
|
||||
}
|
||||
var existing = document.getElementsByClassName('recentBlockList')[0].innerText;
|
||||
let data = JSON.parse(e.data)
|
||||
Object.entries(data.blocks).forEach(([key, value]) => {
|
||||
if (existing.includes(key)){
|
||||
return
|
||||
}
|
||||
existing = key + " - " + value + "\n" + existing
|
||||
})
|
||||
document.getElementsByClassName('recentBlockList')[0].innerText = existing
|
||||
console.debug(data)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
recentSource.onmessage = function(e){
|
||||
console.debug(e)
|
||||
return recentSource
|
||||
}
|
||||
recentSource = getRecent()
|
||||
function toggleRecentStream() {
|
||||
if (document.hidden){
|
||||
console.debug("Stopped recent block stream")
|
||||
recentSource.close()
|
||||
return
|
||||
}
|
||||
if (document.getElementsByClassName('recentModal')[0].classList.contains('is-active')){
|
||||
recentSource.close()
|
||||
getRecent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.getElementsByClassName('recentBlocksBtn')[0].onclick = function(){
|
||||
document.getElementsByClassName('recentModal')[0].classList.add('is-active')
|
||||
}
|
||||
|
||||
|
||||
document.getElementsByClassName('recentBlocksBtn')
|
||||
document.addEventListener("visibilitychange", toggleRecentStream, false);
|
||||
|
||||
document.getElementsByClassName('closeRecentModal')[0].onclick = function(){
|
||||
document.getElementsByClassName('recentBlockList')[0].innerText = ""
|
||||
document.getElementsByClassName('recentModal')[0].classList.remove('is-active')
|
||||
}
|
|
@ -146,7 +146,19 @@ getStats()
|
|||
setInterval(function(){getStats()}, 1000)
|
||||
|
||||
|
||||
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
|
||||
particlesJS.load('particles-js', '/shared/main/particles.json', function() {
|
||||
console.log('callback - particles.js config loaded');
|
||||
});
|
||||
|
||||
fetch('/config/get/ui.animated_background', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text()) // Transform the data into text
|
||||
.then(function(resp) {
|
||||
if (resp == "false"){
|
||||
return
|
||||
}
|
||||
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
|
||||
particlesJS.load('particles-js', '/shared/main/particles.json', function() {
|
||||
console.debug('callback - particles.js config loaded')
|
||||
})
|
||||
}
|
||||
)
|
|
@ -5,7 +5,7 @@ fetch('/config/get/transports.tor', {
|
|||
.then((resp) => resp.text()) // Transform the data into text
|
||||
.then(function(resp) {
|
||||
var displays = document.getElementsByClassName('torInfo')
|
||||
if (resp == true){
|
||||
if (resp == "true"){
|
||||
var torSource = new EventSourcePolyfill('/torcircuits', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
|
|
Loading…
Reference in New Issue