fix(webterminal): test

pull/112/head
liuzheng712 2016-03-03 16:39:14 +08:00
parent b1f0297e82
commit 0e7a8c1a62
1 changed files with 93 additions and 84 deletions

View File

@ -5,9 +5,19 @@ var rowHeight = 1;
var colWidth = 1;
function WSSHClient() {
}
WSSHClient.prototype._generateEndpoint = function (options) {
console.log(options);
if (window.location.protocol == 'https:') {
var protocol = 'wss://';
} else {
var protocol = 'ws://';
}
var endpoint = protocol + window.location.host + ':8080' + '/terminal';
return endpoint;
};
WSSHClient.prototype.connect = function (options) {
var endpoint = '{{ web_terminal_url }}';
var endpoint = this._generateEndpoint(options);
if (window.WebSocket) {
this._connection = new WebSocket(endpoint);
@ -83,8 +93,7 @@ var rowHeight = 1;
}
$(document).ready(function () {
var options = {
};
var options = {};
$('#ssh').show();
var term_client = openTerminal(options);