mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-31 04:51:17 +00:00 
			
		
		
		
	Update shell.js, ovftool.js
This commit is contained in:
		
							parent
							
								
									e2582447cc
								
							
						
					
					
						commit
						38b03fe026
					
				|  | @ -6,35 +6,42 @@ var SHELL = require("lib/shell"); | ||||||
| var CRED = require("lib/credentials"); | var CRED = require("lib/credentials"); | ||||||
| 
 | 
 | ||||||
| function OVFObject() { | function OVFObject() { | ||||||
|     this.binPath = "bin/x64/VMware-ovftool-4.6.3-24031167-win.x86_64/ovftool/ovftool.exe"; |     this.binPath = "bin\\x64\\VMware-ovftool-4.6.3-24031167-win.x86_64\\ovftool\\ovftool.exe"; | ||||||
|     this.hostname = ""; |     this.hostname = ""; | ||||||
|  | 	this.port = 443; | ||||||
|     this.resourceName = ""; |     this.resourceName = ""; | ||||||
|      |      | ||||||
|     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.setPort = function(port) { | ||||||
|  | 		this.port = port; | ||||||
|  | 	}; | ||||||
|      |      | ||||||
|     this.setResourceName = function(resourceName) { |     this.setResourceName = function(resourceName) { | ||||||
|         this.resourceName = resourceName; |         this.resourceName = resourceName; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     this.saveTo = function() { |     this.saveTo = function(filename) { | ||||||
|         var cred = CRED.get("password", "ovftool"); |         var cred = CRED.get("password", "ovftool"); | ||||||
|         var connectionString = "vi://" + |         var connectionString = "vi://" + | ||||||
|             cred.username + ":" + |             encodeURIComponent(cred.username) + ":" + | ||||||
|             encodeURIComponent(cred.password) + "@" + |             encodeURIComponent(cred.password) + "@" + | ||||||
|             this.hostname + "/" +  |             this.hostname + (this.port == 443 ? "" : ":" + this.port) + | ||||||
|             this.resourceName |             this.resourceName | ||||||
|         ; |         ; | ||||||
|         var cmd = [ |         var cmd = [ | ||||||
|             this.binPath, |             this.binPath, | ||||||
|             connectionString, |             connectionString, | ||||||
|             "." |             filename | ||||||
|         ]; |         ]; | ||||||
|  | 		 | ||||||
|  | 		console.log("connectionString:", connectionString); | ||||||
|          |          | ||||||
|         // run the command synchronously
 |         // run the command synchronously
 | ||||||
|         SHELL.show(cmd, false); |         SHELL.show(cmd, false); | ||||||
|  | @ -43,9 +50,8 @@ function OVFObject() { | ||||||
| 
 | 
 | ||||||
| function setCredential(username, password) { | function setCredential(username, password) { | ||||||
|     CRED.push("password", "ovftool", { |     CRED.push("password", "ovftool", { | ||||||
|         "hostname": hostname, |  | ||||||
|         "username": username, |         "username": username, | ||||||
|         "password": password, |         "password": password | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -56,7 +62,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.1"; | exports.VERSIONINFO = "Broadcom/VMware OVF Tool interface (ovftool.js) version 0.1.2"; | ||||||
| exports.AUTHOR = "abuse@catswords.net"; | exports.AUTHOR = "abuse@catswords.net"; | ||||||
| exports.global = global; | exports.global = global; | ||||||
| exports.require = global.require; | exports.require = global.require; | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								lib/shell.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								lib/shell.js
									
									
									
									
									
								
							|  | @ -146,18 +146,26 @@ var ShellObject = function() { | ||||||
|     this.run = function(cmd, fork) { |     this.run = function(cmd, fork) { | ||||||
|         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) + ")"; | ||||||
|  |         var windowStyle = (this.visibility === "hidden" ? 0 : 1); | ||||||
|         console.log("ShellObject.run() ->", c); |         console.log("ShellObject.run() ->", c); | ||||||
|         this._interface.Run(c, (this.visibility === "hidden" ? 0 : 1), !fork); |         if (windowStyle == 1) { | ||||||
|  |             console.log("Will be open the visible window"); | ||||||
|  |         } | ||||||
|  |         this._interface.Run(c, windowStyle, !fork); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     this.runAs = function(FN, args) { |     this.runAs = function(FN, args) { | ||||||
|         var oShell = CreateObject("Shell.Application"); |         var oShell = CreateObject("Shell.Application"); | ||||||
|  |         var windowStyle = (this.visibility === "hidden" ? 0 : 1); | ||||||
|         var _args = null; |         var _args = null; | ||||||
|         console.log("ShellObject.runAs() ->", FN); |         console.log("ShellObject.runAs() ->", FN); | ||||||
|         if (typeof(args) !== "undefined") { |         if (typeof(args) !== "undefined") { | ||||||
|             _args = args.join(' '); |             _args = args.join(' '); | ||||||
|         } |         } | ||||||
|         oShell.shellExecute(FN, _args, this.workingDirectory, "runas", (this.visibility === "hidden" ? 0 : 1)); |         if (windowStyle == 1) { | ||||||
|  |             console.log("Will be open the visible window"); | ||||||
|  |         } | ||||||
|  |         oShell.shellExecute(FN, _args, this.workingDirectory, "runas", windowStyle); | ||||||
|         return oShell; |         return oShell; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | @ -246,7 +254,7 @@ exports.getPathOfMyDocuments = function() { | ||||||
| 
 | 
 | ||||||
| exports.CdoCharset = PipeIPC.CdoCharset; | exports.CdoCharset = PipeIPC.CdoCharset; | ||||||
| 
 | 
 | ||||||
| exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.17"; | exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.18"; | ||||||
| exports.AUTHOR = "abuse@catswords.net"; | exports.AUTHOR = "abuse@catswords.net"; | ||||||
| exports.global = global; | exports.global = global; | ||||||
| exports.require = global.require; | exports.require = global.require; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user