Просмотр исходного кода

自动更新版本脚本,自动打包chrome和chromedriver脚本

naibo 2 лет назад
Родитель
Сommit
b6123bad5b
52 измененных файлов с 395 добавлено и 192 удалено
  1. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/0.json
  2. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/1.json
  3. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/10.json
  4. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/11.json
  5. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/12.json
  6. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/13.json
  7. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/14.json
  8. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/15.json
  9. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/16.json
  10. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/17.json
  11. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/18.json
  12. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/19.json
  13. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/2.json
  14. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/20.json
  15. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/21.json
  16. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/22.json
  17. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/23.json
  18. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/24.json
  19. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/25.json
  20. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/26.json
  21. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/27.json
  22. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/28.json
  23. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/29.json
  24. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/3.json
  25. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/30.json
  26. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/31.json
  27. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/32.json
  28. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/33.json
  29. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/34.json
  30. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/35.json
  31. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/36.json
  32. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/4.json
  33. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/5.json
  34. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/6.json
  35. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/7.json
  36. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/8.json
  37. 0 0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/9.json
  38. 0 0
      .temp_to_pub/EasySpider_windows_x64/tasks/47.json
  39. 2 1
      ElectronJS/.gitignore
  40. 83 0
      ElectronJS/change_version.py
  41. 7 1
      ElectronJS/clean_and_release_win32.cmd
  42. 7 1
      ElectronJS/clean_and_release_win64.cmd
  43. 74 73
      ElectronJS/package.json
  44. 8 1
      ElectronJS/package_linux64.sh
  45. 1 0
      ElectronJS/package_macos.sh
  46. 96 0
      ElectronJS/update_chrome.py
  47. 2 3
      ElectronJS/每次发布之前要检查的事项.md
  48. 2 3
      ExecuteStage/.vscode/launch.json
  49. 8 7
      ExecuteStage/easyspider_executestage.py
  50. 0 6
      ExecuteStage/stealth.min.js
  51. 50 50
      Extension/manifest_v3/package.json
  52. 55 46
      Extension/manifest_v3/src/manifest.json

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/0.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/1.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/10.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/11.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/12.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/13.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/14.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/15.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/16.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/17.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/18.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/19.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/2.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/20.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/21.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/22.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/23.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/24.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/25.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/26.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/27.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/28.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/29.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/3.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/30.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/31.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/32.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/33.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/34.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/35.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/36.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/4.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/5.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/6.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/7.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/8.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/9.json


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/tasks/47.json


+ 2 - 1
ElectronJS/.gitignore

@@ -1,5 +1,6 @@
-node_modules
+node_modules/
 out/
+chromedrivers/
 chrome_win32/
 chrome_win64/
 chrome_linux64/

+ 83 - 0
ElectronJS/change_version.py

@@ -0,0 +1,83 @@
+import json
+import os
+import re
+import sys
+
+# 读取JSON文件
+def read_json_file(file_path):
+    with open(file_path, 'r', encoding='utf-8') as file:
+        data = json.load(file)
+    return data
+
+# 保存为JSON文件
+def save_json_file(data, file_path):
+    with open(file_path, 'w', encoding='utf-8') as file:
+        json.dump(data, file, indent=4, ensure_ascii=False)
+
+def update_file_version(file_path, new_version, key="当前版本/Current Version: v"):
+    with open(file_path, 'r', encoding='utf-8') as file:
+        lines = file.readlines()
+    with open(file_path, 'w', encoding='utf-8') as file:
+        for line in lines:
+            if key in line:
+                pattern = r'('+key+')\d+\.\d+\.\d+'
+                line = re.sub(pattern, r'\g<1>'+new_version, line)
+            file.write(line)
+
+version = "0.3.3"
+
+# py html js
+
+if __name__ == "__main__":
+
+    file_path = "./src/taskGrid/logic.js"
+    update_file_version(file_path, version, key='"version": "')
+
+    file_path = "./src/taskGrid/logic_CN.js"
+    update_file_version(file_path, version, key='"version": "')
+    
+    file_path = "../ExecuteStage/easyspider_executestage.py"
+    update_file_version(file_path, version, key='"version": "')
+
+    # index.html
+    file_path = "./src/index.html"
+    update_file_version(file_path, version, key="当前版本/Current Version: v")
+
+    # package.json
+    file_path = "./package.json"
+
+    # 读取JSON文件
+    electron_config = read_json_file(file_path)
+    print(electron_config["version"])
+
+    # 修改数据
+    electron_config["version"] = version
+    electron_config["config"]["forge"]["packagerConfig"]["appVersion"] = version
+
+    # 保存为JSON文件
+    save_json_file(electron_config, file_path)
+
+    # 插件的package.json
+    file_path = "../Extension/manifest_v3/package.json"
+
+    # 读取JSON文件
+    electron_config = read_json_file(file_path)
+    print(electron_config["version"])
+
+    # 修改数据
+    electron_config["version"] = version
+
+    # 保存为JSON文件
+    save_json_file(electron_config, file_path)
+    
+    file_path = "../Extension/manifest_v3/src/manifest.json"
+
+    # 读取JSON文件
+    electron_config = read_json_file(file_path)
+    print(electron_config["version"])
+
+    # 修改数据
+    electron_config["version"] = version
+
+    # 保存为JSON文件
+    save_json_file(electron_config, file_path)

