Frontend created and rewritten a few times, with some backend fixes #1
|
@ -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")
|
||||
|
|
|
@ -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("/<path:path>", static=True)
|
||||
async def wwwroot(req, path=""):
|
||||
"""Frontend files only"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user