|
|
@@ -60,48 +60,48 @@ function checkHandleRequest(){
|
|
|
const url = request.url;
|
|
|
const path = request.path;
|
|
|
magicJS.logger.info(`path=${path}`);
|
|
|
- if (path.match(/\/point\/home/)) {
|
|
|
- handlePointHomeData();
|
|
|
- } else if (path.match(/\/user\/info/)) {
|
|
|
- handlePointHomeData();
|
|
|
- } else {
|
|
|
- // switch (path) {
|
|
|
- // default:
|
|
|
- // break;
|
|
|
- // }
|
|
|
- }
|
|
|
+ // if (path.match(/\/point\/home/)) {
|
|
|
+ // handlePointHomeData();
|
|
|
+ // } else if (path.match(/\/user\/info/)) {
|
|
|
+ // handlePointHomeData();
|
|
|
+ // } else {
|
|
|
+ // // switch (path) {
|
|
|
+ // // default:
|
|
|
+ // // break;
|
|
|
+ // // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
-function handlePointHomeData(){
|
|
|
- const request = magicJS.request;
|
|
|
- const cookie = request.headers.Cookie;
|
|
|
- const body = 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 (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同步到青龙面板成功!!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+// function handlePointHomeData(){
|
|
|
+// const request = magicJS.request;
|
|
|
+// const cookie = request.headers.Cookie;
|
|
|
+// const body = 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 (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同步到青龙面板成功!!");
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// }
|
|
|
|
|
|
function getUserId(cookie) {
|
|
|
return new Promise((resolve, reject) => {
|