fix(douyu): reject invalid activity cookies

This commit is contained in:
yml2213
2026-08-28 15:51:59 +08:00
parent 9ee4e49a50
commit 6ded82ac8b
5 changed files with 135 additions and 14 deletions
+8 -3
View File
@@ -145,9 +145,9 @@ def ensure_douyu_config(db: Session) -> DouyuConfig:
return config
def latest_success_cookie(db: Session, account_id: int) -> str:
"""读取账号最近一次成功登录 Cookie"""
task = (
def latest_success_login_task(db: Session, account_id: int) -> LoginTask | None:
"""读取账号最近一次成功登录记录"""
return (
db.query(LoginTask)
.filter(
LoginTask.account_id == account_id,
@@ -157,6 +157,11 @@ def latest_success_cookie(db: Session, account_id: int) -> str:
.order_by(LoginTask.id.desc())
.first()
)
def latest_success_cookie(db: Session, account_id: int) -> str:
"""读取账号最近一次成功登录 Cookie。"""
task = latest_success_login_task(db, account_id)
return task.cookie if task else ""