mirror of https://github.com/huashengdun/webssh
Added support for terminal type configuration
parent
8d0567329f
commit
090e2e7f87
|
@ -412,7 +412,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
|||
except paramiko.BadHostKeyException:
|
||||
raise ValueError('Bad host key.')
|
||||
|
||||
chan = ssh.invoke_shell(term='xterm')
|
||||
term = self.get_argument('term', u'') or u'xterm'
|
||||
chan = ssh.invoke_shell(term=term)
|
||||
chan.setblocking(0)
|
||||
worker = Worker(self.loop, ssh, chan, dst_addr)
|
||||
worker.encoding = self.get_default_encoding(ssh)
|
||||
|
|
|
@ -40,6 +40,7 @@ jQuery(function($){
|
|||
button = $('.btn-primary'),
|
||||
form_container = $('.form-container'),
|
||||
waiter = $('#waiter'),
|
||||
term_type = $('#term'),
|
||||
style = {},
|
||||
default_title = 'WebSSH',
|
||||
title_element = document.querySelector('title'),
|
||||
|
@ -55,7 +56,7 @@ jQuery(function($){
|
|||
key_max_size = 16384,
|
||||
fields = ['hostname', 'port', 'username'],
|
||||
form_keys = fields.concat(['password', 'totp']),
|
||||
opts_keys = ['bgcolor', 'title', 'encoding', 'command'],
|
||||
opts_keys = ['bgcolor', 'title', 'encoding', 'command', 'term'],
|
||||
url_form_data = {},
|
||||
url_opts_data = {},
|
||||
validated_form_data,
|
||||
|
@ -705,6 +706,7 @@ jQuery(function($){
|
|||
return;
|
||||
}
|
||||
|
||||
data.term = term_type.val();
|
||||
data._xsrf = _xsrf.value;
|
||||
if (event_origin) {
|
||||
data._origin = event_origin;
|
||||
|
@ -819,6 +821,10 @@ jQuery(function($){
|
|||
// console.log(url_form_data);
|
||||
// console.log(url_opts_data);
|
||||
|
||||
if (url_opts_data.term) {
|
||||
term_type.val(url_opts_data.term);
|
||||
}
|
||||
|
||||
if (url_form_data.password === null) {
|
||||
log_status('Password via url must be encoded in base64.');
|
||||
} else {
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
<div class="col">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="term" name="term" value="xterm-256color">
|
||||
{% module xsrf_form_html() %}
|
||||
<button type="submit" class="btn btn-primary">Connect</button>
|
||||
<button type="reset" class="btn btn-danger">Reset</button>
|
||||
|
|
Loading…
Reference in New Issue