feat(console): add protocol awareness to switch between ws:// and wss:// (#135)

pull/136/head
Anthony Lapenna 2016-08-17 18:23:30 +12:00 committed by GitHub
parent b098cd5638
commit ccb812cc33
1 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,12 @@ function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages, e
if (d.Id) {
var execId = d.Id;
resizeTTY(execId, termHeight, termWidth);
var url = window.location.href.split('#')[0].replace('http://', 'ws://') + 'ws/exec?id=' + execId;
var url = window.location.href.split('#')[0] + 'ws/exec?id=' + execId;
if (url.indexOf('https') > -1) {
url = url.replace('https://', 'wss://');
} else {
url = url.replace('http://', 'ws://');
}
initTerm(url, termHeight, termWidth);
} else {
$('#loadConsoleSpinner').hide();