+ 7 - 1
ElectronJS/clean_and_release_win32.cmd

@@ -1,5 +1,6 @@
 move out\EasySpider-win32-ia32 out\EasySpider
 rmdir /s /q out\EasySpider\resources\app\chrome_win64
+rmdir /s /q out\EasySpider\resources\app\chromedrivers
 rmdir /s /q out\EasySpider\resources\app\Data
 rmdir /s /q out\EasySpider\resources\app\.idea
 rmdir /s /q out\EasySpider\resources\app\tasks
@@ -7,4 +8,9 @@ rmdir /s /q out\EasySpider\resources\app\execution_instances
 rmdir /s /q out\EasySpider\resources\app\user_data
 rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x86\EasySpider
 del out\EasySpider\resources\app\vs_BuildTools.exe
-move out\EasySpider ..\.temp_to_pub\EasySpider_windows_x86\EasySpider
+move out\EasySpider ..\.temp_to_pub\EasySpider_windows_x86\EasySpider
+rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x86\user_data
+rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x86\execution_instances
+mkdir ..\.temp_to_pub\EasySpider_windows_x86\execution_instances
+rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x86\Data
+mkdir ..\.temp_to_pub\EasySpider_windows_x86\Data

+ 7 - 1
ElectronJS/clean_and_release_win64.cmd

@@ -1,5 +1,6 @@
 move out\EasySpider-win32-x64 out\EasySpider
 rmdir /s /q out\EasySpider\resources\app\chrome_win32
+rmdir /s /q out\EasySpider\resources\app\chromedrivers
 rmdir /s /q out\EasySpider\resources\app\Data
 rmdir /s /q out\EasySpider\resources\app\.idea
 rmdir /s /q out\EasySpider\resources\app\tasks
@@ -7,4 +8,9 @@ rmdir /s /q out\EasySpider\resources\app\user_data
 rmdir /s /q out\EasySpider\resources\app\execution_instances
 rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x64\EasySpider
 del out\EasySpider\resources\app\vs_BuildTools.exe
-move out\EasySpider ..\.temp_to_pub\EasySpider_windows_x64\EasySpider
+move out\EasySpider ..\.temp_to_pub\EasySpider_windows_x64\EasySpider
+rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x64\user_data
+rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x64\execution_instances
+mkdir ..\.temp_to_pub\EasySpider_windows_x64\execution_instances
+rmdir /s /q ..\.temp_to_pub\EasySpider_windows_x64\Data
+mkdir ..\.temp_to_pub\EasySpider_windows_x64\Data

+ 74 - 73
ElectronJS/package.json

