fix: harden auto-login selectors and poll auth status
Some checks failed
CI / lint-and-compile (push) Has been cancelled
CI / lint-and-compile (pull_request) Has been cancelled

This commit is contained in:
root
2026-04-17 14:40:28 +08:00
parent b621c4aca7
commit 5f0c1866a6
2 changed files with 57 additions and 3 deletions

View File

@@ -33,6 +33,12 @@ def auth_guard(request: Request):
require_bearer(request, settings.api_keys)
async def _is_logged_in() -> bool:
assert lingma is not None
st = await lingma.auth_status()
return bool(st and st.get("id"))
@app.on_event("startup")
async def on_startup():
global lingma, auto_login
@@ -52,6 +58,8 @@ async def on_startup():
headless=settings.auto_login_headless,
timeout_sec=settings.auto_login_timeout,
max_retry=settings.auto_login_max_retry,
verify_logged_in=_is_logged_in,
verify_timeout_sec=max(30, min(180, settings.auto_login_timeout)),
)