mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-20 10:55:43 +08:00
Compare commits
13 Commits
5.0.3
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71c5b70fea | ||
|
|
14769bb7e7 | ||
|
|
5d76d4d657 | ||
|
|
ebde8999bf | ||
|
|
31f0d66ebc | ||
|
|
c1f86c20d2 | ||
|
|
bbdc2c6d65 | ||
|
|
0979e5648c | ||
|
|
f9a22595be | ||
|
|
823a95079a | ||
|
|
39ee88b02a | ||
|
|
fcf3d5912e | ||
|
|
f61fe17c6a |
12
package-lock.json
generated
12
package-lock.json
generated
@@ -6251,9 +6251,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/http-proxy-middleware": {
|
"node_modules/http-proxy-middleware": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz",
|
||||||
"integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==",
|
"integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -15697,9 +15697,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"http-proxy-middleware": {
|
"http-proxy-middleware": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz",
|
||||||
"integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==",
|
"integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/http-proxy": "^1.17.8",
|
"@types/http-proxy": "^1.17.8",
|
||||||
|
|||||||
28
plugin/package-lock.json
generated
28
plugin/package-lock.json
generated
@@ -5,7 +5,7 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.8.2",
|
||||||
"chrome-remote-interface": "^0.33.2",
|
"chrome-remote-interface": "^0.33.2",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dompurify": "^3.2.4",
|
"dompurify": "^3.2.4",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
"pinyin-match": "^1.2.6",
|
"pinyin-match": "^1.2.6",
|
||||||
"png2icons": "^2.0.1",
|
"png2icons": "^2.0.1",
|
||||||
"ses": "^1.10.0",
|
"ses": "^1.12.0",
|
||||||
"sm-crypto": "^0.3.13",
|
"sm-crypto": "^0.3.13",
|
||||||
"tree-kill": "^1.2.2"
|
"tree-kill": "^1.2.2"
|
||||||
}
|
}
|
||||||
@@ -40,9 +40,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.7.9",
|
"version": "1.8.2",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
|
||||||
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
|
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
@@ -229,9 +229,9 @@
|
|||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"node_modules/ses": {
|
"node_modules/ses": {
|
||||||
"version": "1.10.0",
|
"version": "1.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/ses/-/ses-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/ses/-/ses-1.12.0.tgz",
|
||||||
"integrity": "sha512-HXmJbNEgY/4hsQfaz5dna39vVKNyvlElRmJYk+bjTqSXSElT0Hr6NKwWVg4j0TxP6IuHp/PNMoWJKIRXzmLbAQ==",
|
"integrity": "sha512-jvmwXE2lFxIIY1j76hFjewIIhYMR9Slo3ynWZGtGl5M7VUCw3EA0wetS+JCIbl2UcSQjAT0yGAHkyxPJreuC9w==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@endo/env-options": "^1.1.8"
|
"@endo/env-options": "^1.1.8"
|
||||||
@@ -293,9 +293,9 @@
|
|||||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "1.7.9",
|
"version": "1.8.2",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
|
||||||
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
|
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
@@ -419,9 +419,9 @@
|
|||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"ses": {
|
"ses": {
|
||||||
"version": "1.10.0",
|
"version": "1.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/ses/-/ses-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/ses/-/ses-1.12.0.tgz",
|
||||||
"integrity": "sha512-HXmJbNEgY/4hsQfaz5dna39vVKNyvlElRmJYk+bjTqSXSElT0Hr6NKwWVg4j0TxP6IuHp/PNMoWJKIRXzmLbAQ==",
|
"integrity": "sha512-jvmwXE2lFxIIY1j76hFjewIIhYMR9Slo3ynWZGtGl5M7VUCw3EA0wetS+JCIbl2UcSQjAT0yGAHkyxPJreuC9w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@endo/env-options": "^1.1.8"
|
"@endo/env-options": "^1.1.8"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.8.2",
|
||||||
"chrome-remote-interface": "^0.33.2",
|
"chrome-remote-interface": "^0.33.2",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dompurify": "^3.2.4",
|
"dompurify": "^3.2.4",
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
"pinyin-match": "^1.2.6",
|
"pinyin-match": "^1.2.6",
|
||||||
"png2icons": "^2.0.1",
|
"png2icons": "^2.0.1",
|
||||||
"ses": "^1.10.0",
|
"ses": "^1.12.0",
|
||||||
"sm-crypto": "^0.3.13",
|
"sm-crypto": "^0.3.13",
|
||||||
"tree-kill": "^1.2.2"
|
"tree-kill": "^1.2.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import programmings from "./js/options/programs.js";
|
|||||||
import defaultProfile from "./js/options/defaultProfile.js";
|
import defaultProfile from "./js/options/defaultProfile.js";
|
||||||
import Cron from "croner";
|
import Cron from "croner";
|
||||||
import QuickCommand from "components/quickcommandUI/QuickCommand";
|
import QuickCommand from "components/quickcommandUI/QuickCommand";
|
||||||
|
import { generateFlowsCode } from "js/composer/generateCode";
|
||||||
|
|
||||||
// import autoDetach from "./js/autoDetach.js";
|
// import autoDetach from "./js/autoDetach.js";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -157,10 +159,13 @@ export default defineComponent({
|
|||||||
reslove([`超过${timeout}ms未响应`]);
|
reslove([`超过${timeout}ms未响应`]);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
let command = dbManager.getDB("qc_" + featureCode);
|
let command = dbManager.getDB("qc_" + featureCode);
|
||||||
let commandCode = command.cmd;
|
let commandCode =
|
||||||
|
command.program === "quickcomposer"
|
||||||
|
? generateFlowsCode(command.flows)
|
||||||
|
: command.cmd;
|
||||||
if (mainInput)
|
if (mainInput)
|
||||||
commandCode = commandCode.replace(/\{\{input\}\}/g, mainInput);
|
commandCode = commandCode.replace(/\{\{input\}\}/g, mainInput);
|
||||||
if (command.program === "quickcommand") {
|
if (["quickcommand", "quickcomposer"].includes(command.program)) {
|
||||||
window.runCodeInSandbox(commandCode, (stdout, stderr) => {
|
window.runCodeInSandbox(commandCode, (stdout, stderr) => {
|
||||||
stderr && reslove([stderr.toString()]);
|
stderr && reslove([stderr.toString()]);
|
||||||
reslove(stdout);
|
reslove(stdout);
|
||||||
|
|||||||
@@ -14,12 +14,15 @@
|
|||||||
bordered
|
bordered
|
||||||
class="action-card cursor-pointer"
|
class="action-card cursor-pointer"
|
||||||
:class="{
|
: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">
|
<div class="q-pa-xs text-caption text-wrap text-center">
|
||||||
{{ action.label }}
|
{{ action.label }}
|
||||||
|
<q-badge v-if="actionCount[actionKey]" color="primary" floating>
|
||||||
|
{{ actionCount[actionKey] }}
|
||||||
|
</q-badge>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,7 +41,7 @@
|
|||||||
<q-chip
|
<q-chip
|
||||||
square
|
square
|
||||||
removable
|
removable
|
||||||
@remove="toggleAction(selectedActionKey)"
|
@remove="removeAction(index)"
|
||||||
class="text-caption q-mb-sm"
|
class="text-caption q-mb-sm"
|
||||||
:style="{
|
:style="{
|
||||||
paddingLeft: '7px',
|
paddingLeft: '7px',
|
||||||
@@ -125,6 +128,13 @@ export default {
|
|||||||
selectedActionArgs() {
|
selectedActionArgs() {
|
||||||
return this.modelValue.map((x) => x.args);
|
return this.modelValue.map((x) => x.args);
|
||||||
},
|
},
|
||||||
|
actionCount() {
|
||||||
|
const count = {};
|
||||||
|
this.selectedActionKeys.forEach((key) => {
|
||||||
|
count[key] = (count[key] || 0) + 1;
|
||||||
|
});
|
||||||
|
return count;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
moveAction(index, direction) {
|
moveAction(index, direction) {
|
||||||
@@ -138,26 +148,25 @@ export default {
|
|||||||
this.$emit("update:model-value", newOperation);
|
this.$emit("update:model-value", newOperation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleAction(actionKey) {
|
addAction(actionKey) {
|
||||||
const index = this.selectedActionKeys.indexOf(actionKey);
|
|
||||||
let newOperation = [...this.modelValue];
|
let newOperation = [...this.modelValue];
|
||||||
if (index !== -1) {
|
// 添加操作
|
||||||
// 移除操作
|
const { config, value } = this.operationsMap[actionKey];
|
||||||
newOperation.splice(index, 1);
|
const args = config?.length
|
||||||
} else {
|
? config.map((field) => field.defaultValue)
|
||||||
// 添加操作
|
: [];
|
||||||
const { config, value } = this.operationsMap[actionKey];
|
|
||||||
const args = config?.length
|
|
||||||
? config.map((field) => field.defaultValue)
|
|
||||||
: [];
|
|
||||||
|
|
||||||
const newOperationItem = { value, args };
|
const newOperationItem = { value, args };
|
||||||
if (actionKey !== value) {
|
if (actionKey !== value) {
|
||||||
newOperationItem.key = actionKey;
|
newOperationItem.key = actionKey;
|
||||||
}
|
|
||||||
|
|
||||||
newOperation.push(newOperationItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
this.$emit("update:model-value", newOperation);
|
||||||
},
|
},
|
||||||
updateActionArgs(argvIndex, argvVal, actionIndex) {
|
updateActionArgs(argvIndex, argvVal, actionIndex) {
|
||||||
@@ -250,4 +259,11 @@ export default {
|
|||||||
.row.q-col-gutter-xs > * {
|
.row.q-col-gutter-xs > * {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-badge {
|
||||||
|
font-size: 10px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
right: -4px;
|
||||||
|
top: -4px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -114,9 +114,13 @@ export default {
|
|||||||
|
|
||||||
return this.items.filter((x) => {
|
return this.items.filter((x) => {
|
||||||
if (this.is.json) {
|
if (this.is.json) {
|
||||||
const titleMatch = window.pinyinMatch.match(x.title, this.searchWords);
|
const titleMatch = window.pinyinMatch.match(
|
||||||
|
x.title,
|
||||||
|
this.searchWords
|
||||||
|
);
|
||||||
const descMatch =
|
const descMatch =
|
||||||
x.description && window.pinyinMatch.match(x.description, this.searchWords);
|
x.description &&
|
||||||
|
window.pinyinMatch.match(x.description, this.searchWords);
|
||||||
return titleMatch || descMatch;
|
return titleMatch || descMatch;
|
||||||
} else {
|
} else {
|
||||||
return window.pinyinMatch.match(x, this.searchWords);
|
return window.pinyinMatch.match(x, this.searchWords);
|
||||||
@@ -212,6 +216,7 @@ export default {
|
|||||||
this.searchWords = text;
|
this.searchWords = text;
|
||||||
if (this.matchedItems.length < this.currentIndex + 1)
|
if (this.matchedItems.length < this.currentIndex + 1)
|
||||||
this.currentIndex = 0;
|
this.currentIndex = 0;
|
||||||
|
this.setUtoolsHeight(this.itemHeight * this.matchedItemsSize);
|
||||||
}, this.options.options.placeholder);
|
}, this.options.options.placeholder);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export function generateCode(flow) {
|
|||||||
// 获取变量赋值代码,如果变量已经存在,则直接赋值,否则声明并赋值
|
// 获取变量赋值代码,如果变量已经存在,则直接赋值,否则声明并赋值
|
||||||
const getVarAssignCode = (varName, varValue) => {
|
const getVarAssignCode = (varName, varValue) => {
|
||||||
if (usedVarNames.includes(varName)) {
|
if (usedVarNames.includes(varName)) {
|
||||||
return `${varName} = ${varValue};`;
|
return `${varName} = ${varValue}`;
|
||||||
}
|
}
|
||||||
usedVarNames.push(varName);
|
usedVarNames.push(varName);
|
||||||
if (!varValue) {
|
if (!varValue) {
|
||||||
return `let ${varName};`;
|
return `let ${varName}`;
|
||||||
}
|
}
|
||||||
return `let ${varName} = ${varValue};`;
|
return `let ${varName} = ${varValue}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getVarByPath = (name, path) => {
|
const getVarByPath = (name, path) => {
|
||||||
@@ -36,10 +36,11 @@ export function generateCode(flow) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const indent = " ";
|
const indent = " ";
|
||||||
|
const comma = ";";
|
||||||
|
|
||||||
// 局部变量赋值
|
// 局部变量赋值
|
||||||
manualVars.forEach((v) => {
|
manualVars.forEach((v) => {
|
||||||
code.push(indent + getVarAssignCode(v.name, v.value));
|
code.push(indent + getVarAssignCode(v.name, v.value) + comma);
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.forEach((cmd) => {
|
commands.forEach((cmd) => {
|
||||||
@@ -65,7 +66,7 @@ export function generateCode(flow) {
|
|||||||
const extractVarCode = Object.entries(details)
|
const extractVarCode = Object.entries(details)
|
||||||
.map(
|
.map(
|
||||||
([path, varName]) =>
|
([path, varName]) =>
|
||||||
`let ${varName} = ${getVarByPath(promiseName, path)}`
|
`let ${varName} = ${getVarByPath(promiseName, path)};`
|
||||||
)
|
)
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
@@ -80,20 +81,22 @@ export function generateCode(flow) {
|
|||||||
})`;
|
})`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
code.push(indent + cmdCode);
|
code.push(indent + cmdCode + comma);
|
||||||
} else if (cmd.asyncMode === "await") {
|
} else if (cmd.asyncMode === "await") {
|
||||||
// 使用 await 模式
|
// 使用 await 模式
|
||||||
const promiseName = name || "__result";
|
const promiseName = name || "__result";
|
||||||
cmdCode = getVarAssignCode(promiseName, `await ${cmdCode}`);
|
cmdCode = getVarAssignCode(promiseName, `await ${cmdCode}`);
|
||||||
code.push(indent + cmdCode);
|
code.push(indent + cmdCode + comma);
|
||||||
// 处理详细变量
|
// 处理详细变量
|
||||||
if (details) {
|
if (details) {
|
||||||
Object.entries(details).forEach(([path, varName]) => {
|
Object.entries(details).forEach(([path, varName]) => {
|
||||||
code.push(
|
code.push(
|
||||||
`${indent}${getVarAssignCode(
|
indent +
|
||||||
varName,
|
`${getVarAssignCode(
|
||||||
getVarByPath(promiseName, path)
|
varName,
|
||||||
)}`
|
getVarByPath(promiseName, path)
|
||||||
|
)}` +
|
||||||
|
comma
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -101,15 +104,17 @@ export function generateCode(flow) {
|
|||||||
// 非Async命令
|
// 非Async命令
|
||||||
const resultVarName = name || "__result";
|
const resultVarName = name || "__result";
|
||||||
cmdCode = getVarAssignCode(resultVarName, `${cmdCode}`);
|
cmdCode = getVarAssignCode(resultVarName, `${cmdCode}`);
|
||||||
code.push(indent + cmdCode);
|
code.push(indent + cmdCode + comma);
|
||||||
// 处理详细变量
|
// 处理详细变量
|
||||||
if (details) {
|
if (details) {
|
||||||
Object.entries(details).forEach(([path, varName]) => {
|
Object.entries(details).forEach(([path, varName]) => {
|
||||||
code.push(
|
code.push(
|
||||||
`${indent}${getVarAssignCode(
|
indent +
|
||||||
varName,
|
`${getVarAssignCode(
|
||||||
getVarByPath(resultVarName, path)
|
varName,
|
||||||
)}`
|
getVarByPath(resultVarName, path)
|
||||||
|
)}` +
|
||||||
|
comma
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -119,11 +124,11 @@ export function generateCode(flow) {
|
|||||||
if (cmd.asyncMode === "await") {
|
if (cmd.asyncMode === "await") {
|
||||||
cmdCode = `await ${cmdCode}`;
|
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") {
|
if (funcName === "main") {
|
||||||
|
|||||||
@@ -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: {
|
setCookies: {
|
||||||
value: "setCookies",
|
value: "setCookies",
|
||||||
label: "设置Cookie",
|
label: "设置Cookie",
|
||||||
|
|||||||
5
src/plugins/monaco/types/utools.api.d.ts
vendored
5
src/plugins/monaco/types/utools.api.d.ts
vendored
@@ -138,6 +138,11 @@ interface UBrowser {
|
|||||||
* 配合 when 使用
|
* 配合 when 使用
|
||||||
*/
|
*/
|
||||||
end(): this;
|
end(): this;
|
||||||
|
/**
|
||||||
|
* 转为markdown
|
||||||
|
* @param selector CSS 或 XPath 选择器,不传递则转换整个网页内容
|
||||||
|
*/
|
||||||
|
markdown(selector: string): this;
|
||||||
/**
|
/**
|
||||||
* 单击元素
|
* 单击元素
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user