mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-07-29 23:39:15 +02:00
add web.js and also change how does the web html look
This commit is contained in:
+9
-1
@@ -113,7 +113,7 @@ def websocket_server_process(shared_data: dict, imc_q: multiprocessing.Queue, ws
|
||||
await websocket.close(1001, "")
|
||||
clients.discard(websocket)
|
||||
async def process_request(websocket: ServerConnection, request: Request):
|
||||
if request.path == "/" and (file := Path(__file__, "..", "web.html").resolve()).exists():
|
||||
if request.path == "/" and (file := Path(__file__, "..", "web.html")).exists():
|
||||
data = file.read_bytes()
|
||||
return Response(
|
||||
200,
|
||||
@@ -121,6 +121,14 @@ def websocket_server_process(shared_data: dict, imc_q: multiprocessing.Queue, ws
|
||||
Headers([("Content-Type", "text/html"), ("Content-Length", f"{len(data)}")]),
|
||||
data
|
||||
)
|
||||
if request.path == "/web.js" and (file := Path(__file__, "..", "web.js")).exists():
|
||||
data = file.read_bytes()
|
||||
return Response(
|
||||
200,
|
||||
"OK",
|
||||
Headers([("Content-Type", "text/javascript"), ("Content-Length", f"{len(data)}")]),
|
||||
data
|
||||
)
|
||||
if request.path == "/ws":
|
||||
if not "upgrade" in request.headers.get("Connection", "").lower():
|
||||
return Response(
|
||||
|
||||
Reference in New Issue
Block a user