From dee52e68a21227cbf56549496e60cb2c32316e3e Mon Sep 17 00:00:00 2001 From: Ahmad Kholid Date: Wed, 4 Oct 2023 13:52:17 +0800 Subject: [PATCH 1/4] fix: can't use expression in loop blocks selector (#1415) --- src/utils/shared.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/shared.js b/src/utils/shared.js index a2c570b9..c11bce48 100644 --- a/src/utils/shared.js +++ b/src/utils/shared.js @@ -782,6 +782,7 @@ export const tasks = { refDataKeys: [ 'maxLoop', 'loopData', + 'selector', 'startIndex', 'variableName', 'referenceKey', @@ -819,6 +820,7 @@ export const tasks = { maxConnection: 1, refDataKeys: [ 'maxLoop', + 'selector', 'variableName', 'elementSelector', 'actionElSelector', From a1be1c47fe58905af653b9ba119b466c3ce0347c Mon Sep 17 00:00:00 2001 From: Ahmad Kholid Date: Wed, 4 Oct 2023 17:00:51 +0800 Subject: [PATCH 2/4] fix: execute workflow event listener --- src/content/services/shortcutListener.js | 33 ++++++++++++------------ 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/content/services/shortcutListener.js b/src/content/services/shortcutListener.js index dbcba087..a37866b1 100644 --- a/src/content/services/shortcutListener.js +++ b/src/content/services/shortcutListener.js @@ -7,23 +7,22 @@ Mousetrap.prototype.stopCallback = function () { }; function automaCustomEventListener(findWorkflow) { - window.addEventListener( - 'automa:execute-workflow', - ({ detail }) => { - if (!detail || (!detail.id && !detail.publicId)) return; - - const workflowId = detail.id || detail.publicId; - const workflow = findWorkflow(workflowId, Boolean(detail.publicId)); - - if (!workflow) return; - - workflow.options = { - data: detail.data || {}, - }; - sendMessage('workflow:execute', workflow, 'background'); - }, - true - ); + function customEventListener({ detail }) { + if (!detail || (!detail.id && !detail.publicId)) return; + + const workflowId = detail.id || detail.publicId; + const workflow = findWorkflow(workflowId, Boolean(detail.publicId)); + + if (!workflow) return; + + workflow.options = { + data: detail.data || {}, + }; + sendMessage('workflow:execute', workflow, 'background'); + } + + window.addEventListener('__automaExecuteWorkflow', customEventListener); + window.addEventListener('automa:execute-workflow', customEventListener); } function workflowShortcutsListener(findWorkflow, shortcutsObj) { const shortcuts = Object.entries(shortcutsObj); From 3e6972ccc79222b285d0b78c8a8a25f779a9d923 Mon Sep 17 00:00:00 2001 From: Ahmad Kholid Date: Thu, 5 Oct 2023 14:06:16 +0800 Subject: [PATCH 3/4] fix: can't attach debugger --- src/content/blocksHandler/handlerForms.js | 2 ++ src/workflowEngine/helper.js | 13 ++----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/content/blocksHandler/handlerForms.js b/src/content/blocksHandler/handlerForms.js index 23c4bd85..6490f7d5 100644 --- a/src/content/blocksHandler/handlerForms.js +++ b/src/content/blocksHandler/handlerForms.js @@ -24,6 +24,8 @@ async function forms(block) { async function typeText(element) { if (block.debugMode && data.type === 'text-field') { + element.focus?.(); + const commands = data.value.split('').map((char) => ({ type: 'keyDown', text: char === '\n' ? '\r' : char, diff --git a/src/workflowEngine/helper.js b/src/workflowEngine/helper.js index d8c044a6..c5df8d15 100644 --- a/src/workflowEngine/helper.js +++ b/src/workflowEngine/helper.js @@ -65,17 +65,8 @@ export function attachDebugger(tabId, prevTab) { if (prevTab && tabId !== prevTab) chrome.debugger.detach({ tabId: prevTab }); - chrome.debugger.getTargets((targets) => { - targets.forEach((target) => { - if (target.attached || target.tabId !== tabId) { - resolve(); - return; - } - - chrome.debugger.attach({ tabId }, '1.3', () => { - chrome.debugger.sendCommand({ tabId }, 'Page.enable', resolve); - }); - }); + chrome.debugger.attach({ tabId }, '1.3', () => { + chrome.debugger.sendCommand({ tabId }, 'Page.enable', resolve); }); }); } From 5b713136be06fdcca7d71acdf5405c199890e1be Mon Sep 17 00:00:00 2001 From: Ahmad Kholid Date: Thu, 5 Oct 2023 15:00:25 +0800 Subject: [PATCH 4/4] v1.28.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d12e4c6..f3c50f29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "automa", - "version": "1.28.14", + "version": "1.28.15", "description": "An extension for automating your browser by connecting blocks", "repository": { "type": "git",