add presentation base

This commit is contained in:
2025-05-02 22:05:45 +02:00
parent c074d4ee5c
commit 0f7ff2c3e9
12 changed files with 152 additions and 10 deletions

16
main.py
View File

@@ -1,8 +1,9 @@
from fastapi import FastAPI, Request, WebSocket, WebSocketDisconnect, BackgroundTasks
from fastapi.responses import JSONResponse
from fastapi.responses import HTMLResponse, JSONResponse
import logging
import uvicorn
from typing import Dict, List, Any
from dataclasses import dataclass
import json
import httpx
import asyncio
@@ -43,6 +44,19 @@ class ConnectionManager:
manager = ConnectionManager()
# Static files
def read_file(filepath: str) -> str:
with open(filepath, "r", encoding="utf-8") as f:
return f.read()
@dataclass
class StaticFiles:
index_html: str = read_file("static/index.html")
@app.get("/presentation/")
async def presentation_index(_: Request):
return HTMLResponse(status_code=200, content=StaticFiles.index_html)
# Endpoints
@app.post("/control")
async def control_endpoint(request: Request):