improved initial node fetching and fixed broken shuffle
This commit is contained in:
parent
497211818a
commit
a5dab69b4f
13
index.html
13
index.html
@ -52,8 +52,15 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<p class="is-pulled-right">feed size: <span id="memUsage">0kb</span> | page size: 289kb</p>
|
||||
<p class="is-hidden has-text-warning noTor">You do not seem to be able to reach .onion services. Please use Tor Browser.</p>
|
||||
<div class="columns">
|
||||
<div class="column is-one-fifth">
|
||||
<p>feed size: <span id="memUsage">0kb</span></p>
|
||||
</div>
|
||||
<div class="column">
|
||||
<p>Connected usable nodes: <span id="usableNodes">0</span></p>
|
||||
</div>
|
||||
<div class="column is-hidden has-text-warning noTor">You do not seem to be able to reach .onion services. Please use Tor Browser.</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section">
|
||||
@ -87,7 +94,7 @@
|
||||
<div class="container messageFeed">
|
||||
</div>
|
||||
<div class="container block">
|
||||
<footer>privacy policy: We log nothing, but Onionr node operators may log data. Nothing personalized is sent to Onionr nodes, but all posts should be considered public and immutable.
|
||||
<footer>privacy policy: we log nothing, but Onionr node operators may log data. Nothing personalized is sent to Onionr nodes, but all posts should be considered public and immutable.
|
||||
<br>
|
||||
it is your responsibility to obey laws in your area.
|
||||
</footer>
|
||||
|
@ -38,8 +38,8 @@ if (document.location.protocol === "file:"){
|
||||
function shuffleArray(array) {
|
||||
if (document.hidden){return}
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1))
|
||||
[array[i], array[j]] = [array[j], array[i]]
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
}
|
||||
shuffleArray(initialNodes)
|
||||
@ -131,9 +131,9 @@ async function apiGET(path, queryString, raw=false){
|
||||
}
|
||||
|
||||
async function findMessages(){
|
||||
findMessageIntervalTime = 5000
|
||||
findMessageIntervalTime = 3000
|
||||
if (document.hidden){
|
||||
findMessageIntervalTime = 10000
|
||||
findMessageIntervalTime = 1000
|
||||
}
|
||||
try{
|
||||
var messages = (await apiGET("getblocklist", "?type=" + postTopic + "&date=" + lastLookup)).split('\n')
|
||||
|
@ -28,7 +28,10 @@ lookupWorker.addEventListener('message', function(e) {
|
||||
if (publicNodes.includes(p) || initialNodes.includes(p)){
|
||||
return
|
||||
}
|
||||
document.getElementById("lastReached").classList.replace("has-text-warning", "has-text-success")
|
||||
document.getElementById("lastReached").innerText = "Onionr network reached"
|
||||
publicNodes.push(p)
|
||||
document.getElementById("usableNodes").innerText = publicNodes.length
|
||||
}
|
||||
addPeer(e.data)
|
||||
}, false);
|
||||
@ -42,4 +45,8 @@ setInterval(function(){
|
||||
}
|
||||
lookupWorker.postMessage(JSON.stringify({"node": n}))
|
||||
}, 60000)
|
||||
lookupWorker.postMessage(JSON.stringify({"node": initialNodes[0]}))
|
||||
|
||||
initialNodes.forEach(n => {
|
||||
lookupWorker.postMessage(JSON.stringify({"node": n}))
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user