jdeip/app/main.py

31 lines
785 B
Python
Raw Normal View History

2025-10-21 20:04:19 +08:00
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
from fastapi.staticfiles import StaticFiles
from fastapi.responses import HTMLResponse
from .config import settings
from .routers.proxy import router as proxy_router
app = FastAPI(title="EIP Rotation Service")
2025-10-21 20:04:19 +08:00
# 设置模板目录
templates = Jinja2Templates(directory="app/templates")
@app.get("/health")
def health_check():
return {"status": "ok"}
2025-10-21 20:04:19 +08:00
@app.get("/", response_class=HTMLResponse)
async def index(request: Request, id: str = None):
"""主页 - IP轮换控制面板"""
return templates.TemplateResponse("index.html", {
"request": request,
"client_id": id or "1" # 默认ID为1
})
app.include_router(proxy_router, prefix="/proxy", tags=["proxy"])