From 1006be971b0626b66db6e98cb2cb5f7c5d44ba6e Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 13 Jan 2018 03:03:51 -0600 Subject: [PATCH] communicator/daemon now working with http server --- communicator.py | 8 ++++++-- onionr.py | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/communicator.py b/communicator.py index 398ff4cb..2d7e60f5 100755 --- a/communicator.py +++ b/communicator.py @@ -14,12 +14,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' -import sqlite3, requests, hmac, hashlib +import sqlite3, requests, hmac, hashlib, time import core class OnionrCommunicate: def __init__(self): + self._core = core.Core() + while True: + print('Onionr daemon running') + time.sleep(2) return - def getKey(self, peerID): + def getRemotePeerKey(self, peerID): '''This function contacts a peer and gets their main PGP key. This is safe because Tor or I2P is used, but it does not insure that the person is who they say they are ''' diff --git a/onionr.py b/onionr.py index 7a49aeb8..a923195a 100755 --- a/onionr.py +++ b/onionr.py @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' -import sys, os, threading, configparser, base64, random, getpass, shutil +import sys, os, configparser, base64, random, getpass, shutil, subprocess import gui, api, colors, core from onionrutils import OnionrUtils from colors import Colors @@ -93,8 +93,9 @@ class Onionr: shutil.rmtree('data/') return def daemon(self): - os.system('./communicator.py') - print('Started communicator') + if not os.environ.get("WERKZEUG_RUN_MAIN") == "true": + subprocess.Popen(["./communicator.py"]) + print('Started communicator') api.API(self.config, self.debug) return def killDaemon(self): @@ -104,4 +105,4 @@ class Onionr: def showHelp(self): return -Onionr() +Onionr() \ No newline at end of file