From 15532234b68877c6ee695178e223c21d3e60c9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sat, 26 Nov 2022 16:33:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Update=20get=20cookie=20help=20m?= =?UTF-8?q?essage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/cookies.py | 63 +++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/plugins/genshin/cookies.py b/plugins/genshin/cookies.py index d1ae5f89..7c904c51 100644 --- a/plugins/genshin/cookies.py +++ b/plugins/genshin/cookies.py @@ -118,31 +118,44 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation): add_user_command_data.user = user_info add_user_command_data.region = region await message.reply_text(f"请输入{bbs_name}的Cookies!或回复退出取消操作", reply_markup=ReplyKeyboardRemove()) - javascript = ( - "javascript:(()=>{_=(n)=>{for(i in(r=document.cookie.split(';'))){var a=r[i].split('=');if(a[" - "0].trim()==n)return a[1]}};c=_('account_id')||alert('无效的Cookie,请重新登录!');c&&confirm(" - "'将Cookie复制到剪贴板?')&©(document.cookie)})(); " - ) - javascript_android = "javascript:(()=>{prompt('',document.cookie)})();" - help_message = ( - f"关于如何获取Cookies\n\n" - f"PC:\n" - f"1、打开 {bbs_name} 并登录\n" - "2、按F12打开开发者工具\n" - "3、将开发者工具切换至控制台(Console)\n" - "4、复制下方的代码,并将其粘贴在控制台中,按下回车\n" - f"
{javascript}
" - "Android:\n" - f"1、通过 Via 打开 {bbs_name} 并登录\n" - "2、复制下方的代码,并将其粘贴在地址栏中,点击右侧箭头\n" - f"{javascript_android}\n" - "iOS:\n" - "1、在App Store上安装Web Inspector,并在iOS设置- Safari浏览器-扩展-允许这些扩展下找到Web Inspector-打开,允许所有网站\n" - f"2、通过 Safari 打开 {bbs_name} 并登录\n" - "3、点击地址栏左侧的大小按钮 - Web Inspector扩展 - Console - 点击下方文本框复制下方代码粘贴:" - f"
{javascript}
" - "4、点击Console下的Execute" - ) + if bbs_name == "米游社": + help_message = ( + "关于如何获取Cookies\n" + "现在因为网站HttpOnly策略无法通过脚本获取,因此操作只能在PC上运行。\n\n" + "PC:\n" + f"1、打开 {bbs_name} 并登录\n" + "2、按F12打开开发者工具\n" + "3、将开发者工具切换至网络(Network)并🎨 Update help message点击过滤栏中的文档(Document)并刷新页面\n" + "4、在请求列表找到 /ys 并点击\n" + "5、找到并复制请求标头(Request Headers)中的Cookie\n" + "如发现没有请求标头(Request Headers)大概因为缓存的存在需要你点击禁用缓存(Disable Cache)再次刷新页面" + ) + else: + javascript = ( + "javascript:(()=>{_=(n)=>{for(i in(r=document.cookie.split(';'))){var a=r[i].split('=');if(a[" + "0].trim()==n)return a[1]}};c=_('account_id')||alert('无效的Cookie,请重新登录!');c&&confirm(" + "'将Cookie复制到剪贴板?')&©(document.cookie)})(); " + ) + javascript_android = "javascript:(()=>{prompt('',document.cookie)})();" + help_message = ( + f"关于如何获取Cookies\n\n" + f"PC:\n" + f"1、打开 {bbs_name} 并登录\n" + "2、按F12打开开发者工具\n" + "3、将开发者工具切换至控制台(Console)\n" + "4、复制下方的代码,并将其粘贴在控制台中,按下回车\n" + f"
{javascript}
" + "Android:\n" + f"1、通过 Via 打开 {bbs_name} 并登录\n" + "2、复制下方的代码,并将其粘贴在地址栏中,点击右侧箭头\n" + f"{javascript_android}\n" + "iOS:\n" + "1、在App Store上安装Web Inspector,并在iOS设置- Safari浏览器-扩展-允许这些扩展下找到Web Inspector-打开,允许所有网站\n" + f"2、通过 Safari 打开 {bbs_name} 并登录\n" + "3、点击地址栏左侧的大小按钮 - Web Inspector扩展 - Console - 点击下方文本框复制下方代码粘贴:" + f"
{javascript}
" + "4、点击Console下的Execute" + ) await message.reply_html(help_message, disable_web_page_preview=True) return INPUT_COOKIES