fix showlogo crash when not connected to terminal, bump version

This commit is contained in:
Kevin Froman 2020-09-07 03:42:13 +00:00
parent 2f5c1311be
commit b7091d2062
2 changed files with 9 additions and 3 deletions

View File

@ -23,7 +23,7 @@ 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 = '5.0.0' ONIONR_VERSION = '5.0.2'
ONIONR_VERSION_CODENAME = 'Genesis' ONIONR_VERSION_CODENAME = 'Genesis'
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION) ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
API_VERSION = '1' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you. API_VERSION = '1' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.

View File

@ -28,19 +28,25 @@ from utils import logoheader
def show_logo(): def show_logo():
logger.raw('', terminal=True) logger.raw('', terminal=True)
try:
terminal_size = os.get_terminal_size().columns
except OSError: # Generally thrown if not in terminal
terminal_size = 120
# print nice header thing :) # print nice header thing :)
if config.get('general.display_header', True): if config.get('general.display_header', True):
logoheader.header("") logoheader.header("")
if os.get_terminal_size().columns >= 120: if terminal_size >= 120:
if QUOTE[1]: # If there is an author to show for the quote if QUOTE[1]: # If there is an author to show for the quote
logger.info( logger.info(
"\u001b[33m\033[F" + bordered(QUOTE[0] + '\n -' + QUOTE[1]), "\u001b[33m\033[F" + bordered(QUOTE[0] + '\n -' + QUOTE[1]),
terminal=True) terminal=True)
else: else:
logger.info("\u001b[33m\033[F" + bordered(QUOTE[0]), terminal=True) logger.info(
"\u001b[33m\033[F" + bordered(QUOTE[0]), terminal=True)
else: else:
if QUOTE[1]: if QUOTE[1]:
logger.info("\u001b[33m\033[F" + QUOTE[0] + '\n -' + QUOTE[1], logger.info("\u001b[33m\033[F" + QUOTE[0] + '\n -' + QUOTE[1],
terminal=True) terminal=True)
else: else:
logger.info("\u001b[33m\033[F" + QUOTE[0], terminal=True) logger.info("\u001b[33m\033[F" + QUOTE[0], terminal=True)