Update shell.js, ovftool.js

This commit is contained in:
Namhyeon Go 2025-01-15 13:58:54 +09:00
parent f9f35da4d4
commit c9f03a5e23
2 changed files with 40 additions and 25 deletions

View File

@ -13,25 +13,31 @@ function OVFObject() {
this.setBinPath = function(binPath) { this.setBinPath = function(binPath) {
this.binPath = binPath; this.binPath = binPath;
}; };
this.setHostname = function(hostname) { this.setHostname = function(hostname) {
this.hostname = hostname; this.hostname = hostname;
}; };
this.setResourceName = function(resourceName) { this.setResourceName = function(resourceName) {
this.resourceName = resourceName; this.resourceName = resourceName;
}; };
this.saveTo = function() { this.saveTo = function() {
var cred = CRED.get("password", "ovftool"); var cred = CRED.get("password", "ovftool");
var connectionString = "vi://" + var connectionString = "vi://" +
cred.username + ":" + cred.username + ":" +
encodeURIComponent(cred.password) + "@" + encodeURIComponent(cred.password) + "@" +
this.hostname + "/" + this.hostname + "/" +
this.resourceName; this.resourceName
;
// todo var cmd = [
this.binPath,
connectionString,
"."
];
// run the command synchronously
SHELL.show(cmd, false);
}; };
} }
@ -50,7 +56,7 @@ function create() {
exports.setCredential = setCredential; exports.setCredential = setCredential;
exports.create = create; exports.create = create;
exports.VERSIONINFO = "Broadcom/VMware OVF Tool interface (ovftool.js) version 0.1"; exports.VERSIONINFO = "Broadcom/VMware OVF Tool interface (ovftool.js) version 0.1.1";
exports.AUTHOR = "abuse@catswords.net"; exports.AUTHOR = "abuse@catswords.net";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;

View File

@ -11,7 +11,7 @@ var ShellObject = function() {
this.workingDirectory = null; this.workingDirectory = null;
this.isElevated = false; this.isElevated = false;
this.isFork = false; this.isFork = false;
this.isVisibleWindow = false; this.visibility = "hidden";
this.isPreventClear = false; this.isPreventClear = false;
this.charset = PipeIPC.CdoUS_ASCII; this.charset = PipeIPC.CdoUS_ASCII;
@ -53,12 +53,21 @@ var ShellObject = function() {
} }
return this; return this;
}; };
this.setVisibility = function(visibility) {
this.setVisibility = visibility;
};
// @deprecated
this.setVisibleWindow = function(visible) { this.setVisibleWindow = function(visible) {
this.isVisibleWindow = visible; if (visible == false) {
this.setVisibility("hidden");
} else {
this.setVisibility("visible");
}
return this; return this;
}; };
this.build = function(cmd) { this.build = function(cmd) {
var prefix = this.prefix; var prefix = this.prefix;
var wrap = function(s) { var wrap = function(s) {
@ -137,7 +146,7 @@ var ShellObject = function() {
var fork = (typeof(fork) !== "undefined") ? fork : true; var fork = (typeof(fork) !== "undefined") ? fork : true;
var c = "%comspec% /q /c (" + this.build(cmd) + ")"; var c = "%comspec% /q /c (" + this.build(cmd) + ")";
console.log("ShellObject.run() ->", c); console.log("ShellObject.run() ->", c);
this._interface.Run(c, (!this.isVisibleWindow ? 0 : 1), !fork); this._interface.Run(c, (this.visibility === "hidden" ? 0 : 1), !fork);
}; };
this.runAs = function(FN, args) { this.runAs = function(FN, args) {
@ -147,7 +156,7 @@ var ShellObject = function() {
if (typeof(args) !== "undefined") { if (typeof(args) !== "undefined") {
_args = args.join(' '); _args = args.join(' ');
} }
oShell.shellExecute(FN, _args, this.workingDirectory, "runas", (!this.isVisibleWindow ? 0 : 1)); oShell.shellExecute(FN, _args, this.workingDirectory, "runas", (this.visibility === "hidden" ? 0 : 1));
return oShell; return oShell;
}; };
@ -205,7 +214,7 @@ exports.run = function(cmd, fork) {
}; };
exports.show = function(cmd, fork) { exports.show = function(cmd, fork) {
return (new ShellObject()).setVisibleWindow(true).run(cmd, fork); return (new ShellObject()).setVisibility("visible").run(cmd, fork);
}; };
exports.runAs = function(FN, args) { exports.runAs = function(FN, args) {
@ -213,7 +222,7 @@ exports.runAs = function(FN, args) {
}; };
exports.showAs = function(FN, args) { exports.showAs = function(FN, args) {
return (new ShellObject()).setVisibleWindow(true).runAs(FN, args); return (new ShellObject()).setVisibility("visible").runAs(FN, args);
}; };
exports.createProcess = function(cmd, workingDirectory) { exports.createProcess = function(cmd, workingDirectory) {
@ -236,7 +245,7 @@ exports.getPathOfMyDocuments = function() {
exports.CdoCharset = PipeIPC.CdoCharset; exports.CdoCharset = PipeIPC.CdoCharset;
exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.15"; exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.16";
exports.AUTHOR = "abuse@catswords.net"; exports.AUTHOR = "abuse@catswords.net";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;