diff --git a/cista/api.py b/cista/api.py index 39a4a18..279fb1e 100644 --- a/cista/api.py +++ b/cista/api.py @@ -6,7 +6,7 @@ from sanic import Blueprint from cista import watching from cista.fileio import FileServer -from cista.protocol import ControlBase, FileRange, StatusMsg +from cista.protocol import ControlTypes, FileRange, StatusMsg from cista.util.apphelpers import asend, websocket_wrapper bp = Blueprint("api", url_prefix="/api") @@ -76,7 +76,7 @@ async def download(req, ws): @bp.websocket("control") @websocket_wrapper async def control(req, ws): - cmd = msgspec.json.decode(await ws.recv(), type=ControlBase) + cmd = msgspec.json.decode(await ws.recv(), type=ControlTypes) await asyncio.to_thread(cmd) await asend(ws, StatusMsg(status="ack", req=cmd)) diff --git a/cista/protocol.py b/cista/protocol.py index 9ab259b..4a5cf7c 100755 --- a/cista/protocol.py +++ b/cista/protocol.py @@ -78,6 +78,9 @@ class Cp(ControlBase): ) +ControlTypes = MkDir | Rename | Rm | Mv | Cp + + ## File uploads and downloads