webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 24a619ae6b3bf6bd56c4ca6247686e34fed1e8bb
parent a5d3cbfee87f1bb9630a85b0b848056e8d7d50e6
Author: Sheng <webmaster0115@gmail.com>
Date:   Wed, 22 Aug 2018 18:55:09 +0800

Check wssh is connected before connecting

Diffstat:
Mwebssh/_version.py | 2+-
Mwebssh/static/js/main.js | 8++++++++
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/webssh/_version.py b/webssh/_version.py @@ -1,2 +1,2 @@ -__version_info__ = (0, 3, 4) +__version_info__ = (0, 3, 5) __version__ = '.'.join(map(str, __version_info__)) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js @@ -8,6 +8,7 @@ jQuery(function($){ var status = $('#status'), btn = $('.btn-primary'), style = {}, + connected = false, key_max_size = 16384, form_id = '#connect', names = ['hostname', 'port', 'username', 'password'], @@ -208,6 +209,7 @@ jQuery(function($){ $('.container').hide(); term.open(terminal, true); term.toggleFullscreen(true); + connected = true; }; sock.onmessage = function(msg) { @@ -241,6 +243,7 @@ jQuery(function($){ reset_wssh(); $('.container').show(); status.text(e.reason); + connected = false; }; $(window).resize(function(){ @@ -252,6 +255,11 @@ jQuery(function($){ function connect() { + if (connected) { + console.log('This client was already connected.'); + return; + } + var form = document.querySelector(form_id), url = form.action, data = new FormData(form),