From 34af59a1c9c1ac2cf9cc492649d268e5cc2bb730 Mon Sep 17 00:00:00 2001 From: Sheng Date: Sun, 19 May 2019 20:06:07 +0800 Subject: [PATCH] Support passing an encoding by url --- webssh/static/js/main.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index 3e82548..f8bca6c 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -314,12 +314,20 @@ jQuery(function($){ console.log('Set encoding to ' + encoding); } catch (RangeError) { console.log('Unknown encoding ' + new_encoding); + return false; } } } wssh.set_encoding = set_encoding; - set_encoding(msg.encoding); + + if (url_opts_data.encoding) { + if (set_encoding(url_opts_data.encoding) === false) { + set_encoding(msg.encoding); + } + } else { + set_encoding(msg.encoding); + } wssh.geometry = function() { @@ -677,7 +685,7 @@ jQuery(function($){ restore_items(fields); initialize_map(fields.concat(['password']), url_form_data); - initialize_map(['bgcolor', 'title'], url_opts_data); + initialize_map(['bgcolor', 'title', 'encoding'], url_opts_data); parse_url_data( decode_uri(window.location.search.substring(1)) + '&' + decode_uri(window.location.hash.substring(1)),