From 31825bfad78d6ef414fba506f8d3d2f44acccdba Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 7 Oct 2019 19:02:12 -0500 Subject: [PATCH] fix lockfile and add motd key to onionrvalues --- onionr/etc/onionrvalues.py | 3 ++- onionr/filepaths/__init__.py | 1 + onionr/onionrcommands/daemonlaunch.py | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/onionr/etc/onionrvalues.py b/onionr/etc/onionrvalues.py index 1373e223..44142e6d 100755 --- a/onionr/etc/onionrvalues.py +++ b/onionr/etc/onionrvalues.py @@ -22,7 +22,7 @@ import os import filepaths -DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA====" +DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA" PASSWORD_LENGTH = 25 ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net' ONIONR_VERSION = '0.1.0' # for debugging and stuff @@ -42,6 +42,7 @@ MIN_BLOCK_UPLOAD_PEER_PERCENT = 0.1 ANNOUNCE_POW = 5 DEFAULT_EXPIRE = 2592000 BLOCK_METADATA_LENGTHS = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'pow': 1000, 'encryptType': 4, 'expire': 14} +MOTD_SIGN_KEY = "TRH763JURNY47QPBTTQ4LLPYCYQK6Q5YA33R6GANKZK5C5DKCIGQ" platform = platform.system() if platform == 'Windows': diff --git a/onionr/filepaths/__init__.py b/onionr/filepaths/__init__.py index 22120621..f65a287e 100644 --- a/onionr/filepaths/__init__.py +++ b/onionr/filepaths/__init__.py @@ -18,6 +18,7 @@ export_location = home + 'block-export/' upload_list = home + 'upload-list.json' config_file = home + 'config.json' daemon_mark_file = app_root + '/daemon-true.txt' +lock_file = home + 'onionr.lock' site_cache = home + 'onionr-sites.txt' diff --git a/onionr/onionrcommands/daemonlaunch.py b/onionr/onionrcommands/daemonlaunch.py index 797860e1..590fcb33 100755 --- a/onionr/onionrcommands/daemonlaunch.py +++ b/onionr/onionrcommands/daemonlaunch.py @@ -142,18 +142,18 @@ kill_daemon.onionr_help = "Gracefully stops the Onionr API servers" def start(input: bool = False, override: bool = False): """If no lock file, make one and start onionr, error if there is and its not overridden""" - if os.path.exists('.onionr-lock') and not override: - logger.fatal('Cannot start. Daemon is already running, or it did not exit cleanly.\n(if you are sure that there is not a daemon running, delete .onionr-lock & try again).', terminal=True) + if os.path.exists(filepaths.lock_file) and not override: + logger.fatal('Cannot start. Daemon is already running, or it did not exit cleanly.\n(if you are sure that there is not a daemon running, delete filepaths.lock_file & try again).', terminal=True) else: if not onionrvalues.DEVELOPMENT_MODE: - lockFile = open('.onionr-lock', 'w') - lockFile.write('') + lockFile = open(filepaths.lock_file, 'w') + lockFile.write('delete at your own risk') lockFile.close() daemon() if not onionrvalues.DEVELOPMENT_MODE: try: - os.remove('.onionr-lock') + os.remove(filepaths.lock_file) except FileNotFoundError: pass -start.onionr_help = "Start Onionr node (public and clients API servers)" \ No newline at end of file +start.onionr_help = "Start Onionr node (public and clients API servers)"