mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-30 13:02:46 +08:00
更改缓存远程脚本的时机
This commit is contained in:
parent
3fa216bdd8
commit
545d467b16
@ -104,10 +104,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async fire(currentCommand) {
|
async fire(currentCommand) {
|
||||||
currentCommand.cmd = this.assignSpecialVars(currentCommand.cmd);
|
currentCommand.cmd = this.assignSpecialVars(currentCommand.cmd);
|
||||||
if (currentCommand.output === "html") {
|
this.enableHtml = currentCommand.output === "html";
|
||||||
this.enableHtml = true;
|
|
||||||
currentCommand.cmd = await this.cacheScript(currentCommand.cmd);
|
|
||||||
}
|
|
||||||
let { hideWindow, outPlugin, action } =
|
let { hideWindow, outPlugin, action } =
|
||||||
outputTypes[currentCommand.output];
|
outputTypes[currentCommand.output];
|
||||||
// 需要隐藏的提前隐藏窗口
|
// 需要隐藏的提前隐藏窗口
|
||||||
@ -237,11 +234,12 @@ export default {
|
|||||||
: this.showRunResult(stdout, true);
|
: this.showRunResult(stdout, true);
|
||||||
},
|
},
|
||||||
// 显示运行结果
|
// 显示运行结果
|
||||||
showRunResult(content, isSuccess) {
|
async showRunResult(content, isSuccess) {
|
||||||
this.isResultShow = true;
|
this.isResultShow = true;
|
||||||
this.timeStamp = new Date().getTime();
|
this.timeStamp = new Date().getTime();
|
||||||
this.runResultStatus = isSuccess;
|
this.runResultStatus = isSuccess;
|
||||||
if (!_.isArray(content)) content = [content];
|
if (!_.isArray(content)) content = [content];
|
||||||
|
content = await this.cacheScript(content);
|
||||||
this.runResult = this.runResult.concat(content);
|
this.runResult = this.runResult.concat(content);
|
||||||
this.autoScroll();
|
this.autoScroll();
|
||||||
},
|
},
|
||||||
@ -280,8 +278,11 @@ export default {
|
|||||||
this.frameInitHeight = initHeight;
|
this.frameInitHeight = initHeight;
|
||||||
},
|
},
|
||||||
// 预先下载远程脚本
|
// 预先下载远程脚本
|
||||||
async cacheScript(cmd) {
|
async cacheScript(content) {
|
||||||
let html = quickcommand.htmlParse(cmd);
|
if (!this.enableHtml) return;
|
||||||
|
let htmls = [];
|
||||||
|
for (let item of content) {
|
||||||
|
let html = quickcommand.htmlParse(item);
|
||||||
let scriptDoms = html.querySelectorAll("script");
|
let scriptDoms = html.querySelectorAll("script");
|
||||||
for (let i = 0; i < scriptDoms.length; i++) {
|
for (let i = 0; i < scriptDoms.length; i++) {
|
||||||
let src = scriptDoms[i].src;
|
let src = scriptDoms[i].src;
|
||||||
@ -290,7 +291,9 @@ export default {
|
|||||||
await quickcommand.downloadFile(src, dest);
|
await quickcommand.downloadFile(src, dest);
|
||||||
scriptDoms[i].src = "file://" + dest;
|
scriptDoms[i].src = "file://" + dest;
|
||||||
}
|
}
|
||||||
return html.documentElement.innerHTML;
|
htmls.push(html.documentElement.innerHTML);
|
||||||
|
}
|
||||||
|
return htmls;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user