mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-22 07:07:46 +00:00
🐛 fix cookies
Co-authored-by: 洛水居室 <luoshuijs@outlook.com>
This commit is contained in:
parent
eebc283f2f
commit
4543377462
@ -1,19 +1,20 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
from http.cookies import SimpleCookie, CookieError
|
import re
|
||||||
from typing import Optional, Dict
|
from http.cookies import CookieError, SimpleCookie
|
||||||
|
from typing import Dict, Optional
|
||||||
|
|
||||||
import genshin
|
import genshin
|
||||||
from genshin import InvalidCookies, GenshinException, DataNotPublic, types
|
from genshin import DataNotPublic, GenshinException, InvalidCookies, types
|
||||||
from genshin.models import GenshinAccount
|
from genshin.models import GenshinAccount
|
||||||
from telegram import Update, ReplyKeyboardRemove, ReplyKeyboardMarkup, TelegramObject
|
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, TelegramObject, Update
|
||||||
from telegram.ext import CallbackContext, filters, ConversationHandler
|
from telegram.ext import CallbackContext, ConversationHandler, filters
|
||||||
from telegram.helpers import escape_markdown
|
from telegram.helpers import escape_markdown
|
||||||
|
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
from core.cookies.error import CookiesNotFoundError
|
from core.cookies.error import CookiesNotFoundError
|
||||||
from core.cookies.models import Cookies
|
from core.cookies.models import Cookies
|
||||||
from core.cookies.services import CookiesService
|
from core.cookies.services import CookiesService
|
||||||
from core.plugin import Plugin, handler, conversation
|
from core.plugin import Plugin, conversation, handler
|
||||||
from core.user.error import UserNotFoundError
|
from core.user.error import UserNotFoundError
|
||||||
from core.user.models import User
|
from core.user.models import User
|
||||||
from core.user.services import UserService
|
from core.user.services import UserService
|
||||||
@ -57,7 +58,8 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
cookies["account_id"] = ltuid.value
|
cookies["account_id"] = ltuid.value
|
||||||
if login_uid:
|
if login_uid:
|
||||||
cookies["ltuid"] = login_uid.value
|
cookies["ltuid"] = login_uid.value
|
||||||
cookies["account_id"] = ltuid.value
|
if ltuid:
|
||||||
|
cookies["account_id"] = ltuid.value
|
||||||
cookie_token = cookie.get("cookie_token")
|
cookie_token = cookie.get("cookie_token")
|
||||||
cookie_token_v2 = cookie.get("cookie_token_v2")
|
cookie_token_v2 = cookie.get("cookie_token_v2")
|
||||||
if cookie_token:
|
if cookie_token:
|
||||||
@ -276,7 +278,8 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
if message.text == "退出":
|
if message.text == "退出":
|
||||||
await message.reply_text("退出任务", reply_markup=ReplyKeyboardRemove())
|
await message.reply_text("退出任务", reply_markup=ReplyKeyboardRemove())
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
str_cookies = message.text
|
str_cookies = re.sub(r"(\s*\S*?=\{.*?};?\s*)", " ", message.text, 0)
|
||||||
|
|
||||||
cookie = SimpleCookie()
|
cookie = SimpleCookie()
|
||||||
try:
|
try:
|
||||||
cookie.load(str_cookies)
|
cookie.load(str_cookies)
|
||||||
|
Loading…
Reference in New Issue
Block a user