@@ -1,76 +1,77 @@
 {
-  "name": "easy-spider",
-  "productName": "EasySpider",
-  "version": "0.3.3",
-  "icon": "./favicon",
-  "description": "NoCode Visual Web Crawler",
-  "main": "main.js",
-  "scripts": {
-    "start_direct": "electron .",
-    "start": "electron-forge start",
-    "package": "electron-forge package",
-    "make": "electron-forge make"
-  },
-  "keywords": [
-    "Electron",
-    "quick",
-    "start",
-    "tutorial",
-    "demo"
-  ],
-  "author": "Naibo Wang",
-  "license": "GPL-3.0",
-  "devDependencies": {
-    "@electron-forge/cli": "^6.0.5",
-    "@electron-forge/maker-deb": "^6.0.5",
-    "@electron-forge/maker-rpm": "^6.0.5",
-    "@electron-forge/maker-squirrel": "^6.0.5",
-    "@electron-forge/maker-zip": "^6.0.5",
-    "electron": "^20.0.1"
-  },
-  "repository": "https://github.com/NaiboWang/EasySpider",
-  "dependencies": {
-    "electron-squirrel-startup": "^1.0.0",
-    "http": "^0.0.1-security",
-    "node-window-manager": "^2.2.4",
-    "selenium-webdriver": "^4.8.0",
-    "ws": "^8.12.0"
-  },
-  "config": {
-    "forge": {
-      "makers": [
-        {
-          "name": "@electron-forge/maker-squirrel",
-          "config": {
-            "name": "EasySpider"
-          }
-        },
-        {
-          "name": "@electron-forge/maker-zip",
-          "platforms": [
-            "darwin"
-          ]
-        },
-        {
-          "name": "@electron-forge/maker-deb"
-        },
-        {
-          "name": "@electron-forge/maker-rpm"
+    "name": "easy-spider",
+    "productName": "EasySpider",
+    "version": "0.3.3",
+    "icon": "./favicon",
+    "description": "NoCode Visual Web Crawler",
+    "main": "main.js",
+    "scripts": {
+        "start_direct": "electron .",
+        "change_version": "node change_version.js",
+        "start": "electron-forge start",
+        "package": "electron-forge package",
+        "make": "electron-forge make"
+    },
+    "keywords": [
+        "Electron",
+        "quick",
+        "start",
+        "tutorial",
+        "demo"
+    ],
+    "author": "Naibo Wang",
+    "license": "GPL-3.0",
+    "devDependencies": {
+        "@electron-forge/cli": "^6.0.5",
+        "@electron-forge/maker-deb": "^6.0.5",
+        "@electron-forge/maker-rpm": "^6.0.5",
+        "@electron-forge/maker-squirrel": "^6.0.5",
+        "@electron-forge/maker-zip": "^6.0.5",
+        "electron": "^20.0.1"
+    },
+    "repository": "https://github.com/NaiboWang/EasySpider",
+    "dependencies": {
+        "electron-squirrel-startup": "^1.0.0",
+        "http": "^0.0.1-security",
+        "node-window-manager": "^2.2.4",
+        "selenium-webdriver": "^4.8.0",
+        "ws": "^8.12.0"
+    },
+    "config": {
+        "forge": {
+            "makers": [
+                {
+                    "name": "@electron-forge/maker-squirrel",
+                    "config": {
+                        "name": "EasySpider"
+                    }
+                },
+                {
+                    "name": "@electron-forge/maker-zip",
+                    "platforms": [
+                        "darwin"
+                    ]
+                },
+                {
+                    "name": "@electron-forge/maker-deb"
+                },
+                {
+                    "name": "@electron-forge/maker-rpm"
+                }
+            ],
+            "packagerConfig": {
+                "icon": "./favicon",
+                "appVersion": "0.3.3",
+                "name": "EasySpider",
+                "executableName": "EasySpider",
+                "appCopyright": "Naibo Wang ([email protected])",
+                "win32metadata": {
+                    "ProductName": "EasySpider",
+                    "CompanyName": "王乃博 (浙江大学与新加坡国立大学)",
+                    "FileDescription": "EasySpider"
+                }
+            },
+            "publishers": []
         }
-      ],
-      "packagerConfig": {
-        "icon": "./favicon",
-        "appVersion": "0.3.3",
-        "name": "EasySpider",
-        "executableName": "EasySpider",
-        "appCopyright": "Naibo Wang ([email protected])",
-        "win32metadata": {
-          "ProductName": "EasySpider",
-          "CompanyName": "王乃博 (浙江大学与新加坡国立大学)",
-          "FileDescription": "EasySpider"
-        }
-      },
-      "publishers": []
     }
-  }
-}
+}

+ 8 - 1
ElectronJS/package_linux64.sh

@@ -5,6 +5,7 @@ rm -r out
 npm run package
 mv out/EasySpider-linux-x64 out/EasySpider
 rm -r out/EasySpider/resources/app/chrome_win64
+rm -r out/EasySpider/resources/app/chromedrivers
 rm -r out/EasySpider/resources/app/Data
 rm -r out/EasySpider/resources/app/.idea
 rm -r out/EasySpider/resources/app/tasks
@@ -13,4 +14,10 @@ rm -r out/EasySpider/resources/app/user_data
 rm -r ../.temp_to_pub/EasySpider_Linux_x64/EasySpider
 rm out/EasySpider/resources/app/vs_BuildTools.exe
 mv out/EasySpider ../.temp_to_pub/EasySpider_Linux_x64/EasySpider
-chmod 777 ../.temp_to_pub/EasySpider_Linux_x64/easy-spider.sh
+chmod 777 ../.temp_to_pub/EasySpider_Linux_x64/easy-spider.sh
+
+rm -r ..\.temp_to_pub\EasySpider_Linux_x64\user_data
+rm -r  ..\.temp_to_pub\EasySpider_Linux_x64\execution_instances
+mkdir ..\.temp_to_pub\EasySpider_Linux_x64\execution_instances
+rm -r  ..\.temp_to_pub\EasySpider_Linux_x64\Data
+mkdir ..\.temp_to_pub\EasySpider_Linux_x64\Data

+ 1 - 0
ElectronJS/package_macos.sh

@@ -8,6 +8,7 @@ unzip out/make/zip/darwin/x64/EasySpider-darwin-x64* -d ../.temp_to_pub/EasySpid
 # mv out/EasySpider-darwin-x64/EasySpider.app ../.temp_to_pub/EasySpider_MacOS_all_arch/
 rm ../.temp_to_pub/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/VS_BuildTools.exe
 rm -r ../.temp_to_pub/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/chrome_win64
+rm -r ../.temp_to_pub/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/chromedrivers
 rm -r ../.temp_to_pub/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/Data
 rm -r ../.temp_to_pub/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/.idea
 rm -r ../.temp_to_pub/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/tasks

+ 96 - 0
ElectronJS/update_chrome.py

@@ -0,0 +1,96 @@
+import json
+import os
+import re
+import sys
+import requests
+import platform
+import shutil
+import zipfile
+import urllib.request
+
+def download_and_extract_zip(url, destination_folder):
+    # 下载ZIP文件
+    urllib.request.urlretrieve(url, "temp.zip")
+
+    # 解压ZIP文件
+    with zipfile.ZipFile("temp.zip", "r") as zip_ref:
+        zip_ref.extractall(destination_folder)
+
+    # 删除临时ZIP文件
+    os.remove("temp.zip")
+
+def copy_file(source_file, destination_file):
+    # 使用copy2()函数复制文件
+    shutil.copy2(source_file, destination_file)
+
+def copy_folder(source_folder, destination_folder):
+    # 使用copytree()函数复制文件夹及其内容
+    shutil.copytree(source_folder, destination_folder)
+
+update_version = "114" # 要更新的chromedriver版本
+
+chrome_driver_url = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json"
+win64_chrome_path = "C:\\Program Files\\Google\\Chrome\\Application"
+win32_chrome_path = "C:\\Program Files (x86)\\Google\\Chrome\\Application"
+mac_chrome_path = "/Applications/Google Chrome.app/Contents/MacOS"
+linux_chrome_path = "/opt/google/chrome"
+
+if __name__ == "__main__":
+  
+    driver_downloads = []
+    response = requests.get(chrome_driver_url)
+    if response.status_code == 200:
+        versions = json.loads(response.content)["versions"]
+        versions = versions[::-1] # 倒序排列数组
+        for info in versions:
+            version = info["version"]
+            if version.find(update_version) >= 0:
+                downloads = info["downloads"]
+                if "chromedriver" in downloads:
+                    print(info["version"])
+                    driver_downloads = downloads["chromedriver"]
+                    break
+    else:
+        print("Error: " + response.status_code)
+        exit(1)
+    if os.path.exists("./chromedrivers"):
+        shutil.rmtree("./chromedrivers")
+    os.mkdir("./chromedrivers")
+    if sys.platform == "win32" and platform.architecture()[0] == "64bit":
+        for download in driver_downloads:
+            if download["platform"] == "win64":
+                url = download["url"]
+                print(url)
+                break
+        download_and_extract_zip(url, "./chromedrivers")
+        if os.path.exists("./chrome_win64"):
+            shutil.rmtree("./chrome_win64")
+        copy_folder(win64_chrome_path, "./chrome_win64")
+        for folder in os.listdir("./chrome_win64"):
+            if folder[0].isdigit() and os.path.isdir("./chrome_win64/"+folder):
+                shutil.rmtree("./chrome_win64/"+folder+"/Installer") # 删除Installer文件夹
+        copy_file("./execute.bat", "./chrome_win64/execute.bat")
+        copy_file("./stealth.min.js", "./chrome_win64/stealth.min.js")
+        copy_file("./chromedrivers/chromedriver-win64/chromedriver.exe", "./chrome_win64/chromedriver_win64.exe")
+    elif sys.platform == "win32" and platform.architecture()[0] == "32bit":
+        for download in driver_downloads:
+            if download["platform"] == "win32":
+                url = download["url"]
+                print(url)
+                break
+        download_and_extract_zip(url, "./chromedrivers")
+        if os.path.exists("./chrome_win32"):
+            shutil.rmtree("./chrome_win32")
+        copy_folder(win64_chrome_path, "./chrome_win32")
+        for folder in os.listdir("./chrome_win32"):
+            if folder[0].isdigit() and os.path.isdir("./chrome_win32/"+folder):
+                shutil.rmtree("./chrome_win32/"+folder+"/Installer") # 删除Installer文件夹
+        copy_file("./execute.bat", "./chrome_win32/execute.bat")
+        copy_file("./stealth.min.js", "./chrome_win32/stealth.min.js")
+        copy_file("./chromedrivers/chromedriver-win32/chromedriver.exe", "./chrome_win32/chromedriver_win32.exe")
+    elif sys.platform == "linux" and platform.architecture()[0] == "64bit":
+        pass
+    elif sys.platform == "darwin" and platform.architecture()[0] == "64bit":
+        pass
+
+    print("Done!")

+ 2 - 3
ElectronJS/每次发布之前要检查的事项.md

@@ -1,3 +1,2 @@
-- 删除chrome的install文件夹
-- 修改index.html, logic.js及logic_CN.js, ElectronJS/package.json,manifest_v3/package.json,easyspider_executestage.py中的版本号
-- 更新最新的tasks文件夹
+- python generate_chrome.py 更新最新的chrome及chromedriver
+- python change_version.py 更改版本号

+ 2 - 3
ExecuteStage/.vscode/launch.json

@@ -2,7 +2,6 @@
     // Use IntelliSense to learn about possible attributes.
     // Hover to view descriptions of existing attributes.
     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
-    "version": "0.3.3",
     "configurations": [
         {
             "name": "Python: EasySpider",
@@ -11,8 +10,8 @@
             "program": "${file}",
             "console": "integratedTerminal",
             "justMyCode": true,
-            // "args": ["--id", "38", "--read_type", "local", "--headless", "1"]
-            "args": ["--id", "[36]", "--headless", "0", "--user_data", "1"]
+            "args": ["--id", "[47]", "--read_type", "local", "--headless", "0"]
+            // "args": ["--id", "[44]", "--headless", "0", "--user_data", "1"]
         }
     ]
 }

