work on adding peers

This commit is contained in:
Kevin Froman 2018-01-09 21:50:38 -06:00
parent 94c1368f72
commit 52fb4b139b
No known key found for this signature in database
GPG key ID: 0D414D0FE405B63B
5 changed files with 74 additions and 16 deletions

View file

@ -21,6 +21,11 @@ from colors import Colors
class Onionr:
def __init__(self):
if os.path.exists('dev-enabled'):
print('DEVELOPMENT MODE ENABLED (THIS IS LESS SECURE!)')
self._developmentMode = True
else:
self._developmentMode = False
colors = Colors()
@ -42,7 +47,12 @@ class Onionr:
else:
print('Failed to decrypt: ' + result[1])
else:
os.mkdir('data')
if not os.path.exists('data/'):
os.mkdir('data/')
if os.path.exists('data/peers.db'):
onionrCore.createPeerDB()
pass
# Get configuration
self.config = configparser.ConfigParser()
@ -76,10 +86,11 @@ class Onionr:
print('Do', sys.argv[0], ' --help for Onionr help.')
else:
print(colors.RED, 'Invalid Command', colors.RESET)
return
encryptionPassword = onionrUtils.getPassword('Enter password to encrypt directory.')
onionrCore.dataDirEncrypt(encryptionPassword)
shutil.rmtree('data/')
if not self._developmentMode:
encryptionPassword = onionrUtils.getPassword('Enter password to encrypt directory.')
onionrCore.dataDirEncrypt(encryptionPassword)
shutil.rmtree('data/')
return
def daemon(self):
os.system('./communicator.py')