Skip to content

Commit 24a619a

Browse files
committed
Check wssh is connected before connecting
1 parent a5d3cbf commit 24a619a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

webssh/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version_info__ = (0, 3, 4)
1+
__version_info__ = (0, 3, 5)
22
__version__ = '.'.join(map(str, __version_info__))

webssh/static/js/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jQuery(function($){
88
var status = $('#status'),
99
btn = $('.btn-primary'),
1010
style = {},
11+
connected = false,
1112
key_max_size = 16384,
1213
form_id = '#connect',
1314
names = ['hostname', 'port', 'username', 'password'],
@@ -208,6 +209,7 @@ jQuery(function($){
208209
$('.container').hide();
209210
term.open(terminal, true);
210211
term.toggleFullscreen(true);
212+
connected = true;
211213
};
212214

213215
sock.onmessage = function(msg) {
@@ -241,6 +243,7 @@ jQuery(function($){
241243
reset_wssh();
242244
$('.container').show();
243245
status.text(e.reason);
246+
connected = false;
244247
};
245248

246249
$(window).resize(function(){
@@ -252,6 +255,11 @@ jQuery(function($){
252255

253256

254257
function connect() {
258+
if (connected) {
259+
console.log('This client was already connected.');
260+
return;
261+
}
262+
255263
var form = document.querySelector(form_id),
256264
url = form.action,
257265
data = new FormData(form),

0 commit comments

Comments
 (0)