Frontend created and rewritten a few times, with some backend fixes #1
|
@ -76,9 +76,10 @@ async def download(req, ws):
|
||||||
@bp.websocket("control")
|
@bp.websocket("control")
|
||||||
@websocket_wrapper
|
@websocket_wrapper
|
||||||
async def control(req, ws):
|
async def control(req, ws):
|
||||||
cmd = msgspec.json.decode(await ws.recv(), type=ControlTypes)
|
while True:
|
||||||
await asyncio.to_thread(cmd)
|
cmd = msgspec.json.decode(await ws.recv(), type=ControlTypes)
|
||||||
await asend(ws, StatusMsg(status="ack", req=cmd))
|
await asyncio.to_thread(cmd)
|
||||||
|
await asend(ws, StatusMsg(status="ack", req=cmd))
|
||||||
|
|
||||||
|
|
||||||
@bp.websocket("watch")
|
@bp.websocket("watch")
|
||||||
|
|
|
@ -9,7 +9,6 @@ from sanic.exceptions import Forbidden, NotFound
|
||||||
|
|
||||||
from cista import auth, config, session, watching
|
from cista import auth, config, session, watching
|
||||||
from cista.api import bp
|
from cista.api import bp
|
||||||
from cista.util import filename
|
|
||||||
from cista.util.apphelpers import handle_sanic_exception
|
from cista.util.apphelpers import handle_sanic_exception
|
||||||
|
|
||||||
app = Sanic("cista", strict_slashes=True)
|
app = Sanic("cista", strict_slashes=True)
|
||||||
|
@ -90,12 +89,14 @@ def load_wwwroot(app):
|
||||||
wwwnew[name] = data, br, mime
|
wwwnew[name] = data, br, mime
|
||||||
www = wwwnew
|
www = wwwnew
|
||||||
|
|
||||||
|
|
||||||
@app.add_task
|
@app.add_task
|
||||||
async def refresh_wwwroot():
|
async def refresh_wwwroot():
|
||||||
while app.debug:
|
while app.debug:
|
||||||
await asyncio.sleep(0.5)
|
await asyncio.sleep(0.5)
|
||||||
load_wwwroot(app)
|
load_wwwroot(app)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/<path:path>", static=True)
|
@app.get("/<path:path>", static=True)
|
||||||
async def wwwroot(req, path=""):
|
async def wwwroot(req, path=""):
|
||||||
"""Frontend files only"""
|
"""Frontend files only"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user