fix lockfile and add motd key to onionrvalues

This commit is contained in:
Kevin Froman 2019-10-07 19:02:12 -05:00
parent c22f084315
commit 31825bfad7
3 changed files with 9 additions and 7 deletions

View File

@ -22,7 +22,7 @@ import os
import filepaths import filepaths
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA====" DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
PASSWORD_LENGTH = 25 PASSWORD_LENGTH = 25
ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net' ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
ONIONR_VERSION = '0.1.0' # for debugging and stuff ONIONR_VERSION = '0.1.0' # for debugging and stuff
@ -42,6 +42,7 @@ MIN_BLOCK_UPLOAD_PEER_PERCENT = 0.1
ANNOUNCE_POW = 5 ANNOUNCE_POW = 5
DEFAULT_EXPIRE = 2592000 DEFAULT_EXPIRE = 2592000
BLOCK_METADATA_LENGTHS = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'pow': 1000, 'encryptType': 4, 'expire': 14} BLOCK_METADATA_LENGTHS = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'pow': 1000, 'encryptType': 4, 'expire': 14}
MOTD_SIGN_KEY = "TRH763JURNY47QPBTTQ4LLPYCYQK6Q5YA33R6GANKZK5C5DKCIGQ"
platform = platform.system() platform = platform.system()
if platform == 'Windows': if platform == 'Windows':

View File

@ -18,6 +18,7 @@ export_location = home + 'block-export/'
upload_list = home + 'upload-list.json' upload_list = home + 'upload-list.json'
config_file = home + 'config.json' config_file = home + 'config.json'
daemon_mark_file = app_root + '/daemon-true.txt' daemon_mark_file = app_root + '/daemon-true.txt'
lock_file = home + 'onionr.lock'
site_cache = home + 'onionr-sites.txt' site_cache = home + 'onionr-sites.txt'

View File

@ -142,18 +142,18 @@ kill_daemon.onionr_help = "Gracefully stops the Onionr API servers"
def start(input: bool = False, override: bool = False): 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 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: 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 .onionr-lock & try again).', terminal=True) 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: else:
if not onionrvalues.DEVELOPMENT_MODE: if not onionrvalues.DEVELOPMENT_MODE:
lockFile = open('.onionr-lock', 'w') lockFile = open(filepaths.lock_file, 'w')
lockFile.write('') lockFile.write('delete at your own risk')
lockFile.close() lockFile.close()
daemon() daemon()
if not onionrvalues.DEVELOPMENT_MODE: if not onionrvalues.DEVELOPMENT_MODE:
try: try:
os.remove('.onionr-lock') os.remove(filepaths.lock_file)
except FileNotFoundError: except FileNotFoundError:
pass pass
start.onionr_help = "Start Onionr node (public and clients API servers)" start.onionr_help = "Start Onionr node (public and clients API servers)"