From bc37fc0e956f01db4de98ee9feb5ccd82ebe6cf0 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 5 Nov 2019 05:29:15 -0600 Subject: [PATCH] ensure bootstrap is always added if enabled, work on site creator --- TODO.txt | 1 + onionr/communicator/__init__.py | 3 +++ onionr/communicator/bootstrappeers.py | 5 +++-- onionr/onionrcommands/sitecreator.py | 6 ++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/TODO.txt b/TODO.txt index 83d5d87b..42b4960a 100644 --- a/TODO.txt +++ b/TODO.txt @@ -12,3 +12,4 @@ * make node "speed" setting such as when ui is open to reduce bandwidth usage * localization support * add BCC support to mail +* prevent local insertion success of duplicate block content diff --git a/onionr/communicator/__init__.py b/onionr/communicator/__init__.py index eca47e95..de760f0d 100755 --- a/onionr/communicator/__init__.py +++ b/onionr/communicator/__init__.py @@ -177,6 +177,9 @@ class OnionrCommunicatorDaemon: lookup_blocks_timer = (lookup_blocks_timer.frequency - 2) shared_state.add(self) + + if config.get('general.use_bootstrap', True): + bootstrappeers.add_bootstrap_list_to_peer_list(self, [], db_only=True) # Main daemon loop, mainly for calling timers, don't do any complex operations here to avoid locking try: diff --git a/onionr/communicator/bootstrappeers.py b/onionr/communicator/bootstrappeers.py index 12bd0090..2207af3a 100644 --- a/onionr/communicator/bootstrappeers.py +++ b/onionr/communicator/bootstrappeers.py @@ -20,11 +20,12 @@ from utils import readstatic, gettransports from coredb import keydb bootstrap_peers = readstatic.read_static('bootstrap-nodes.txt').split(',') -def add_bootstrap_list_to_peer_list(comm_inst, peerList): + +def add_bootstrap_list_to_peer_list(comm_inst, peerList, db_only=False): ''' Add the bootstrap list to the peer list (no duplicates) ''' for i in bootstrap_peers: if i not in peerList and i not in comm_inst.offlinePeers and not i in gettransports.get() and len(str(i).strip()) > 0: - peerList.append(i) + if not db_only: peerList.append(i) keydb.addkeys.add_address(i) \ No newline at end of file diff --git a/onionr/onionrcommands/sitecreator.py b/onionr/onionrcommands/sitecreator.py index 85bd3f3a..907bef98 100644 --- a/onionr/onionrcommands/sitecreator.py +++ b/onionr/onionrcommands/sitecreator.py @@ -17,10 +17,8 @@ def create_multipage_site(): except IndexError: logger.warn('''It is critical that this passphrase is long. If you want to update your site later you must remember the passphrase.''', terminal=True) - logger.info(f'Please enter a site passphrase of at least {onionrvalues.PASSWORD_LENGTH} characters.', terminal=True) - passphrase = getpass.getpass() - logger.info('Confirm:', terminal=True) - confirm = getpass.getpass() + passphrase = getpass.getpass(f'Please enter a site passphrase of at least {onionrvalues.PASSWORD_LENGTH} characters.') + confirm = getpass.getpass('Confirm passphrase:') if passphrase != confirm: logger.error('Passphrases do not match', terminal=True) error_encountered = True