feat: 补齐桌面端下载播放,并将窗口改为夜间主题和应用图标

This commit is contained in:
Nixevol
2026-09-27 06:16:50 +08:00
parent f010426f94
commit 1b33898fff
81 changed files with 2529 additions and 232 deletions
+33
View File
@@ -0,0 +1,33 @@
import asyncio
from fastapi import APIRouter, WebSocket, WebSocketDisconnect
from server.services.downloads import downloads
from server.services.live import live
from server.services.sessions import sessions
router = APIRouter()
def _payload() -> dict:
profile = sessions.snapshot()
return {
"downloads": downloads.snapshot(),
"profile": profile["profile"] if profile else None,
}
@router.websocket("/api/live")
async def live_socket(websocket: WebSocket):
await websocket.accept()
seen = -1
try:
while True:
revision = await asyncio.to_thread(live.wait, seen, 20)
if revision != seen:
seen = revision
await websocket.send_json(_payload())
else:
await websocket.send_json({"type": "ping"})
except WebSocketDisconnect:
return