connections now able to be created and detected in webui
This commit is contained in:
parent
0d9e72eccd
commit
80098d39c1
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,8 @@ onionr/data/config.ini
|
||||
onionr/data/*.db
|
||||
onionr/data-old/*
|
||||
onionr/data*
|
||||
onionr/tor
|
||||
onionr/tor.exe
|
||||
onionr/testdata
|
||||
onionr/*.pyc
|
||||
onionr/*.log
|
||||
|
@ -55,6 +55,6 @@ class DirectConnectionManagement:
|
||||
"""Spawn a thread that will create the client and eventually add it to the
|
||||
communicator.active_services
|
||||
"""
|
||||
threading.Thread(target=onionrservices.OnionrServices().create_client, args=[pubkey, communicator]).start()
|
||||
threading.Thread(target=onionrservices.OnionrServices().create_client, args=[pubkey, communicator], daemon=True).start()
|
||||
|
||||
return Response(resp)
|
@ -85,6 +85,6 @@ def bootstrap_client_service(peer, comm_inst=None, bootstrap_timeout=300):
|
||||
# This line reached when server is shutdown by being bootstrapped
|
||||
# Add the address to the client pool
|
||||
if not comm_inst is None:
|
||||
comm_inst.direct_connection_clients[peer] = bs_id
|
||||
comm_inst.direct_connection_clients[peer] = response.service_id
|
||||
# Now that the bootstrap server has received a server, return the address
|
||||
return key_store.get(bs_id)
|
||||
|
@ -12,4 +12,8 @@
|
||||
|
||||
.chatContent{
|
||||
padding-right: 5%;
|
||||
}
|
||||
|
||||
.connectStatus{
|
||||
float: right;
|
||||
}
|
@ -18,16 +18,33 @@
|
||||
*/
|
||||
friendList = {}
|
||||
convoListElement = document.getElementsByClassName('conversationList')[0]
|
||||
firstConvoLoad = true
|
||||
|
||||
function createConvoList(){
|
||||
|
||||
convoListElement.innerHTML = ""
|
||||
for (friend in friendList){
|
||||
var convoEntry = document.createElement('li')
|
||||
let convoEntry = document.createElement('li')
|
||||
let connectStatus = document.createElement('span')
|
||||
|
||||
if (! firstConvoLoad){
|
||||
connectStatus.innerText = " X"
|
||||
connectStatus.style.color = "red"
|
||||
connectStatus.classList.add("connectStatus")
|
||||
console.log(direct_connections)
|
||||
if (direct_connections.hasOwnProperty(friend)){
|
||||
connectStatus.innerText = " ✅"
|
||||
connectStatus.style.color = "green"
|
||||
}
|
||||
}
|
||||
|
||||
convoEntry.classList.add('convoEntry')
|
||||
convoEntry.setAttribute('data-pubkey', friend)
|
||||
convoEntry.innerText = friendList[friend]
|
||||
convoEntry.appendChild(connectStatus)
|
||||
convoListElement.append(convoEntry)
|
||||
firstConvoLoad = false
|
||||
}
|
||||
setTimeout(function(){createConvoList()}, 3000)
|
||||
}
|
||||
|
||||
fetch('/friends/list', {
|
||||
|
@ -25,7 +25,7 @@ let waitForConnection = function(pubkey){
|
||||
}})
|
||||
.then((resp) => resp.text())
|
||||
.then(function(resp) {
|
||||
if (resp.text === ""){
|
||||
if (resp === ""){
|
||||
// Try to get the client address again again in a few seconds
|
||||
setTimeout(function(){waitForConnection(pubkey)}, 3000)
|
||||
}
|
||||
@ -51,9 +51,11 @@ let createConnection = function(pubkey){
|
||||
}})
|
||||
.then((resp) => resp.text())
|
||||
.then(function(resp) {
|
||||
alert(resp)
|
||||
if (resp === "pending"){
|
||||
setTimeout(function(){waitForConnection(pubkey)}, 3000)
|
||||
}
|
||||
else{
|
||||
direct_connections[pubkey] = resp
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user