Merge pull request #96 from TigerND/master

Add https+wss support
This commit is contained in:
ZeroNet 2015-05-07 11:06:31 +02:00
commit f951ffc193
1 changed files with 6 additions and 3 deletions

View File

@ -1173,11 +1173,14 @@ jQuery.extend( jQuery.easing,
})();
if (window.server_url) {
ws_url = "ws://" + (window.server_url.replace('http://', '')) + "/Websocket?wrapper_key=" + window.wrapper_key;
var origin = window.server_url || window.location.origin;
var proto;
if (origin.indexOf('https:') === 0) {
proto = { ws: 'wss', ht: 'https' };
} else {
ws_url = "ws://" + window.location.hostname + ":" + window.location.port + "/Websocket?wrapper_key=" + window.wrapper_key;
proto = { ws: 'ws', ht: 'http' };
}
ws_url = proto.ws + ":" + (origin.replace(proto.ht + ':', '')) + "/Websocket?wrapper_key=" + window.wrapper_key;
window.wrapper = new Wrapper(ws_url);