mirror of
https://github.com/Giu-zhao/ios_rule_script
synced 2024-11-22 08:28:25 +08:00
[饿了么] 修复获取不到Cookie时会覆盖旧Cookie的问题
This commit is contained in:
parent
8e4561a969
commit
a4e748d7c9
@ -53,6 +53,8 @@ https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/ele
|
|||||||
|
|
||||||
打开饿了么APP即可。
|
打开饿了么APP即可。
|
||||||
|
|
||||||
|
Surge需要关闭MITM over HTTP/2,你可以获取成功后再打开。
|
||||||
|
|
||||||
### 获取坐标
|
### 获取坐标
|
||||||
|
|
||||||
打开饿了么APP - 我的 - 赚吃货豆。
|
打开饿了么APP - 我的 - 赚吃货豆。
|
||||||
|
@ -26,7 +26,7 @@ function GetCoordinate() {
|
|||||||
const latitude = arr[2];
|
const latitude = arr[2];
|
||||||
magicJS.write(elemeLongitudeKey, longitude);
|
magicJS.write(elemeLongitudeKey, longitude);
|
||||||
magicJS.write(elemeLatitudeKey, latitude);
|
magicJS.write(elemeLatitudeKey, latitude);
|
||||||
if (longitude !== hisLongitude || latitude !== hisLatitude){
|
if (longitude !== hisLongitude || latitude !== hisLatitude) {
|
||||||
magicJS.notify(`更新坐标成功!`)
|
magicJS.notify(`更新坐标成功!`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,12 +37,12 @@ function GetCoordinate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function GetCookies(){
|
function GetCookies() {
|
||||||
let cookie = magicJS.request.headers.Cookie;
|
let cookie = magicJS.request.headers.Cookie;
|
||||||
let hisCookie = magicJS.read(elemeCookieKey);
|
let hisCookie = magicJS.read(elemeCookieKey);
|
||||||
let compareCookie2 = !!cookie ? /cookie2=([a-zA-Z0-9]*)/.exec(cookie)[1] : null;
|
let compareCookie2 = !!cookie ? /cookie2=([a-zA-Z0-9]*)/.exec(cookie)[1] : null;
|
||||||
let compareHisCookie2 = !!hisCookie ? /cookie2=([a-zA-Z0-9]*)/.exec(hisCookie)[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.write(elemeCookieKey, cookie);
|
||||||
magicJS.logInfo(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`);
|
magicJS.logInfo(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`);
|
||||||
magicJS.notify('Cookie写入成功!!');
|
magicJS.notify('Cookie写入成功!!');
|
||||||
@ -163,7 +163,7 @@ function DrawPea(cookie, peaId, longitude, latitude) {
|
|||||||
) && magicJS.request.method == "GET") {
|
) && magicJS.request.method == "GET") {
|
||||||
GetCoordinate();
|
GetCoordinate();
|
||||||
}
|
}
|
||||||
else if (getCookies.test(magicJS.request.url)){
|
else if (getCookies.test(magicJS.request.url)) {
|
||||||
GetCookies();
|
GetCookies();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user