Add SSL support

This commit is contained in:
calzoneman 2013-09-09 17:16:41 -05:00
parent f7e968a13c
commit 4ec1d04247
9 changed files with 96 additions and 55 deletions

View file

@ -1148,6 +1148,9 @@ $.getScript(IO_URL+"/socket.io/socket.io.js", function() {
if(i >= 0)
io.transports.splice(i, 1);
}
var opts = {};
if (location.protocol === "https:")
opts.secure = true;
socket = io.connect(IO_URL);
setupCallbacks();
}

View file

@ -11,3 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var IO_URL = "http://localhost:1337";
var WEB_URL = "http://localhost:8080";
var SSL_URL = "https://localhost:443";
if (location.protocol === "https:") {
IO_URL = WEB_URL = SSL_URL;
}

View file

@ -438,14 +438,9 @@ else {
var label = $("<label/>").text("Enter Channel:").appendTo(div);
var entry = $("<input/>").attr("type", "text").appendTo(div);
entry.keydown(function(ev) {
var host = ""+document.location;
host = host.replace("http://", "");
host = host.substring(0, host.indexOf("/"));
var host = document.protocol + "//" + document.host + "/";
if(ev.keyCode == 13) {
document.location = "http://" + host + "/r/" + entry.val();
socket.emit("joinChannel", {
name: entry.val()
});
document.location = host + "r/" + entry.val();
container.remove();
main.css("display", "");
}