diff --git a/flake.nix b/flake.nix index 72b1ca2..62f27a9 100644 --- a/flake.nix +++ b/flake.nix @@ -28,14 +28,14 @@ packages = forEachSupportedSystem ( {pkgs, ...}: { - default = pkgs.python3Packages.buildPythonPackage { + default = pkgs.python314Packages.buildPythonPackage { pname = "atbbs"; version = "dev"; src = ./.; pyproject = true; - build-system = [pkgs.python3Packages.hatchling]; + build-system = [pkgs.python314Packages.hatchling]; - dependencies = with pkgs.python3Packages; [ + dependencies = with pkgs.python314Packages; [ aiohttp authlib httpx diff --git a/pyproject.toml b/pyproject.toml index 27d3e12..6a05548 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ build-backend = "hatchling.build" [project.scripts] atbbs = "cli.__main__:main" +atbbs-telnet = "telnet.server:main" [tool.hatch.build.targets.wheel] packages = ["cli", "core", "telnet", "tui"] diff --git a/telnet/server.py b/telnet/server.py index 86cf2f3..941febb 100644 --- a/telnet/server.py +++ b/telnet/server.py @@ -81,7 +81,7 @@ async def write(writer: asyncio.StreamWriter, text: str): async def prompt( - reader: asyncio.streamReader, writer: asyncio.StreamWriter, label: str = "> " + reader: asyncio.StreamReader, writer: asyncio.StreamWriter, label: str = "> " ) -> str: """Handle prompt + inactivity timeouts safely.""" await write(writer, label) @@ -292,12 +292,16 @@ async def handle_client(reader: asyncio.StreamReader, writer: asyncio.StreamWrit writer.close() -async def main(host: str = "0.0.0.0", port: int = 2323): +async def _main(host: str = "0.0.0.0", port: int = 2323): server = await asyncio.start_server(handle_client, host, port, limit=256) print(f"Telnet BBS gateway listening on {host}:{port}") async with server: await server.serve_forever() +def main(): + asyncio.run(_main()) + + if __name__ == "__main__": - asyncio.run(main()) + main()