Browse Source

忽略证书错误

PUGE 3 tháng trước cách đây
mục cha
commit
2c92987791

+ 1 - 1
config.json

@@ -1,5 +1,5 @@
 {
-    "enterURL": "https://web.whatsapp.com/",
+    "enterURL": "http://selftest.umlchina.com/",
     "width": 800,
     "height": 600,
     "webPreferences": {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 48 - 0
dist/whatsapp发消息/preLoadFile.js


+ 0 - 197
dist/win-ia32-unpacked/preLoadFile.js

@@ -1,197 +0,0 @@
-function getDaysAgo(n) {
-  const timestamp = Date.now() - (n * 24 * 60 * 60 * 1000);
-  const date = new Date(timestamp);
-  
-  const year = date.getFullYear();
-  const month = String(date.getMonth() + 1).padStart(2, '0');
-  const day = String(date.getDate()).padStart(2, '0');
-  
-  return `${year}-${month}-${day}`;
-}
-
-function csvToArray(csvString) {
-  const lines = csvString.split('\n');
-  const result = [];
-  
-  for (let line of lines) {
-    // 跳过空行
-    if (line.trim() === '') continue;
-    
-    // 按逗号分割,并去除每个字段的空白
-    const row = line.split(',').map(field => field.trim());
-    result.push(row);
-  }
-  
-  return result;
-}
-
-function arrayToCSV(array) {
-  return array.map(row => 
-    row.map(field => String(field)).join(',')
-  ).join('\n');
-}
-
-
-function creatToday(fileList) {
-  for (let index = 1; index < fileList.length - 1; index++) {
-    fileList[index][2] = fileList[index][5]
-    fileList[index][3] = fileList[index][6]
-    fileList[index][4] = fileList[index][7]
-    fileList[index][5] = ""
-    fileList[index][6] = ""
-    fileList[index][7] = ""
-    fileList[index][8] = ""
-    fileList[index][9] = ""
-    fileList[index][10] = ""
-  }
-  const fileData = {
-    filename: getDaysAgo(0) + '.csv',
-    content: arrayToCSV(fileList),
-    encoding: "gb2312"
-  };
-
-  // 调用保存方法
-  window.electronAPI.saveFile(fileData).then(result => {
-    if (result.success) {
-      console.log('文件保存成功:', result.path);
-    } else {
-      console.error('文件保存失败:', result.error);
-    }
-  });
-}
-
-
-function saveFile(adtaArr, next) {
-  // 保存数据
-  const fileData = {
-    filename: getDaysAgo(0) + '.csv',
-    content: arrayToCSV(adtaArr),
-    encoding: "gb2312"
-  };
-
-  // 调用保存方法
-  window.electronAPI.saveFile(fileData).then(result => {
-    if (result.success) {
-      console.log('文件保存成功:', result.path);
-      setTimeout(() => {
-        if (next) checkData(adtaArr, next)
-      }, 1000);
-    } else {
-      console.error('文件保存失败:', result.error);
-    }
-  });
-}
-
-function cutString (original, before, after, index) {
-  index = index || 0;
-  if (typeof index === "number") {
-    const P = original.indexOf(before, index);
-    if (P > -1) {
-      if (after) {
-        const f = original.indexOf(after, P + before.length);
-        return (f>-1)? original.slice(P + before.toString().length, f):console.error("Tool [在文本中找不到 参数三 "+after+"]");
-      } else {
-        return original.slice(P + before.toString().length);
-      }
-    } else {
-      console.error("Tool [在文本中找不到 参数一 " + before + "]");
-      return
-    }
-  } else {
-    console.error("Tool [sizeTransition:" + index + "不是一个整数!]");
-  }
-}
-
-function checkData (adtaArr) {
-  for (let index = 0; index < adtaArr.length; index++) {
-    const element = adtaArr[index];
-    console.log(element)
-    if (element[1].includes('https://') && element[5] === '') {
-      console.log(element[1])
-      if (location.href.slice(0, 40) == element[1].slice(0, 40)) {
-        setTimeout(() => {
-          document.querySelector('.yt-truncated-text__absolute-button').click()
-          setTimeout(() => {
-            let pdInfo = document.querySelector('.style-scope.ytd-about-channel-renderer').innerText
-            let bfsl = parseInt(cutString(pdInfo,'视频\n\n\t', '次观看'))
-            let spsl = parseInt(cutString(pdInfo,'订阅者\n\n\t', '个视频'))
-            let dyrs = parseInt(cutString(pdInfo,'注册\n\n\t', '位订阅者'))
-            bfsl = bfsl ? bfsl : 0
-            spsl = spsl ? spsl : 0
-            dyrs = dyrs ? dyrs : 0
-            console.log(bfsl, spsl, dyrs)
-            adtaArr[index][5] = bfsl
-            adtaArr[index][6] = spsl
-            adtaArr[index][7] = dyrs
-            adtaArr[index][8] = bfsl - parseInt(adtaArr[index][2])
-            adtaArr[index][9] = spsl - parseInt(adtaArr[index][3])
-            adtaArr[index][10] = dyrs - parseInt(adtaArr[index][4])
-            saveFile(adtaArr, true)
-          }, 3000);
-        }, 2000);
-      } else {
-        location.href = element[1]
-      }
-      
-      return
-    }
-  }
-  // 汇总计算
-  adtaArr[adtaArr.length - 1][2] = 0
-  adtaArr[adtaArr.length - 1][3] = 0
-  adtaArr[adtaArr.length - 1][4] = 0
-  adtaArr[adtaArr.length - 1][5] = 0
-  adtaArr[adtaArr.length - 1][6] = 0
-  adtaArr[adtaArr.length - 1][7] = 0
-  adtaArr[adtaArr.length - 1][8] = 0
-  adtaArr[adtaArr.length - 1][9] = 0
-  adtaArr[adtaArr.length - 1][10] = 0
-  for (let index = 1; index < adtaArr.length - 1; index++) {
-    const element = adtaArr[index];
-    adtaArr[adtaArr.length - 1][2] += parseInt(element[2])
-    adtaArr[adtaArr.length - 1][3] += parseInt(element[3])
-    adtaArr[adtaArr.length - 1][4] += parseInt(element[4])
-    adtaArr[adtaArr.length - 1][5] += parseInt(element[5])
-    adtaArr[adtaArr.length - 1][6] += parseInt(element[6])
-    adtaArr[adtaArr.length - 1][7] += parseInt(element[7])
-    adtaArr[adtaArr.length - 1][8] += parseInt(element[8])
-    adtaArr[adtaArr.length - 1][9] += parseInt(element[9])
-    adtaArr[adtaArr.length - 1][10] += parseInt(element[10])
-  }
-  saveFile(adtaArr, false)
-  alert('所有项目已经检查完!')
-}
-
-
-// 调用保存方法
-window.electronAPI.readFile({filename: getDaysAgo(0) + '.csv', encoding: "gb2312"}).then(result => {
-  if (result.success) {
-    console.log(result.content);
-    // 如果内容是空的,则读取昨天的
-    if (result.content == '') {
-      window.electronAPI.readFile({filename: getDaysAgo(1) + '.csv', encoding: "gb2312"}).then(result2 => {
-        if (result2.success) {
-          console.log(result2.content);
-          // 如果内容是空的,则读取昨天的
-          if (result2.content == '') {
-            alert('缺少昨天的数据!')
-          } else {
-            let fileData = csvToArray(result2.content)
-            creatToday(fileData)
-            console.log(fileData)
-            checkData(fileData)
-          }
-        } else {
-          console.error('文件读取失败:', result2.error);
-        }
-      });
-    } else {
-      // 读取加载文件
-      let fileData = csvToArray(result.content)
-      console.log(fileData)
-      checkData(fileData)
-    }
-  } else {
-    console.error('文件读取失败:', result.error);
-  }
-});

+ 5 - 4
dist/win-ia32-unpacked/config.json → dist/自助答题/config.json

@@ -1,7 +1,7 @@
 {
-    "enterURL": "https://m.youtube.com/",
-    "width": 376,
-    "height": 667,
+    "enterURL": "http://selftest.umlchina.com/",
+    "width": 800,
+    "height": 600,
     "webPreferences": {
         "webSecurity": false,
         "nodeIntegration": false,
@@ -11,13 +11,14 @@
         "enableRemoteModule": false,
         "safeDialogs": false
     },
-    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
+    "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1",
     "autoHideMenuBar": true,
     "redirect":[],
     "redirectURL":"",
     "proxy":"",
     "noCache": false,
     "interceptor":[
+        "https://selftest.umlchina.com/api/%E8%87%AA%E6%B5%8B/%E6%8F%90%E4%BA%A4%E7%AD%94%E6%A1%88"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

+ 5 - 0
dist/自助答题/preLoadFile.js

@@ -0,0 +1,5 @@
+
+window.onInterceptedData = function (data) {
+  window.systemInfo = data
+  console.log(data)
+};

+ 0 - 1
dist/win-ia32-unpacked/preload.js → dist/自助答题/preload.js

@@ -26,7 +26,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
   download: (msg) => ipcRenderer.send('download', msg),
   broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
   saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
-  readFile: (msg) => ipcRenderer.invoke('readFile', msg),
   onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
 });
 

+ 10 - 0
main.js

@@ -328,6 +328,16 @@ app.on('window-all-closed', function () {
   if (process.platform !== 'darwin') app.quit()
 })
 
+app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
+  // 阻止默认的错误处理
+  event.preventDefault();
+  // 允许证书错误
+  callback(true);
+  
+  // 如果需要,可以记录日志
+  console.warn(`忽略证书错误: ${error} - ${url}`);
+});
+
 // In this file you can include the rest of your app's specific main process
 // code. You can also put them in separate files and require them here.
 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác