|
|
@@ -8,6 +8,7 @@
|
|
|
[rewrite_local]
|
|
|
|
|
|
^https?:\/\/maicai\.api\.ddxq\.mobi\/point\/home url script-request-body https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/dingdong/dingdongHelper.js
|
|
|
+^https?:\/\/maicai\.api\.ddxq\.mobi script-request-body https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/dingdong/dingdongHelper.js
|
|
|
|
|
|
[MITM]
|
|
|
|
|
|
@@ -28,31 +29,34 @@ let currentBody = "";
|
|
|
let userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/11.16.0 station_id/5f1ea5ed3f34a90001d0b0f3 device_id/87721fd44a221da0d8aabdee75c37f575d7b44ec';
|
|
|
|
|
|
async function Main() {
|
|
|
- if (magicJS.isRequest && getCookieRegex.test(magicJS.request.url)) {
|
|
|
- const cookie = magicJS.request.headers.Cookie;
|
|
|
- const body = magicJS.request.url.split('?')[1];
|
|
|
- // 获取UserId
|
|
|
- const userId = await magicJS.utils.retry(getUserId, 3, 500)(cookie).catch(err => {
|
|
|
- magicJS.notification.post(err);
|
|
|
- magicJS.done();
|
|
|
- })
|
|
|
- let hisCookie = magicJS.data.read(dingDongCookieKey, "", userId);
|
|
|
- if (cookie !== hisCookie) {
|
|
|
- magicJS.data.write(dingDongCookieKey, cookie, userId);
|
|
|
- magicJS.data.write(dingDongBodyKey, body, userId);
|
|
|
- magicJS.logger.info(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`);
|
|
|
- magicJS.notification.post("🎈Cookie写入成功!!");
|
|
|
- } else {
|
|
|
- magicJS.logger.info("Cookie没有变化,无需更新");
|
|
|
- }
|
|
|
- // 同步Cookies至青龙面板
|
|
|
- if (magicJS.data.read(dingDongSyncQinglongKey, false) === true) {
|
|
|
- hisCookie = await magicJS.qinglong.read(dingDongCookieKey, "", userId);
|
|
|
+ if (magicJS.isRequest) {
|
|
|
+ magicJS.logger.info(magicJS.request.url);
|
|
|
+ if(getCookieRegex.test(magicJS.request.url)){
|
|
|
+ const cookie = magicJS.request.headers.Cookie;
|
|
|
+ const body = magicJS.request.url.split('?')[1];
|
|
|
+ // 获取UserId
|
|
|
+ const userId = await magicJS.utils.retry(getUserId, 3, 500)(cookie).catch(err => {
|
|
|
+ magicJS.notification.post(err);
|
|
|
+ magicJS.done();
|
|
|
+ })
|
|
|
+ let hisCookie = magicJS.data.read(dingDongCookieKey, "", userId);
|
|
|
if (cookie !== hisCookie) {
|
|
|
- await magicJS.qinglong.write(dingDongCookieKey, cookie, userId);
|
|
|
- await magicJS.qinglong.write(dingDongBodyKey, body, userId);
|
|
|
+ magicJS.data.write(dingDongCookieKey, cookie, userId);
|
|
|
+ magicJS.data.write(dingDongBodyKey, body, userId);
|
|
|
magicJS.logger.info(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`);
|
|
|
- magicJS.notification.post("🎈Cookie同步到青龙面板成功!!");
|
|
|
+ magicJS.notification.post("🎈Cookie写入成功!!");
|
|
|
+ } else {
|
|
|
+ magicJS.logger.info("Cookie没有变化,无需更新");
|
|
|
+ }
|
|
|
+ // 同步Cookies至青龙面板
|
|
|
+ if (magicJS.data.read(dingDongSyncQinglongKey, false) === true) {
|
|
|
+ hisCookie = await magicJS.qinglong.read(dingDongCookieKey, "", userId);
|
|
|
+ if (cookie !== hisCookie) {
|
|
|
+ await magicJS.qinglong.write(dingDongCookieKey, cookie, userId);
|
|
|
+ await magicJS.qinglong.write(dingDongBodyKey, body, userId);
|
|
|
+ magicJS.logger.info(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`);
|
|
|
+ magicJS.notification.post("🎈Cookie同步到青龙面板成功!!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|