diff --git a/core_common.py b/core_common.py index dbdb670..8817cc3 100644 --- a/core_common.py +++ b/core_common.py @@ -140,7 +140,8 @@ async def core_process_request(request): request.is_binxml = KBinXML.is_binary_xml(xml_dec) if config.verbose_log: - print("Request:") + print() + print("\033[94mREQUEST\033[0m:") print(xml_text) model_parts = (root.attrib["model"], *root.attrib["model"].split(":")) @@ -173,7 +174,7 @@ async def core_prepare_response(request, xml): xml_binary = binxml.to_text().encode("utf-8") # TODO: Proper encoding if config.verbose_log: - print("Response:") + print("\033[91mRESPONSE\033[0m:") print(binxml.to_text()) response_headers = {"User-Agent": "EAMUSE.Httpac/1.0"} diff --git a/pyeamu.py b/pyeamu.py index d60a331..515f583 100644 --- a/pyeamu.py +++ b/pyeamu.py @@ -3,7 +3,7 @@ from urllib.parse import urlunparse, urlencode import uvicorn import ujson as json -from os import path +from os import name, path from fastapi import FastAPI, Request, Response from fastapi.middleware.cors import CORSMiddleware @@ -65,28 +65,34 @@ else: return RedirectResponse(url="/config") +# Enable ANSI escape sequences +if name == "nt": + import ctypes + + kernel32 = ctypes.windll.kernel32 + kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7) + + if __name__ == "__main__": - print(" __ __ _ ") - print("| \/ | ___ _ __ | | _____ _ _ ") - print("| |\/| |/ _ \| '_ \| |/ / _ \ | | |") - print("| | | | (_) | | | | < __/ |_| |") - print("|_| |_|\___/|_| |_|_|\_\___|\__, |") - print(" |___/ ") - print(" ____ _ ") - print("| __ ) _ _ ___(_)_ __ ___ ___ ___ ") - print("| _ \| | | / __| | '_ \ / _ \/ __/ __|") - print("| |_) | |_| \__ \ | | | | __/\__ \__ \\") - print("|____/ \__,_|___/_|_| |_|\___||___/___/") + print( + """ + █▄ ▄█ █▀█ █▄ █ █▄▀ ▀██ ▀▄▀ + █ ▀ █ █▄█ █ ▀█ █ █ ▄▄█ █ + + ██▄ █ █ ▄▀▀ ▄█ █▄ █ ▀██ ▀█▀ + █▄█ ▀▄█ ▄██ █ █ ▀█ ▄▄█ █▄▄ +""" + ) print() - print("Game Config:") - print(f"{server_services_url}") - print('1') + print("\033[1mGame Config\033[0m:") + print(f"\033[92m{server_services_url}\033[0m") + print('\033[92m1\033[0m') print() if webui: - print("Web Interface:") + print("\033[1mWeb Interface\033[0m:") print(f"http://{server_address}/webui/") print() - print("Source Repository:") + print("\033[1mSource Repository\033[0m:") print("https://github.com/drmext/MonkeyBusiness") print() uvicorn.run("pyeamu:app", host=config.ip, port=config.port, reload=True)