diff --git a/src/shellmate/ssh/server.py b/src/shellmate/ssh/server.py index cff90ca..0997180 100644 --- a/src/shellmate/ssh/server.py +++ b/src/shellmate/ssh/server.py @@ -65,36 +65,7 @@ async def handle_client(process: asyncssh.SSHServerProcess) -> None: mode = "play" try: - from shellmate.tui.app import ShellMateApp - - # Set environment for Textual - os.environ["TERM"] = term_type - os.environ["COLORTERM"] = "truecolor" - - app = ShellMateApp(username=username, mode=mode) - - # Run the app with the SSH process I/O - # Use headless driver with the process stdin/stdout - from textual.drivers.headless_driver import HeadlessDriver - from io import StringIO - - # Create a wrapper that bridges asyncssh to textual - class SSHDriver(HeadlessDriver): - def __init__(self, app, process, size): - super().__init__(app, size=size) - self._process = process - - def write(self, data: str) -> None: - try: - self._process.stdout.write(data) - except Exception: - pass - - driver = SSHDriver(app, process, (width, height)) - await app._run_async(driver=driver) - - except ImportError: - # Fallback to simple Rich-based menu + # Use simple Rich-based menu (more reliable over SSH) await run_simple_menu(process, username, mode, width, height) except Exception as e: logger.exception(f"Error in ShellMate session: {e}")