diff --git a/requirements.txt b/requirements.txt index b3df57ea..81669ff1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ websocket_client gevent-ws coincurve maxminddb +rich diff --git a/src/Config.py b/src/Config.py index 66b92be6..4463460a 100644 --- a/src/Config.py +++ b/src/Config.py @@ -13,9 +13,9 @@ import time class Config(object): def __init__(self, argv): - self.version = "0.7.4" + self.version = "0.7.4+" # DEPRECATED ; replace with git-generated commit - self.rev = 5003 + self.rev = 5004 self.argv = argv self.action = None self.test_parser = None diff --git a/zeronet.py b/zeronet.py index 2a4194f5..36b2ed74 100755 --- a/zeronet.py +++ b/zeronet.py @@ -1,7 +1,43 @@ #!/usr/bin/env python3 import os import sys +from src.Config import config +def grad(n): + s = 0x08 + r = 0xff + g = 0x00 + b = 0x00 + for i in range(n): + if r >= s and b < s: + r -= s + g += s + elif g >= s and r < s: + g -= s + b += s + elif b >= s and g < s: + b -= s + r += s + return f'#{r:02x}{g:02x}{b:02x}' + +def fancy_greet(): + from rich.console import Console + from rich.text import Text + zc_msg = f''' +||| __. _. . _ . . _ _. _|_ _. . . _ .-- _. . _ . . __. . _ _. . . +||| / /_| |/ / \ |/ | /_| | == / / \ |/ | \ /_| |/ | | __| |/ | / \_| +||| /_. \_ | \_/ | | \_ |. \__ \_/ | | ._| \_ | \/ |__| | | \__ | +||| _/ +||| v{config.version} +''' + lns = zc_msg.split('\n') + console = Console() + for l in lns: + txt = Text(l) + txt.stylize('bold') + for i in range(len(l)): + txt.stylize(grad(i), i, i+1) + console.print(txt) def main(): if sys.version_info.major < 3: @@ -9,7 +45,7 @@ def main(): sys.exit(0) if "--silent" not in sys.argv: - print("- Starting zeronet-conservancy...") + fancy_greet() main = None try: @@ -23,7 +59,6 @@ def main(): except Exception as log_err: print("Failed to log error:", log_err) traceback.print_exc() - from Config import config error_log_path = config.log_dir + "/error.log" traceback.print_exc(file=open(error_log_path, "w")) print("---")