feat: 接入 DramaBox 并按语言地区切换清单
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user