From d149f351d2fa1cf508d27620b2f8ce11c72ed636 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Wed, 12 Feb 2020 00:58:15 -0600 Subject: [PATCH] made onionr ascii image default, added quotes to startup --- scripts/disable-dev-config.py | 1 + src/onionrcommands/daemonlaunch/__init__.py | 9 +++++++- src/onionrcommands/daemonlaunch/quotes.py | 23 +++++++++++++++++++++ src/utils/logoheader.py | 2 +- static-data/default_config.json | 2 +- 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/onionrcommands/daemonlaunch/quotes.py diff --git a/scripts/disable-dev-config.py b/scripts/disable-dev-config.py index 07eba914..e7f87e49 100755 --- a/scripts/disable-dev-config.py +++ b/scripts/disable-dev-config.py @@ -14,6 +14,7 @@ conf['tor']['existing_socks_port'] = 0 conf['general']['dev_mode'] = False conf['general']['insert_deniable_blocks'] = True conf['general']['random_bind_ip'] = True +conf['general']['display_header'] = True conf['onboarding']['done'] = False conf['general']['minimum_block_pow'] = 5 conf['general']['minimum_send_pow'] = 5 diff --git a/src/onionrcommands/daemonlaunch/__init__.py b/src/onionrcommands/daemonlaunch/__init__.py index c5358973..b8fc50fd 100755 --- a/src/onionrcommands/daemonlaunch/__init__.py +++ b/src/onionrcommands/daemonlaunch/__init__.py @@ -35,6 +35,8 @@ from .. import version from .getapihost import get_api_host_until_available from utils.bettersleep import better_sleep from netcontroller.torcontrol.onionservicecreator import create_onion_service +from .quotes import QUOTE +from utils.boxprint import bordered """ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -97,7 +99,12 @@ def daemon(): logger.raw('', terminal=True) # print nice header thing :) if config.get('general.display_header', True): - logoheader.header() + logoheader.header("") + if QUOTE[1]: + logger.info("\u001b[33m\033[F" + bordered(QUOTE[0] + '\n' + QUOTE[1]), terminal=True) + else: + logger.info("\u001b[33m\033[F" + bordered(QUOTE[0]), terminal=True) + version.version(verbosity=5, function=logger.info) logger.debug('Python version %s' % platform.python_version()) diff --git a/src/onionrcommands/daemonlaunch/quotes.py b/src/onionrcommands/daemonlaunch/quotes.py new file mode 100644 index 00000000..48457e7b --- /dev/null +++ b/src/onionrcommands/daemonlaunch/quotes.py @@ -0,0 +1,23 @@ +from random import shuffle +QUOTES = [ + ("We’re all living in each other’s paranoia", + "Elliot Alderson"), + ("Privacy - like eating and breathing - is one of life's basic requirements", + "Katherine Neville"), + ("Hack the Planet", + ""), + ("Live long and prosper", + "Spock"), + ("A revolution without dancing is a revolution not worth having", + "V for Vendetta"), + ("There can be no justice so long as laws are absolute. Even life itself is an exercise in exceptions", + "Picard"), + ("Openness and participation are antidotes to surveillance and control", + "Howard Rheingol"), + ("Like a black hole, NSA pulls in every signal that comes near, but no electron is ever allowed to escape", + "James Bamford"), + ("Freedom of the press is guaranteed only to those who own one", + "A. J. Liebling") +] +shuffle(QUOTES) +QUOTE = QUOTES[0] diff --git a/src/utils/logoheader.py b/src/utils/logoheader.py index 92c6eba9..9daf6431 100644 --- a/src/utils/logoheader.py +++ b/src/utils/logoheader.py @@ -11,5 +11,5 @@ def header(message = logger.colors.fg.pink + logger.colors.bold + 'Onionr' + log # only to stdout, not file or log or anything sys.stderr.write(file.read().decode().replace('P', logger.colors.fg.pink).replace('W', logger.colors.reset + logger.colors.bold).replace('G', logger.colors.fg.green).replace('\n', logger.colors.reset + '\n').replace('B', logger.colors.bold)) - if not message is None: + if message: logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n', terminal=True) \ No newline at end of file diff --git a/static-data/default_config.json b/static-data/default_config.json index 7ecbce76..cca630e0 100755 --- a/static-data/default_config.json +++ b/static-data/default_config.json @@ -11,7 +11,7 @@ "general": { "announce_node": true, "dev_mode": false, - "display_header": false, + "display_header": true, "hide_created_blocks": true, "insert_deniable_blocks": true, "max_block_age": 2678400,