add presentation base
This commit is contained in:
16
main.py
16
main.py
@@ -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):
|
||||
|
Reference in New Issue
Block a user