更新
This commit is contained in:
@@ -161,7 +161,13 @@ async def validate_im_session(
|
||||
auth = DouyinAuth.from_im_session(session)
|
||||
# 优先用已持久化的 my_uid,避免每次都发起网络 query_my_uid(uid_tt 是加密串,
|
||||
# int() 解析必然失败而回退到网络请求;该请求偶发失败会误判为“未就绪”)。
|
||||
uid = session.my_uid or auth.get_uid()
|
||||
uid = session.my_uid
|
||||
if not uid:
|
||||
# get_uid() may fall back to a synchronous HTTP request with a
|
||||
# multi-second timeout. Keep that work off FastAPI's event loop
|
||||
# so a manual credential recheck cannot freeze account editing or
|
||||
# unrelated API requests.
|
||||
uid = await asyncio.to_thread(auth.get_uid)
|
||||
if not uid:
|
||||
return False, "服务端未认可当前 Cookie(无法获取用户 UID)"
|
||||
if not auth.is_sign_ready():
|
||||
|
||||
Reference in New Issue
Block a user