Initial commit: LiveStream Platform

Backend: FastAPI + SQLAlchemy + SQLite
Frontend: React + Vite + Ant Design (serif Anthropic theme)
Media server: MediaMTX with edge node support
Load balancing: round-robin / weighted / least-conn
Multicast detection with automatic fallback
Transcoding support via FFmpeg (configurable quality)
hls.js player with line & quality switching
Admin panel with password auth
Windows compatible scripts
This commit is contained in:
admin committed 2026-08-07 15:02:07 +08:00
commit 2e4594fa77
43 files changed
+2196

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import hashlib
from fastapi import APIRouter, HTTPException, Depends
from fastapi.responses import JSONResponse
from config import settings
router = APIRouter(prefix="/api/auth", tags=["auth"])
_tokens: set[str] = set()
def hash_password(pw: str) -> str:
return hashlib.sha256(f"{pw}:livestream-salt".encode()).hexdigest()
ADMIN_HASH = hash_password(settings.admin_password)
@router.post("/login")
async def login(password: str):
if hash_password(password) != ADMIN_HASH:
raise HTTPException(status_code=401, detail="Invalid password")
token = hashlib.sha256(f"{password}:token".encode()).hexdigest()
_tokens.add(token)
return {"token": token}
@router.post("/verify")
async def verify(token: str):
if token not in _tokens:
raise HTTPException(status_code=401, detail="Invalid token")
return {"valid": True}