Bläddra i källkod

参数索引值Bug修复

naibo 2 år sedan
förälder
incheckning
908235a738

+ 1 - 1
.temp_to_pub/EasySpider_windows_x64/Code/easyspider_executestage.py

@@ -1147,7 +1147,7 @@ class BrowserThread(Thread):
         try:
             pageHTML = etree.HTML(self.browser.page_source)
         except:
-            pageHTML = ""
+            pageHTML = etree.HTML("")
         if loopElement != "":  # 只在数据在循环中提取时才需要获取循环元素
             try:
                 loopElementOuterHTML = loopElement.get_attribute('outerHTML')

BIN
ElectronJS/EasySpider_en.crx


BIN
ElectronJS/EasySpider_zh.crx


+ 13 - 1
ElectronJS/main.js

@@ -28,7 +28,8 @@ if(config.debug){
         process.stderr.write(util.format.apply(null, arguments) + '\n')
     }
 }
-
+let allWindowSockets = [];
+let allWindowScoketNames = [];
 task_server.start(config.webserver_port); //start local server
 let server_address = `${config.webserver_address}:${config.webserver_port}`;
 const websocket_port = 8084; //目前只支持8084端口,写死,因为扩展里面写死了
@@ -296,6 +297,13 @@ async function beginInvoke(msg, ws) {
                 }
             } else {
                 socket_window.send(msg.message.pipe);
+                for(let i in allWindowSockets){
+                    try{
+                        allWindowSockets[i].send(msg.message.pipe);
+                    } catch {
+                        console.log("Cannot send to socket with id: ", allWindowScoketNames[i]);
+                    }
+                }
                 console.log("FROM Flowchart: ", JSON.parse(msg.message.pipe));
             }
         } catch (e) {
@@ -351,6 +359,7 @@ async function beginInvoke(msg, ws) {
 }
 
 const WebSocket = require('ws');
+const {all} = require("express/lib/application");
 let socket_window = null;
 let socket_start = null;
 let socket_flowchart = null;
@@ -381,6 +390,8 @@ wss.on('connection', function (ws) {
                 handle_pairs[msg.message.id] = current_handle;
                 console.log("Set handle_pair for id: ", msg.message.id, " to ", current_handle, ", title is: ", msg.message.title);
                 socket_flowchart.send(JSON.stringify({"type": "title", "data": {"title":msg.message.title}}));
+                allWindowSockets.push(ws);
+                allWindowScoketNames.push(msg.message.id);
                 // console.log("handle_pairs: ", handle_pairs);
             }
         } else if (msg.type == 10) {
@@ -433,6 +444,7 @@ async function runBrowser(lang = "en", user_data_folder = '', mobile = false) {
         .build();
     await driver.manage().setTimeouts({implicit: 10000, pageLoad: 10000, script: 10000});
     await driver.executeScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
+    // await driver.executeScript("localStorage.clear();"); //重置参数数量
     const cdpConnection = await driver.createCDPConnection("page");
     let stealth_path = path.join(__dirname, "stealth.min.js");
     let stealth = fs.readFileSync(stealth_path, 'utf8');

+ 2 - 1
ElectronJS/src/taskGrid/FlowChart.js

@@ -128,7 +128,7 @@ let app = new Vue({
                 "nodeType": 0,
                 "contentType": 0,
                 "relative": false,
-                "name": LANG("自定义参数_" + this.nowNode["parameters"]["paras"].length.toString(),"Custom_Field_" + this.nowNode["parameters"]["paras"].length.toString()),
+                "name": LANG("自定义参数_" + parameterNum.toString(),"Custom_Field_" + parameterNum.toString()),
                 "desc": "",
                 "extractType": 0,
                 "relativeXPath": "//body",
@@ -150,6 +150,7 @@ let app = new Vue({
                 "downloadPic": 0,
                 "paraType": "text",
             });
+            notifyParameterNum(1);
             this.paraIndex = this.nowNode["parameters"]["paras"].length - 1;
             setTimeout(function(){$("#app > div.elements > div.toolkitcontain > table.toolkittb4 > tbody > tr:last-child")[0].scrollIntoView(false); //滚动到底部
             }, 200);

+ 1 - 0
ElectronJS/src/taskGrid/taskInfo.html

@@ -162,4 +162,5 @@
         app.$data.task = result;
         app.$data.show = true;
     });
+
 </script>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
ElectronJS/tasks/156.json


+ 1 - 0
Extension/manifest_v3/src/content-scripts/main.js

@@ -8,6 +8,7 @@ import iframe from "./iframe.vue";
 //表现逻辑层的处理
 
 if (window.location.href.indexOf("backEndAddressServiceWrapper") >= 0) {
+    chrome.storage.local.set({ "parameterNum": 1 }); //重置参数索引值
     throw "serviceGrid"; //如果是服务器网页页面,则不执行工具
 }
 

+ 7 - 1
Extension/manifest_v3/src/content-scripts/messageInteraction.js

@@ -28,7 +28,13 @@ global.ws.onopen = function() {
     };
     this.send(JSON.stringify(message));
 };
-
+global.ws.onmessage = function(evt) {
+    evt = JSON.parse(evt.data);
+    if (evt["type"] == "0") { //0代表更新参数添加索引值
+        chrome.storage.local.set({ "parameterNum": parseInt(evt["value"]) }); //修改值
+        console.log("更新参数添加索引值为:" + evt["value"]);
+    }
+};
 export function input(value) {
     let message = {
         "type": "inputText",

+ 1 - 0
Extension/manifest_v3/src/manifest.json

@@ -4,6 +4,7 @@
     "description": "EasySpider's chrome extension",
     "author": "Naibo Wang",
     "manifest_version": 3,
+    "persistent": true,
     "action": {
         "default_icon": {
             "16": "assets/icon-16.png",

Vissa filer visades inte eftersom för många filer har ändrats