mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-22 07:07:46 +00:00
🎨 Delete the login_ticket
after use
This commit is contained in:
parent
bb42787fbd
commit
4cd8eda043
@ -1,4 +1,3 @@
|
|||||||
import contextlib
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
@ -265,16 +264,22 @@ class AccountCookiesPlugin(Plugin.Conversation):
|
|||||||
logger.debug("用户 %s[%s] Cookies错误", user.full_name, user.id, exc_info=exc)
|
logger.debug("用户 %s[%s] Cookies错误", user.full_name, user.id, exc_info=exc)
|
||||||
await message.reply_text("Cookies错误,请检查是否正确", reply_markup=ReplyKeyboardRemove())
|
await message.reply_text("Cookies错误,请检查是否正确", reply_markup=ReplyKeyboardRemove())
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
with contextlib.suppress(Exception):
|
if cookies.login_ticket is not None:
|
||||||
if cookies.login_ticket is not None:
|
try:
|
||||||
auth_client = AuthClient(cookies=cookies)
|
if cookies.login_ticket is not None:
|
||||||
if await auth_client.get_stoken_by_login_ticket():
|
auth_client = AuthClient(cookies=cookies)
|
||||||
logger.success("用户 %s[%s] 绑定时获取 stoken 成功", user.full_name, user.id)
|
if await auth_client.get_stoken_by_login_ticket():
|
||||||
if await auth_client.get_cookie_token_by_stoken():
|
logger.success("用户 %s[%s] 绑定时获取 stoken 成功", user.full_name, user.id)
|
||||||
logger.success("用户 %s[%s] 绑定时获取 cookie_token 成功", user.full_name, user.id)
|
if await auth_client.get_cookie_token_by_stoken():
|
||||||
if await auth_client.get_ltoken_by_stoken():
|
logger.success("用户 %s[%s] 绑定时获取 cookie_token 成功", user.full_name, user.id)
|
||||||
logger.success("用户 %s[%s] 绑定时获取 ltoken 成功", user.full_name, user.id)
|
if await auth_client.get_ltoken_by_stoken():
|
||||||
auth_client.cookies.remove_v2()
|
logger.success("用户 %s[%s] 绑定时获取 ltoken 成功", user.full_name, user.id)
|
||||||
|
auth_client.cookies.remove_v2()
|
||||||
|
except Exception as exc: # pylint: disable=W0703
|
||||||
|
logger.error("绑定时获取新Cookie失败 [%s]", (str(exc)))
|
||||||
|
finally:
|
||||||
|
cookies.login_ticket = None
|
||||||
|
cookies.login_uid = None
|
||||||
genshin_account: Optional[GenshinAccount] = None
|
genshin_account: Optional[GenshinAccount] = None
|
||||||
level: int = 0
|
level: int = 0
|
||||||
# todo : 多账号绑定
|
# todo : 多账号绑定
|
||||||
|
Loading…
Reference in New Issue
Block a user