+ 8 - 7
ExecuteStage/easyspider_executestage.py

@@ -265,7 +265,8 @@ class BrowserThread(Thread):
             self.recordLog("执行系统命令:" + code)
             # 执行系统命令,超时时间为5秒
             try:
-                output = subprocess.run(code, capture_output=True, text=True, timeout=max_wait_time, encoding="utf-8", shell=True)
+                # output = subprocess.run(code, capture_output=True, text=True, timeout=max_wait_time, encoding="utf-8", shell=True)
+                output = subprocess.run(code, capture_output=True, text=True, timeout=max_wait_time, shell=True)
                 # 输出命令返回值
                 output = output.stdout
                 print(output)
@@ -1063,6 +1064,12 @@ if __name__ == '__main__':
             sys.exit()
         print("Chrome location:", options.binary_location)
         print("Chromedriver location:", driver_path)
+    # elif os.getcwd().find("ExecuteStage") >= 0:  # 如果直接执行
+    #     print("Finding chromedriver in ./Chrome",
+    #           os.getcwd()+"/Chrome")
+    #     options.binary_location = "./Chrome/chrome.exe"  # 指定chrome位置
+    #     # option.binary_location = "C:\\Users\\q9823\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"
+    #     driver_path = "./Chrome/chromedriver.exe"
     elif os.path.exists(os.getcwd()+"/../ElectronJS"): 
         if os.getcwd().find("ElectronJS") >= 0:  # 软件dev用
             print("Finding chromedriver in EasySpider",
@@ -1074,12 +1081,6 @@ if __name__ == '__main__':
                 os.getcwd()+"/ElectronJS")
             option.binary_location = "../ElectronJS/chrome_win64/chrome.exe"  # 指定chrome位置
             driver_path = "../ElectronJS/chrome_win64/chromedriver_win64.exe"
