|
|
@@ -61,7 +61,7 @@ function checkHandleRequest(){
|
|
|
const path = request.path;
|
|
|
magicJS.logger.info(`path=${path}`);
|
|
|
if (path.match(/\/point\/home/)) {
|
|
|
- // handlePointHomeData();
|
|
|
+ handlePointHomeData();
|
|
|
} else if (path.match(/\/user\/info/)) {
|
|
|
// handlePointHomeData();
|
|
|
} else {
|
|
|
@@ -72,36 +72,36 @@ function checkHandleRequest(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 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) => {
|