This commit is contained in:
Your Name
2026-07-28 11:49:36 +08:00
parent f99a4edf83
commit ac406a5f99
5 changed files with 132 additions and 11 deletions
+18 -3
View File
@@ -770,13 +770,18 @@ def _get_account_cookie_data(account: Account) -> Optional[str]:
return read_cookie_file(account.id)
async def _build_cookie_response(account: Account, cookie_data: Optional[str] = None) -> AccountCookieResponse:
async def _build_cookie_response(
account: Account,
cookie_data: Optional[str] = None,
*,
runtime_check: bool = True,
) -> AccountCookieResponse:
cookie_data = cookie_data if cookie_data is not None else _get_account_cookie_data(account)
summary = cookie_summary(cookie_data)
im_detail = await build_cookie_credential_detail(
cookie_data,
account.im_session_data,
runtime_check=True,
runtime_check=runtime_check,
)
return AccountCookieResponse(
account_id=account.id,
@@ -1608,7 +1613,17 @@ async def get_account_cookie(
cookie_data = _get_account_cookie_data(account)
if cookie_data and purpose != "management":
await _require_desktop_login_sec_user_id(account, db)
return await _build_cookie_response(account, cookie_data)
return await _build_cookie_response(
account,
cookie_data,
# Opening the edit dialog is a read-only management action. A live
# Douyin credential probe can take many seconds and, with hundreds of
# hosted accounts, would wait behind recurring background traffic.
# The dialog only needs the locally stored credential fields; users
# can still request an authoritative online check with the explicit
# "recheck credential" action.
runtime_check=purpose != "management",
)
@app.get(