diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0faa98b --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +(MIT License) + +Copyright (c) 2013 Boyan Rabchev . All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/lib/terminal.js b/lib/terminal.js index 5ec44de..2573f91 100644 --- a/lib/terminal.js +++ b/lib/terminal.js @@ -11,6 +11,7 @@ var io = require("socket.io"), path = require("path"), fs = require("fs"), repl = require("repl"), + util = require("util"), streams = require("./streams"), config = pkg.config || {}, standalone, @@ -28,6 +29,8 @@ function redirect(res, url) { function initialize(server, options, fn) { "use strict"; + var port, sPort, protocol; + if ("function" === typeof options) { fn = options; options = {}; @@ -47,16 +50,23 @@ function initialize(server, options, fn) { if ("number" === typeof server) { // if a port number is passed - var port = server; + port = server; if (options && options.key) { - http = require("https"); + protocol = "https"; + http = require(protocol); + sPort = (port !== 443) ? ":" + port : ""; } else { - http = require("http"); + protocol = "http"; + http = require(protocol); + sPort = (port !== 80) ? ":" + port : ""; } + server = http.createServer(options); server.listen(port, fn); standalone = true; + + console.log(util.format("Web-Terminal running at %s://localhost%s/terminal", protocol, sPort)); } if (options) { diff --git a/package.json b/package.json index fc22646..39b0334 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "web-terminal", "description": "Web-Terminal is a terminal server that provides remote CLI via standard web browser and HTTP protocol.", - "version": "0.6.1", + "version": "0.6.2", "author": "Boyan Rabchev ", "contributors": [ { "name": "Boyan Rabchev", "email": "boyan@rabchev.com" } @@ -14,7 +14,10 @@ "cert": "", "pfx": "" }, - "repository": "https://github.com/rabchev/web-terminal.git", + "repository": { + "type": "git", + "url": "https://github.com/rabchev/web-terminal.git" + }, "main": "index", "preferGlobal": "false", "dependencies": { @@ -44,7 +47,16 @@ "web-terminal": "./bin/run.js" }, "scripts": { - "start": "node ./bin/run.js" + "start": "node ./bin/run.js", + "test": "node test" + }, + "bugs": { + "email": "boyan@rabchev.com", + "url": "https://github.com/rabchev/web-terminal/issues" + }, + "license": { + "type": "MIT", + "url": "http://github.com/rabchev/web-terminal/blob/master/LICENSE" }, "engines": { "node": ">=0.10" } }