commit 34af59a1c9c1ac2cf9cc492649d268e5cc2bb730
parent d8256d8f3fe60767578018f3a5f4893fad8e8130
Author: Sheng <webmaster0115@gmail.com>
Date: Sun, 19 May 2019 20:06:07 +0800
Support passing an encoding by url
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git 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)),