feat: 接入 DramaBox 并按语言地区切换清单

This commit is contained in:
Nixevol
2026-10-21 23:36:52 +08:00
parent 213614c735
commit 39774ad9cc
14 changed files with 1416 additions and 32 deletions
+27
View File
@@ -0,0 +1,27 @@
from server.services.dramabox.client import client
from server.services.dramabox.locales import DEFAULT_LANGUAGE, public_list
def languages() -> list[dict]:
return public_list()
def enter(language: str = "") -> dict:
return client.enter(language or client.language or DEFAULT_LANGUAGE)
def current(token: str) -> dict:
token = (token or "").strip()
if not token:
raise RuntimeError("请先选择地区")
if token != client.token or not client.profile:
raise RuntimeError("登录已失效")
return {"token": client.token, "profile": client.profile}
def logout(token: str) -> None:
if token and token == client.token:
client.clear()
return
if not token:
client.clear()