diff --git a/cista/api.py b/cista/api.py index 279fb1e..eb197a6 100644 --- a/cista/api.py +++ b/cista/api.py @@ -76,9 +76,10 @@ async def download(req, ws): @bp.websocket("control") @websocket_wrapper async def control(req, ws): - cmd = msgspec.json.decode(await ws.recv(), type=ControlTypes) - await asyncio.to_thread(cmd) - await asend(ws, StatusMsg(status="ack", req=cmd)) + while True: + cmd = msgspec.json.decode(await ws.recv(), type=ControlTypes) + await asyncio.to_thread(cmd) + await asend(ws, StatusMsg(status="ack", req=cmd)) @bp.websocket("watch") diff --git a/cista/app.py b/cista/app.py index a58ae3b..2af913b 100755 --- a/cista/app.py +++ b/cista/app.py @@ -9,7 +9,6 @@ from sanic.exceptions import Forbidden, NotFound from cista import auth, config, session, watching from cista.api import bp -from cista.util import filename from cista.util.apphelpers import handle_sanic_exception app = Sanic("cista", strict_slashes=True) @@ -90,12 +89,14 @@ def load_wwwroot(app): wwwnew[name] = data, br, mime www = wwwnew + @app.add_task async def refresh_wwwroot(): while app.debug: await asyncio.sleep(0.5) load_wwwroot(app) + @app.get("/", static=True) async def wwwroot(req, path=""): """Frontend files only"""