From a4e748d7c9c3146aa5769aecc42d340ed024d2e2 Mon Sep 17 00:00:00 2001 From: blackmatrix7 <27717518+blackmatrix7@users.noreply.github.com> Date: Thu, 8 Sep 2022 01:35:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=A5=BF=E4=BA=86=E4=B9=88]=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0Cookie=E6=97=B6?= =?UTF-8?q?=E4=BC=9A=E8=A6=86=E7=9B=96=E6=97=A7Cookie=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/eleme/README.md | 2 ++ script/eleme/eleme_daily.js | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/script/eleme/README.md b/script/eleme/README.md index 633420a33..ed0f8cb5c 100644 --- a/script/eleme/README.md +++ b/script/eleme/README.md @@ -53,6 +53,8 @@ https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/ele 打开饿了么APP即可。 +Surge需要关闭MITM over HTTP/2,你可以获取成功后再打开。 + ### 获取坐标 打开饿了么APP - 我的 - 赚吃货豆。 diff --git a/script/eleme/eleme_daily.js b/script/eleme/eleme_daily.js index f0d0c78da..bb0299a37 100644 --- a/script/eleme/eleme_daily.js +++ b/script/eleme/eleme_daily.js @@ -26,7 +26,7 @@ function GetCoordinate() { const latitude = arr[2]; magicJS.write(elemeLongitudeKey, longitude); magicJS.write(elemeLatitudeKey, latitude); - if (longitude !== hisLongitude || latitude !== hisLatitude){ + if (longitude !== hisLongitude || latitude !== hisLatitude) { magicJS.notify(`更新坐标成功!`) } } @@ -37,12 +37,12 @@ function GetCoordinate() { } -function GetCookies(){ +function GetCookies() { let cookie = magicJS.request.headers.Cookie; let hisCookie = magicJS.read(elemeCookieKey); let compareCookie2 = !!cookie ? /cookie2=([a-zA-Z0-9]*)/.exec(cookie)[1] : null; let compareHisCookie2 = !!hisCookie ? /cookie2=([a-zA-Z0-9]*)/.exec(hisCookie)[1] : null; - if (!!!hisCookie || compareCookie2 !== compareHisCookie2) { + if (cookie && (!hisCookie || compareCookie2 !== compareHisCookie2)) { magicJS.write(elemeCookieKey, cookie); magicJS.logInfo(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`); magicJS.notify('Cookie写入成功!!'); @@ -163,7 +163,7 @@ function DrawPea(cookie, peaId, longitude, latitude) { ) && magicJS.request.method == "GET") { GetCoordinate(); } - else if (getCookies.test(magicJS.request.url)){ + else if (getCookies.test(magicJS.request.url)) { GetCookies(); } }