From a44892c0971db379dcb362e8f7dcb6dce77891f9 Mon Sep 17 00:00:00 2001 From: drmext <71258889+drmext@users.noreply.github.com> Date: Sun, 27 Sep 2026 18:31:45 +0000 Subject: [PATCH] Fix --- main.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..8534c8a --- /dev/null +++ b/main.py @@ -0,0 +1,63 @@ +"""Server entrypoint: banner + uvicorn.""" + +from __future__ import annotations + +import socket +from os import name +from urllib.parse import urlunparse + +import uvicorn + +import config +from pyeamu import has_webui + +loopback_hosts = ("localhost", config.ip, socket.gethostname()) +server_addresses = [f"{host}:{config.port}" for host in loopback_hosts] +server_services_urls = [ + urlunparse(("http", addr, "/core", None, None, None)) for addr in server_addresses +] + + +def main() -> None: + if name == "nt": + import ctypes + + kernel32 = ctypes.windll.kernel32 + kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7) + + print( + """ + █▄ ▄█ █▀█ █▄ █ █▄▀ ▀██ ▀▄▀ + █ ▀ █ █▄█ █ ▀█ █ █ ▄▄█ █ + + ██▄ █ █ ▄▀▀ ▄█ █▄ █ ▀██ ▀█▀ + █▄█ ▀▄█ ▄██ █ █ ▀█ ▄▄█ █▄▄ +""" + ) + print() + print("\033[1mGame Config\033[0m:") + for server_services_url in server_services_urls: + print(f"\033[92m{server_services_url}\033[0m") + print("") + print() + print("\033[1mWeb Interface\033[0m:") + if has_webui: + for server_address in server_addresses: + print(f"http://{server_address}/webui/") + else: + print("/webui missing") + print("download it here: https://github.com/drmext/BounceTrippy/releases") + print() + print("\033[1mSource Repository\033[0m:") + print("https://github.com/drmext/MonkeyBusiness") + print() + uvicorn.run( + "pyeamu:app", + host="0.0.0.0", + port=config.port, + reload=config.dev_reload, + ) + + +if __name__ == "__main__": + main()