From 90474a256f02401cba2803d97c9b2b59cde310f5 Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Thu, 3 Apr 2025 10:07:00 -0400 Subject: [PATCH] react 19 + jsx --- webcap/server/server.py | 16 +- webcap/server/templates/index.html | 649 ++++++++++++++++------------- 2 files changed, 358 insertions(+), 307 deletions(-) diff --git a/webcap/server/server.py b/webcap/server/server.py index c73c98b..0c114ce 100644 --- a/webcap/server/server.py +++ b/webcap/server/server.py @@ -1,8 +1,8 @@ import os from pathlib import Path -from fastapi import FastAPI, Request +from fastapi import FastAPI, Request, Response from fastapi.staticfiles import StaticFiles -from fastapi.templating import Jinja2Templates +from fastapi.responses import FileResponse from webcap.errors import ScreenshotDirError @@ -22,13 +22,7 @@ app.mount("/static", StaticFiles(directory=Path(__file__).parent / "static"), name="static") -templates_dir = Path(__file__).parent / "templates" -print(f"Resolved templates directory: {templates_dir}") - -# serve root page -templates = Jinja2Templates(directory=templates_dir) - - @app.get("/") -async def read_root(request: Request): - return templates.TemplateResponse("index.html", {"request": request}) +async def read_root(): + # Directly serve the HTML file using FileResponse + return FileResponse(Path(__file__).parent / "templates" / "index.html") diff --git a/webcap/server/templates/index.html b/webcap/server/templates/index.html index db9725a..e818317 100644 --- a/webcap/server/templates/index.html +++ b/webcap/server/templates/index.html @@ -157,11 +157,15 @@
- - + + + + -