shawenguan 1 год назад
Родитель
Сommit
8b1f952d83
2 измененных файлов с 46 добавлено и 23 удалено
  1. 22 8
      Scripts/hbcpre/hbcpreHelper.js
  2. 24 15
      Scripts/hbcpre/hbcpreOrder.js

+ 22 - 8
Scripts/hbcpre/hbcpreHelper.js

@@ -28,7 +28,26 @@ const HbcpreConstKey = {
     floatPriceIntaval: 'HbcpreFloatPriceIntaval',
 };
 
-const userAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1`;
+const gUserAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1`;
+const gCommonHeaders = {
+    'If-Modified-Since' : `0`,
+    'Connection' : `keep-alive`,
+    'Accept-Encoding' : `gzip, deflate, br`,
+    'Sec-Fetch-Dest' : `empty`,
+    'Content-Type' : `application/json`,
+    'Sec-Fetch-Site' : `same-site`,
+    'Origin' : `https://luanshu.hbcpre.com`,
+    'Cache-Control' : `no-cache`,
+    'User-Agent' : gUserAgent,
+    'Authorization' : ``,
+    'Sec-Fetch-Mode' : `cors`,
+    'Host' : `lsjk.hbcpre.com`,
+    'Referer' : `https://luanshu.hbcpre.com/`,
+    'Pragma' : `no-cache`,
+    'Accept' : `*/*`,
+    'Accept-Language' : `zh-CN,zh-Hans;q=0.9`
+};
+
 let gRetBody;
 async function Main() {
     if (magicJS.isStrictRequest) {
@@ -374,13 +393,8 @@ async function hbRequest(config, data) {
     const api = config.API;
     const method = config.METHOD;
     const tokenInfo = magicJS.data.read(HbcpreConstKey.token, '');
-    const headers = {
-        "If-Modified-Since": "0",
-        "Cache-Control": "no-cache",
-        "Content-Type": "application/json",
-        "Authorization": `Bearer ${tokenInfo}`,
-        "User-Agent": userAgent,
-    };
+    const headers = gCommonHeaders;
+    headers.Authorization = `Bearer ${tokenInfo}`;
     data.sign_time = parseInt(`${new Date().getTime() / 1000}`);
     const baseConfig = getBaseConfig();
     let body = ``;

+ 24 - 15
Scripts/hbcpre/hbcpreOrder.js

@@ -20,7 +20,25 @@ const HbcpreConstKey = {
     floatPriceIntaval: 'HbcpreFloatPriceIntaval',
 };
 
-const userAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1`;
+const gUserAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1`;
+const gCommonHeaders = {
+    'If-Modified-Since' : `0`,
+    'Connection' : `keep-alive`,
+    'Accept-Encoding' : `gzip, deflate, br`,
+    'Sec-Fetch-Dest' : `empty`,
+    'Content-Type' : `application/json`,
+    'Sec-Fetch-Site' : `same-site`,
+    'Origin' : `https://luanshu.hbcpre.com`,
+    'Cache-Control' : `no-cache`,
+    'User-Agent' : gUserAgent,
+    'Authorization' : ``,
+    'Sec-Fetch-Mode' : `cors`,
+    'Host' : `lsjk.hbcpre.com`,
+    'Referer' : `https://luanshu.hbcpre.com/`,
+    'Pragma' : `no-cache`,
+    'Accept' : `*/*`,
+    'Accept-Language' : `zh-CN,zh-Hans;q=0.9`
+};
 
 async function Main() {
     if (!magicJS.isRequest) {
@@ -175,13 +193,8 @@ function decryptAES(wordStr, keyStr, ivStr) {
 
 async function openUrl(url){
     const tokenInfo = magicJS.data.read(HbcpreConstKey.token, '');
-    const headers = {
-        "If-Modified-Since": "0",
-        "Cache-Control": "no-cache",
-        "Content-Type": "application/json",
-        "Authorization": `Bearer ${tokenInfo}`,
-        "User-Agent": userAgent,
-    };
+    const headers = gCommonHeaders;
+    headers.Authorization = `Bearer ${tokenInfo}`;
     let options = {
         url: `${url}`,
         headers: headers,
@@ -206,13 +219,9 @@ async function hbRequest(config, data) {
     const api = config.API;
     const method = config.METHOD;
     const tokenInfo = magicJS.data.read(HbcpreConstKey.token, '');
-    const headers = {
-        "If-Modified-Since": "0",
-        "Cache-Control": "no-cache",
-        "Content-Type": "application/json",
-        "Authorization": `Bearer ${tokenInfo}`,
-        "User-Agent": userAgent,
-    };
+    const headers = gCommonHeaders;
+    headers.Authorization = `Bearer ${tokenInfo}`;
+
     data.sign_time = parseInt("".concat((new Date).getTime()  / 1000));
     const baseConfig = getBaseConfig();
     let body = ``;