feat: 完成登录与栅格下载桌面端

This commit is contained in:
2026-10-25 02:09:12 +08:00
commit 5ca491834e
76 changed files with 10637 additions and 0 deletions
View File
+5
View File
@@ -0,0 +1,5 @@
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[3]
DATA_ROOT = REPO_ROOT / "data"
DOWNLOAD_DIR = DATA_ROOT / "jobs"
+20
View File
@@ -0,0 +1,20 @@
from fastapi import HTTPException
from app.features.download.jobs import JobManager
from app.platform.client import LoginChallenge, NqiClient
class AppState:
def __init__(self) -> None:
self.flows: dict[str, tuple[NqiClient, LoginChallenge]] = {}
self.client: NqiClient | None = None
self.user: dict | None = None
self.jobs = JobManager()
def require_client(self) -> NqiClient:
if self.client is None or self.user is None:
raise HTTPException(status_code=401, detail="请先登录")
return self.client
state = AppState()