Frontend created and rewritten a few times, with some backend fixes #1
|
@ -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))
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@ class Cp(ControlBase):
|
|||
)
|
||||
|
||||
|
||||
ControlTypes = MkDir | Rename | Rm | Mv | Cp
|
||||
|
||||
|
||||
## File uploads and downloads
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user