diff --git a/backend/main.py b/backend/main.py index 4891bef..e48d11f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,4 +1,4 @@ -import asyncio +import asyncio import json import os import tempfile @@ -368,8 +368,11 @@ async def ws_terminal(websocket: WebSocket): async def ws_to_ssh(): try: while True: - data = await websocket.receive_bytes() - channel.send(data) + msg = await websocket.receive() + if "bytes" in msg and msg["bytes"]: + channel.send(msg["bytes"]) + elif "text" in msg and msg["text"]: + channel.send(msg["text"].encode()) except WebSocketDisconnect: pass