-    elif os.getcwd().find("ExecuteStage") >= 0:  # 如果直接执行
-        print("Finding chromedriver in ./Chrome",
-              os.getcwd()+"/Chrome")
-        options.binary_location = "./Chrome/chrome.exe"  # 指定chrome位置
-        # option.binary_location = "C:\\Users\\q9823\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"
-        driver_path = "./Chrome/chromedriver.exe"
     else:
         options.binary_location = "./chrome.exe"  # 指定chrome位置
         driver_path = "./chromedriver.exe"

Разница между файлами не показана из-за своего большого размера
+ 0 - 6
ExecuteStage/stealth.min.js


+ 50 - 50
Extension/manifest_v3/package.json

@@ -1,51 +1,51 @@
 {
-  "name": "EasySpider",
-  "version": "0.3.3",
-  "type": "module",
-  "scripts": {
-    "build": "rollup -c",
-    "dev": "rollup -c -w",
-    "crx": "crx3",
-    "package": "node package.js"
-  },
-  "license": "GPL-3.0",
-  "dependencies": {
-    "crx": "^5.0.1",
-    "crx3": "^1.1.3",
-    "dotenv": "^16.0.0",
-    "jquery": "^3.6.4",
-    "rollup-plugin-alias": "^2.2.0",
-    "rollup-plugin-css-only": "^3.1.0",
-    "rollup-plugin-import-css": "^3.0.3",
-    "rollup-plugin-vue": "^6.0.0",
-    "vue": "^2.7.14",
-    "vue-template-compiler": "^2.7.14",
-    "webextension-polyfill": "^0.7.0",
-    "webextension-polyfill-ts": "^0.22.0"
-  },
-  "devDependencies": {
-    "@rollup/plugin-alias": "^3.1.1",
-    "@rollup/plugin-commonjs": "^17.0.0",
-    "@rollup/plugin-json": "^4.1.0",
-    "@rollup/plugin-node-resolve": "^11.0.1",
-    "@rollup/plugin-replace": "^2.3.4",
-    "@types/chrome": "0.0.164",
-    "@types/fs-extra": "^9.0.13",
-    "@types/node": "^16.11.10",
-    "@vitejs/plugin-vue": "^1.9.3",
-    "esno": "^0.12.1",
-    "firebase": "^9.18.0",
-    "fs-extra": "^10.0.0",
-    "npm-run-all": "^4.1.5",
-    "rimraf": "^3.0.2",
-    "rollup": "^2.38.5",
-    "rollup-plugin-chrome-extension": "^3.6.12",
-    "rollup-plugin-empty-dir": "^1.0.4",
-    "rollup-plugin-inject-process-env": "^1.3.1",
-    "rollup-plugin-postcss": "^4.0.2",
-    "rollup-plugin-typescript2": "^0.31.0",
-    "rollup-plugin-vue2": "^0.8.1",
-    "rollup-plugin-zip": "^1.0.1",
-    "typescript": "^4.4.3"
-  }
-}
+    "name": "EasySpider",
+    "version": "0.3.3",
+    "type": "module",
+    "scripts": {
+        "build": "rollup -c",
+        "dev": "rollup -c -w",
+        "crx": "crx3",
+        "package": "node package.js"
+    },
+    "license": "GPL-3.0",
+    "dependencies": {
+        "crx": "^5.0.1",
+        "crx3": "^1.1.3",
+        "dotenv": "^16.0.0",
+        "jquery": "^3.6.4",
+        "rollup-plugin-alias": "^2.2.0",
+        "rollup-plugin-css-only": "^3.1.0",
+        "rollup-plugin-import-css": "^3.0.3",
+        "rollup-plugin-vue": "^6.0.0",
+        "vue": "^2.7.14",
+        "vue-template-compiler": "^2.7.14",
+        "webextension-polyfill": "^0.7.0",
+        "webextension-polyfill-ts": "^0.22.0"
+    },
+    "devDependencies": {
+        "@rollup/plugin-alias": "^3.1.1",
+        "@rollup/plugin-commonjs": "^17.0.0",
+        "@rollup/plugin-json": "^4.1.0",
+        "@rollup/plugin-node-resolve": "^11.0.1",
+        "@rollup/plugin-replace": "^2.3.4",
+        "@types/chrome": "0.0.164",
+        "@types/fs-extra": "^9.0.13",
+        "@types/node": "^16.11.10",
+        "@vitejs/plugin-vue": "^1.9.3",
+        "esno": "^0.12.1",
+        "firebase": "^9.18.0",
+        "fs-extra": "^10.0.0",
+        "npm-run-all": "^4.1.5",
+        "rimraf": "^3.0.2",
+        "rollup": "^2.38.5",
+        "rollup-plugin-chrome-extension": "^3.6.12",
+        "rollup-plugin-empty-dir": "^1.0.4",
+        "rollup-plugin-inject-process-env": "^1.3.1",
+        "rollup-plugin-postcss": "^4.0.2",
+        "rollup-plugin-typescript2": "^0.31.0",
+        "rollup-plugin-vue2": "^0.8.1",
+        "rollup-plugin-zip": "^1.0.1",
+        "typescript": "^4.4.3"
+    }
+}

