Fix cryptget inner

This commit is contained in:
yflory
2019-12-17 10:57:13 +01:00
parent e38d6d1093
commit 5a055233c0
5 changed files with 17 additions and 9 deletions

View File

@@ -3,13 +3,18 @@ define([
], function (ApiConfig) {
var Config = {};
Config.getWebsocketURL = function () {
Config.getWebsocketURL = function (origin) {
if (!ApiConfig.websocketPath) { return ApiConfig.websocketURL; }
var path = ApiConfig.websocketPath;
if (/^ws{1,2}:\/\//.test(path)) { return path; }
var protocol = window.location.protocol.replace(/http/, 'ws');
var host = window.location.host;
var l = window.location;
if (origin && window && window.document) {
var l = document.createElement("a");
l.href = origin;
}
var protocol = l.protocol.replace(/http/, 'ws');
var host = l.host;
var url = protocol + '//' + host + path;
return url;