Added support for terminal type configuration

pull/104/head
Sheng 2019-09-15 08:30:46 +08:00
parent 8d0567329f
commit 090e2e7f87
3 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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>