diff --git a/__pycache__/main.cpython-313.pyc b/__pycache__/main.cpython-313.pyc index 5b3788c..6cf9dc6 100644 Binary files a/__pycache__/main.cpython-313.pyc and b/__pycache__/main.cpython-313.pyc differ diff --git a/main.py b/main.py index 1b17bf0..3773f47 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,8 @@ from problem_generator import generate_problem from steps_generator import generate_steps from sympy import init_printing, sympify from fastapi import FastAPI, WebSocket, WebSocketDisconnect +from fastapi.staticfiles import StaticFiles +from fastapi.responses import RedirectResponse logging.basicConfig( level=logging.INFO, @@ -19,11 +21,14 @@ logging.basicConfig( ) log = logging.getLogger(__name__) - app = FastAPI() - clients = [] +app.mount("/static", StaticFiles(directory="www"), name="static") +@app.get("/static") +def static_root(): + return RedirectResponse(url="/static/index.html") + @app.websocket("/ws") async def websocket_endpoint(ws: WebSocket): await ws.accept() diff --git a/requirements.txt b/requirements.txt index f0a4901..6965028 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ sympy fastapi -uvicorn \ No newline at end of file +uvicorn +uvicorn[standard] \ No newline at end of file diff --git a/www/overlay.html b/www/index.html similarity index 100% rename from www/overlay.html rename to www/index.html diff --git a/www/scripts/web_sockets.js b/www/scripts/web_sockets.js index e46101a..b0c997a 100644 --- a/www/scripts/web_sockets.js +++ b/www/scripts/web_sockets.js @@ -1,4 +1,5 @@ -const socket = new WebSocket("ws://localhost:8000/ws"); +//const socket = new WebSocket("ws://localhost:8000/ws"); +const socket = new WebSocket("ws://10.0.0.50:8000/ws"); let problemData = null; let stepIndex = 0;