work on chat

master
Kevin Froman 2019-08-21 03:03:24 -05:00
parent d548723f90
commit a375117dd8
5 changed files with 67 additions and 3 deletions

View File

@ -0,0 +1,5 @@
# Onionr Forward Secrecy Spec v0.0.0
# Introduction
Due to the natural trade-offs of implementing [forward secrecy](https://en.wikipedia.org/wiki/Forward_secrecy) in a distributed, decentralized system, Onionr has optional

View File

@ -18,8 +18,10 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import communicator, onionrblockapi
import logger
from onionrutils import stringvalidators, bytesconverter
from coredb import blockmetadb
from onionrservices import server_exists
def service_creator(daemon):
assert isinstance(daemon, communicator.OnionrCommunicatorDaemon)
@ -30,10 +32,13 @@ def service_creator(daemon):
if not b in daemon.active_services:
bl = onionrblockapi.Block(b, decrypt=True)
bs = bytesconverter.bytes_to_str(bl.bcontent) + '.onion'
if server_exists(bl.signer):
continue
if stringvalidators.validate_pub_key(bl.signer) and stringvalidators.validate_transport(bs):
signer = bytesconverter.bytes_to_str(bl.signer)
daemon.active_services.append(b)
daemon.active_services.append(signer)
daemon.services.create_server(signer, bs, daemon)
if not daemon.services.create_server(signer, bs, daemon):
daemon.active_services.remove(b)
daemon.active_services.remove(signer)
daemon.decrementThreadCount('service_creator')

View File

@ -19,9 +19,10 @@
'''
import time
import stem
from . import connectionserver, bootstrapservice
from . import connectionserver, bootstrapservice, serverexists
from onionrutils import stringvalidators, basicrequests
import config
server_exists = serverexists.server_exists
class OnionrServices:
'''
Create a client or server for connecting to peer interfaces
@ -55,5 +56,10 @@ class OnionrServices:
@staticmethod
def create_client(peer, comm_inst=None):
# Create ephemeral onion service to bootstrap connection
if not comm_inst == None:
try:
return comm_inst.direct_connection_clients[peer]
except KeyError:
pass
address = bootstrapservice.bootstrap_client_service(peer, comm_inst)
return address

View File

@ -0,0 +1,30 @@
'''
Onionr - Private P2P Communication
Function to check if an onion server is created for a peer or not
'''
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import deadsimplekv
import filepaths
from onionrutils import bytesconverter
def server_exists(peer: str) -> bool:
'''checks if an onion server is created for a peer or not'''
peer = bytesconverter.bytes_to_str(peer)
kv = deadsimplekv.DeadSimpleKV(filepaths.cached_storage)
kv.refresh()
return not kv.get('dc-' + peer) is None

View File

@ -1,3 +1,21 @@
/*
Onionr - Private P2P Communication
Resize chat elements to help with responsiveness
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
*/
let doResize = function(){
let chatInput = document.getElementsByClassName('chatInput')[0]
chatInput.style.width = "50%";