+ 55 - 46
Extension/manifest_v3/src/manifest.json

@@ -1,48 +1,57 @@
 {
-  "name": "EasySpider",
-  "version": "0.3.3",
-  "description": "EasySpider's chrome extension",
-  "author": "Naibo Wang",
-  "manifest_version": 3,
-  "action": {
-    "default_icon": {
-      "16": "assets/icon-16.png",
-      "19": "assets/icon-19.png",
-      "38": "assets/icon-38.png",
-      "128": "assets/icon-128.png"
+    "name": "EasySpider",
+    "version": "0.3.3",
+    "description": "EasySpider's chrome extension",
+    "author": "Naibo Wang",
+    "manifest_version": 3,
+    "action": {
+        "default_icon": {
+            "16": "assets/icon-16.png",
+            "19": "assets/icon-19.png",
+            "38": "assets/icon-38.png",
+            "128": "assets/icon-128.png"
+        },
+        "default_title": "EasySpider"
     },
-    "default_title": "EasySpider"
-  },
-  "icons": {
-    "16": "assets/icon-16.png",
-    "38": "assets/icon-38.png",
-    "128": "assets/icon-128.png"
-  },
-  "background": {
-    "service_worker": "background.ts"
-  },
-  "content_scripts": [
-    {
-      "matches": [
-        "http://*/*",
-        "https://*/*"
-      ],
-      "css": ["style/toolkit.css"],
-      "js": ["content-scripts/main.js"],
-      "run_at": "document_end",
-      "all_frames": true
-    }
-  ],
-   "web_accessible_resources": [
-    {
-      "resources": [ "*/*.js" ],
-      "matches": [
-        "http://*/*",
-        "https://*/*"
-      ]
-    }
-  ],
-  "permissions": [
-    "identity", "storage", "tabs","scripting"
-  ]
-}
+    "icons": {
+        "16": "assets/icon-16.png",
+        "38": "assets/icon-38.png",
+        "128": "assets/icon-128.png"
+    },
+    "background": {
+        "service_worker": "background.ts"
+    },
+    "content_scripts": [
+        {
+            "matches": [
+                "http://*/*",
+                "https://*/*"
+            ],
+            "css": [
+                "style/toolkit.css"
+            ],
+            "js": [
+                "content-scripts/main.js"
+            ],
+            "run_at": "document_end",
+            "all_frames": true
+        }
+    ],
+    "web_accessible_resources": [
+        {
+            "resources": [
+                "*/*.js"
+            ],
+            "matches": [
+                "http://*/*",
+                "https://*/*"
+            ]
+        }
+    ],
+    "permissions": [
+        "identity",
+        "storage",
+        "tabs",
+        "scripting"
+    ]
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов