13 Commits

Author SHA1 Message Date
dependabot[bot]
71c5b70fea Bump http-proxy-middleware from 2.0.7 to 2.0.9
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.7 to 2.0.9.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.9/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.7...v2.0.9)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-version: 2.0.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-23 10:43:10 +00:00
fofolee
14769bb7e7 Merge pull request #85 from fofolee/dependabot/npm_and_yarn/plugin/axios-1.8.2
Bump axios from 1.7.9 to 1.8.2 in /plugin
2025-04-23 18:42:11 +08:00
fofolee
5d76d4d657 Merge pull request #96 from fofolee/dependabot/npm_and_yarn/plugin/ses-1.12.0
Bump ses from 1.10.0 to 1.12.0 in /plugin
2025-04-23 18:41:59 +08:00
fofolee
ebde8999bf 添加utools.markdown支持 2025-04-19 09:12:08 +08:00
dependabot[bot]
31f0d66ebc Bump ses from 1.10.0 to 1.12.0 in /plugin
Bumps [ses](https://github.com/endojs/endo/tree/HEAD/packages/ses) from 1.10.0 to 1.12.0.
- [Release notes](https://github.com/endojs/endo/releases)
- [Changelog](https://github.com/endojs/endo/blob/master/packages/ses/CHANGELOG.md)
- [Commits](https://github.com/endojs/endo/commits/ses@1.12.0/packages/ses)

---
updated-dependencies:
- dependency-name: ses
  dependency-version: 1.12.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-18 15:11:31 +00:00
fofolee
c1f86c20d2 修复编排中ubrowser不支持添加多个同样的操作的BUG 2025-04-11 11:00:20 +08:00
fofolee
bbdc2c6d65 Merge branch 'master' of https://github.com/fofolee/uTools-quickcommand 2025-04-11 10:49:36 +08:00
fofolee
0979e5648c Merge pull request #94 from itldg/master
优化下拉框筛选后重新调整uTools高度
2025-04-11 10:45:13 +08:00
ITLDG
f9a22595be 优化下拉框筛选后重新调整uTools高度 2025-04-10 16:22:06 +08:00
fofolee
823a95079a 规范编排生成的Code,为每段代码添加逗号;修复编排eval导致的BUG 2025-04-09 10:43:30 +08:00
fofolee
39ee88b02a Merge branch 'master' of https://github.com/fofolee/uTools-quickcommand 2025-04-09 10:05:46 +08:00
fofolee
fcf3d5912e 修复可视化编排的命令定时任务和主搜索框推送失效的BUG 2025-04-09 10:04:41 +08:00
dependabot[bot]
f61fe17c6a Bump axios from 1.7.9 to 1.8.2 in /plugin
Bumps [axios](https://github.com/axios/axios) from 1.7.9 to 1.8.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.7.9...v1.8.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-15 06:57:46 +00:00
9 changed files with 113 additions and 64 deletions

12
package-lock.json generated
View File

@@ -6251,9 +6251,9 @@
}
},
"node_modules/http-proxy-middleware": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz",
"integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==",
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz",
"integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -15697,9 +15697,9 @@
}
},
"http-proxy-middleware": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz",
"integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==",
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz",
"integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==",
"dev": true,
"requires": {
"@types/http-proxy": "^1.17.8",

View File

@@ -5,7 +5,7 @@
"packages": {
"": {
"dependencies": {
"axios": "^1.7.9",
"axios": "^1.8.2",
"chrome-remote-interface": "^0.33.2",
"crypto-js": "^4.2.0",
"dompurify": "^3.2.4",
@@ -15,7 +15,7 @@
"node-forge": "^1.3.1",
"pinyin-match": "^1.2.6",
"png2icons": "^2.0.1",
"ses": "^1.10.0",
"ses": "^1.12.0",
"sm-crypto": "^0.3.13",
"tree-kill": "^1.2.2"
}
@@ -40,9 +40,9 @@
"license": "MIT"
},
"node_modules/axios": {
"version": "1.7.9",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
@@ -229,9 +229,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/ses": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/ses/-/ses-1.10.0.tgz",
"integrity": "sha512-HXmJbNEgY/4hsQfaz5dna39vVKNyvlElRmJYk+bjTqSXSElT0Hr6NKwWVg4j0TxP6IuHp/PNMoWJKIRXzmLbAQ==",
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/ses/-/ses-1.12.0.tgz",
"integrity": "sha512-jvmwXE2lFxIIY1j76hFjewIIhYMR9Slo3ynWZGtGl5M7VUCw3EA0wetS+JCIbl2UcSQjAT0yGAHkyxPJreuC9w==",
"license": "Apache-2.0",
"dependencies": {
"@endo/env-options": "^1.1.8"
@@ -293,9 +293,9 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"axios": {
"version": "1.7.9",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
"requires": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
@@ -419,9 +419,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"ses": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/ses/-/ses-1.10.0.tgz",
"integrity": "sha512-HXmJbNEgY/4hsQfaz5dna39vVKNyvlElRmJYk+bjTqSXSElT0Hr6NKwWVg4j0TxP6IuHp/PNMoWJKIRXzmLbAQ==",
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/ses/-/ses-1.12.0.tgz",
"integrity": "sha512-jvmwXE2lFxIIY1j76hFjewIIhYMR9Slo3ynWZGtGl5M7VUCw3EA0wetS+JCIbl2UcSQjAT0yGAHkyxPJreuC9w==",
"requires": {
"@endo/env-options": "^1.1.8"
}

View File

@@ -1,6 +1,6 @@
{
"dependencies": {
"axios": "^1.7.9",
"axios": "^1.8.2",
"chrome-remote-interface": "^0.33.2",
"crypto-js": "^4.2.0",
"dompurify": "^3.2.4",
@@ -10,7 +10,7 @@
"node-forge": "^1.3.1",
"pinyin-match": "^1.2.6",
"png2icons": "^2.0.1",
"ses": "^1.10.0",
"ses": "^1.12.0",
"sm-crypto": "^0.3.13",
"tree-kill": "^1.2.2"
}

View File

@@ -16,6 +16,8 @@ import programmings from "./js/options/programs.js";
import defaultProfile from "./js/options/defaultProfile.js";
import Cron from "croner";
import QuickCommand from "components/quickcommandUI/QuickCommand";
import { generateFlowsCode } from "js/composer/generateCode";
// import autoDetach from "./js/autoDetach.js";
export default defineComponent({
@@ -157,10 +159,13 @@ export default defineComponent({
reslove([`超过${timeout}ms未响应`]);
}, timeout);
let command = dbManager.getDB("qc_" + featureCode);
let commandCode = command.cmd;
let commandCode =
command.program === "quickcomposer"
? generateFlowsCode(command.flows)
: command.cmd;
if (mainInput)
commandCode = commandCode.replace(/\{\{input\}\}/g, mainInput);
if (command.program === "quickcommand") {
if (["quickcommand", "quickcomposer"].includes(command.program)) {
window.runCodeInSandbox(commandCode, (stdout, stderr) => {
stderr && reslove([stderr.toString()]);
reslove(stdout);

View File

@@ -14,12 +14,15 @@
bordered
class="action-card cursor-pointer"
:class="{
'action-selected': selectedActionKeys.includes(actionKey),
'action-selected': actionCount[actionKey] > 0,
}"
@click="toggleAction(actionKey)"
@click="addAction(actionKey)"
>
<div class="q-pa-xs text-caption text-wrap text-center">
{{ action.label }}
<q-badge v-if="actionCount[actionKey]" color="primary" floating>
{{ actionCount[actionKey] }}
</q-badge>
</div>
</q-card>
</div>
@@ -38,7 +41,7 @@
<q-chip
square
removable
@remove="toggleAction(selectedActionKey)"
@remove="removeAction(index)"
class="text-caption q-mb-sm"
:style="{
paddingLeft: '7px',
@@ -125,6 +128,13 @@ export default {
selectedActionArgs() {
return this.modelValue.map((x) => x.args);
},
actionCount() {
const count = {};
this.selectedActionKeys.forEach((key) => {
count[key] = (count[key] || 0) + 1;
});
return count;
},
},
methods: {
moveAction(index, direction) {
@@ -138,26 +148,25 @@ export default {
this.$emit("update:model-value", newOperation);
}
},
toggleAction(actionKey) {
const index = this.selectedActionKeys.indexOf(actionKey);
addAction(actionKey) {
let newOperation = [...this.modelValue];
if (index !== -1) {
// 移除操作
newOperation.splice(index, 1);
} else {
// 添加操作
const { config, value } = this.operationsMap[actionKey];
const args = config?.length
? config.map((field) => field.defaultValue)
: [];
// 添加操作
const { config, value } = this.operationsMap[actionKey];
const args = config?.length
? config.map((field) => field.defaultValue)
: [];
const newOperationItem = { value, args };
if (actionKey !== value) {
newOperationItem.key = actionKey;
}
newOperation.push(newOperationItem);
const newOperationItem = { value, args };
if (actionKey !== value) {
newOperationItem.key = actionKey;
}
newOperation.push(newOperationItem);
this.$emit("update:model-value", newOperation);
},
removeAction(index) {
let newOperation = [...this.modelValue];
newOperation.splice(index, 1);
this.$emit("update:model-value", newOperation);
},
updateActionArgs(argvIndex, argvVal, actionIndex) {
@@ -250,4 +259,11 @@ export default {
.row.q-col-gutter-xs > * {
padding: 2px;
}
.q-badge {
font-size: 10px;
padding: 2px 4px;
right: -4px;
top: -4px;
}
</style>

View File

@@ -114,9 +114,13 @@ export default {
return this.items.filter((x) => {
if (this.is.json) {
const titleMatch = window.pinyinMatch.match(x.title, this.searchWords);
const titleMatch = window.pinyinMatch.match(
x.title,
this.searchWords
);
const descMatch =
x.description && window.pinyinMatch.match(x.description, this.searchWords);
x.description &&
window.pinyinMatch.match(x.description, this.searchWords);
return titleMatch || descMatch;
} else {
return window.pinyinMatch.match(x, this.searchWords);
@@ -212,6 +216,7 @@ export default {
this.searchWords = text;
if (this.matchedItems.length < this.currentIndex + 1)
this.currentIndex = 0;
this.setUtoolsHeight(this.itemHeight * this.matchedItemsSize);
}, this.options.options.placeholder);
},

View File

@@ -4,13 +4,13 @@ export function generateCode(flow) {
// 获取变量赋值代码,如果变量已经存在,则直接赋值,否则声明并赋值
const getVarAssignCode = (varName, varValue) => {
if (usedVarNames.includes(varName)) {
return `${varName} = ${varValue};`;
return `${varName} = ${varValue}`;
}
usedVarNames.push(varName);
if (!varValue) {
return `let ${varName};`;
return `let ${varName}`;
}
return `let ${varName} = ${varValue};`;
return `let ${varName} = ${varValue}`;
};
const getVarByPath = (name, path) => {
@@ -36,10 +36,11 @@ export function generateCode(flow) {
);
const indent = " ";
const comma = ";";
// 局部变量赋值
manualVars.forEach((v) => {
code.push(indent + getVarAssignCode(v.name, v.value));
code.push(indent + getVarAssignCode(v.name, v.value) + comma);
});
commands.forEach((cmd) => {
@@ -65,7 +66,7 @@ export function generateCode(flow) {
const extractVarCode = Object.entries(details)
.map(
([path, varName]) =>
`let ${varName} = ${getVarByPath(promiseName, path)}`
`let ${varName} = ${getVarByPath(promiseName, path)};`
)
.join("\n");
@@ -80,20 +81,22 @@ export function generateCode(flow) {
})`;
}
}
code.push(indent + cmdCode);
code.push(indent + cmdCode + comma);
} else if (cmd.asyncMode === "await") {
// 使用 await 模式
const promiseName = name || "__result";
cmdCode = getVarAssignCode(promiseName, `await ${cmdCode}`);
code.push(indent + cmdCode);
code.push(indent + cmdCode + comma);
// 处理详细变量
if (details) {
Object.entries(details).forEach(([path, varName]) => {
code.push(
`${indent}${getVarAssignCode(
varName,
getVarByPath(promiseName, path)
)}`
indent +
`${getVarAssignCode(
varName,
getVarByPath(promiseName, path)
)}` +
comma
);
});
}
@@ -101,15 +104,17 @@ export function generateCode(flow) {
// 非Async命令
const resultVarName = name || "__result";
cmdCode = getVarAssignCode(resultVarName, `${cmdCode}`);
code.push(indent + cmdCode);
code.push(indent + cmdCode + comma);
// 处理详细变量
if (details) {
Object.entries(details).forEach(([path, varName]) => {
code.push(
`${indent}${getVarAssignCode(
varName,
getVarByPath(resultVarName, path)
)}`
indent +
`${getVarAssignCode(
varName,
getVarByPath(resultVarName, path)
)}` +
comma
);
});
}
@@ -119,11 +124,11 @@ export function generateCode(flow) {
if (cmd.asyncMode === "await") {
cmdCode = `await ${cmdCode}`;
}
code.push(indent + cmdCode);
code.push(indent + cmdCode + comma);
}
});
code.push("}"); // Close the function
code.push("};"); // Close the function
// 如果是主函数,则自动执行
if (funcName === "main") {

View File

@@ -323,6 +323,19 @@ export const ubrowserOperationConfigs = {
},
],
},
markdown: {
value: "markdown",
label: "转markdown",
icon: "get_app",
config: [
{
label: "CSS 或 XPath 选择器,不传递则转换整个网页内容",
icon: "find_in_page",
component: "VariableInput",
width: 12,
},
],
},
setCookies: {
value: "setCookies",
label: "设置Cookie",

View File

@@ -138,6 +138,11 @@ interface UBrowser {
* 配合 when 使用
*/
end(): this;
/**
* 转为markdown
* @param selector CSS 或 XPath 选择器,不传递则转换整个网页内容
*/
markdown(selector: string): this;
/**
* 单击元素
*/