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

@ -14,24 +14,30 @@ function OVFObject() {
this.binPath = binPath;
};
this.setHostname = function(hostname) {
this.hostname = hostname;
};
this.setHostname = function(hostname) {
this.hostname = hostname;
};
this.setResourceName = function(resourceName) {
this.resourceName = resourceName;
};
this.setResourceName = function(resourceName) {
this.resourceName = resourceName;
};
this.saveTo = function() {
var cred = CRED.get("password", "ovftool");
var connectionString = "vi://" +
cred.username + ":" +
encodeURIComponent(cred.password) + "@" +
this.hostname + "/" +
this.resourceName;
// todo
cred.username + ":" +
encodeURIComponent(cred.password) + "@" +
this.hostname + "/" +
this.resourceName
;
var cmd = [
this.binPath,
connectionString,
"."
];
// run the command synchronously
SHELL.show(cmd, false);
};
}
@ -50,7 +56,7 @@ function create() {
exports.setCredential = setCredential;
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.global = global;
exports.require = global.require;

View File

@ -11,7 +11,7 @@ var ShellObject = function() {
this.workingDirectory = null;
this.isElevated = false;
this.isFork = false;
this.isVisibleWindow = false;
this.visibility = "hidden";
this.isPreventClear = false;
this.charset = PipeIPC.CdoUS_ASCII;
@ -54,8 +54,17 @@ var ShellObject = function() {
return this;
};
this.setVisibility = function(visibility) {
this.setVisibility = visibility;
};
// @deprecated
this.setVisibleWindow = function(visible) {
this.isVisibleWindow = visible;
if (visible == false) {
this.setVisibility("hidden");
} else {
this.setVisibility("visible");
}
return this;
};
@ -137,7 +146,7 @@ var ShellObject = function() {
var fork = (typeof(fork) !== "undefined") ? fork : true;
var c = "%comspec% /q /c (" + this.build(cmd) + ")";
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) {
@ -147,7 +156,7 @@ var ShellObject = function() {
if (typeof(args) !== "undefined") {
_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;
};
@ -205,7 +214,7 @@ exports.run = 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) {
@ -213,7 +222,7 @@ exports.runAs = 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) {
@ -236,7 +245,7 @@ exports.getPathOfMyDocuments = function() {
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.global = global;
exports.require = global.require;