1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-28 22:27:39 +00:00

Added support for specifying hostname for the --server command

Fixes #301
This commit is contained in:
Jermolene
2013-12-29 13:07:06 +00:00
parent 4cdfbd6b36
commit bd7db62da0
2 changed files with 9 additions and 7 deletions

View File

@@ -79,7 +79,7 @@ SimpleServer.prototype.checkCredentials = function(request,incomingUsername,inco
}
}
SimpleServer.prototype.listen = function(port) {
SimpleServer.prototype.listen = function(port,host) {
var self = this;
http.createServer(function(request,response) {
// Compose the state object
@@ -125,7 +125,7 @@ SimpleServer.prototype.listen = function(port) {
});
break;
}
}).listen(port);
}).listen(port,host);
};
var Command = function(params,commander,callback) {
@@ -264,7 +264,8 @@ Command.prototype.execute = function() {
renderType = this.params[2] || "text/plain",
serveType = this.params[3] || "text/html",
username = this.params[4],
password = this.params[5];
password = this.params[5],
host = this.params[6];
this.server.set({
rootTiddler: rootTiddler,
renderType: renderType,
@@ -272,8 +273,8 @@ Command.prototype.execute = function() {
username: username,
password: password
});
this.server.listen(port);
console.log("Serving on port " + port);
this.server.listen(port,host);
console.log("Serving on " + host + ":" + port);
console.log("(press ctrl-C to exit)");
return null;
};