From 92ef325f2143a7484f1e8a4b3a088db4e79ca738 Mon Sep 17 00:00:00 2001 From: blackmatrix7 <27717518+blackmatrix7@users.noreply.github.com> Date: Fri, 23 Apr 2021 17:39:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E7=89=88=E8=B4=B4?= =?UTF-8?q?=E5=90=A7=E8=8E=B7=E5=8F=96Cookie=E6=8E=A5=E5=8F=A3=20close=20#?= =?UTF-8?q?317?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/tieba/tieba_checkin.js | 5 +++-- script/tieba/tieba_checkin.lnscript | 3 ++- script/tieba/tieba_checkin.qxrewrite | 3 ++- script/tieba/tieba_checkin.sgmodule | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/script/tieba/tieba_checkin.js b/script/tieba/tieba_checkin.js index f503a6b6d..f7fb1ec12 100644 --- a/script/tieba/tieba_checkin.js +++ b/script/tieba/tieba_checkin.js @@ -7,7 +7,8 @@ const batchSize = 20; const retries = 5; // 签到失败重试次数 const interval = 2000; // 每次重试间隔 const tiebaCookieKey = "tieba_checkin_cookie"; -const tiebeGetCookieRegex = /https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login/; +const tiebeGetCookieRegex = /https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login/; +const tiebeNewVersionGetCookieRegex = /^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig/; let magicJS = MagicJS(scirptName, "INFO"); magicJS.unifiedPushUrl = magicJS.read("tieba_unified_push_url") || magicJS.read("magicjs_unified_push_url"); @@ -108,7 +109,7 @@ function TiebaCheckIn(cookie, tbs, tieba) { } (async () => { - if (magicJS.isRequest && tiebeGetCookieRegex.test(magicJS.request.url)) { + if (magicJS.isRequest && (tiebeGetCookieRegex.test(magicJS.request.url) || tiebeNewVersionGetCookieRegex.test(magicJS.request.url))) { let cookie = magicJS.request.headers.Cookie; let hisCookie = magicJS.read(tiebaCookieKey); magicJS.logDebug(`当前贴吧Cookie:\n${cookie}\n历史贴吧Cookie:\n${hisCookie}`); diff --git a/script/tieba/tieba_checkin.lnscript b/script/tieba/tieba_checkin.lnscript index 1707172a2..63702132b 100644 --- a/script/tieba/tieba_checkin.lnscript +++ b/script/tieba/tieba_checkin.lnscript @@ -1,6 +1,7 @@ # 百度贴吧签到 -http-request ^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,tag=贴吧_获取Cookie +http-request ^https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,tag=贴吧_获取Cookie +http-request ^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,tag=贴吧_获取新版Cookie cron "30 0 * * *" script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,timeout=60,tag=贴吧_每日签到 hostname = c.tieba.baidu.com \ No newline at end of file diff --git a/script/tieba/tieba_checkin.qxrewrite b/script/tieba/tieba_checkin.qxrewrite index 71e6dbca5..a44a80777 100644 --- a/script/tieba/tieba_checkin.qxrewrite +++ b/script/tieba/tieba_checkin.qxrewrite @@ -1,5 +1,6 @@ # 百度贴吧每日自动签到 -^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js +^https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js +^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js hostname = c.tieba.baidu.com \ No newline at end of file diff --git a/script/tieba/tieba_checkin.sgmodule b/script/tieba/tieba_checkin.sgmodule index aece3b7f3..5d3f7d64b 100644 --- a/script/tieba/tieba_checkin.sgmodule +++ b/script/tieba/tieba_checkin.sgmodule @@ -4,7 +4,8 @@ [Script] 贴吧_每日签到 = type=cron,cronexp=30 0 * * *,timeout=60,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js -贴吧_获取cookie = type=http-request,pattern=^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js +贴吧_获取cookie = type=http-request,pattern=^https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js +贴吧_获取新版cookie = type=http-request,pattern=^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js [MITM] hostname = %APPEND% c.tieba.baidu.com \ No newline at end of file