Commit 20449d03 by Sheng

Added set_encoding and reset_encoding

parent f4197f0e
......@@ -66,9 +66,29 @@ jQuery(function($){
});
console.log(url);
console.log(encoding);
console.log('The deault encoding of your server is ' + encoding);
wssh.sock = sock;
wssh.term = term;
var test_decoder;
wssh.set_encoding = function (new_encoding) {
try {
test_decoder = new window.TextDecoder(new_encoding);
} catch(TypeError) {
console.log('Unvalid encoding ' + new_encoding);
} finally {
if (test_decoder !== undefined) {
encoding = new_encoding;
console.log('Set encoding to ' + encoding);
}
test_decoder = undefined;
}
};
wssh.reset_encoding = function () {
encoding = msg.encoding;
console.log('Reset encoding to ' + msg.encoding);
};
term.on('data', function(data) {
// console.log(data);
......@@ -119,7 +139,7 @@ jQuery(function($){
var form = $(this),
url = form.attr('action'),
type = form.attr('type'),
type = form.attr('method'),
data = new FormData(this);
if (!data.get('hostname') || !data.get('port') || !data.get('username')) {
......@@ -129,7 +149,7 @@ jQuery(function($){
var pk = data.get('privatekey');
if (pk && pk.size > 16384) {
status.text('Key size exceeds maximum value.');
status.text('Key size exceeds the maximum value.');
return;
}
......
......@@ -21,21 +21,21 @@
</head>
<body>
<div class="container">
<form id="connect" action="" type="post" enctype="multipart/form-data">
<form id="connect" action="" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col">
<label for="Hostname">Hostname</label>
<input class="form-control" type="text" name="hostname" value="">
<input class="form-control" type="text" name="hostname" value="" required>
</div>
<div class="col">
<label for="Port">Port</label>
<input class="form-control" type="text" name="port" value="">
<input class="form-control" type="number" name="port" min=1 max=65535 value="" required>
</div>
</div>
<div class="row">
<div class="col">
<label for="Username">Username</label>
<input class="form-control" type="text" name="username" value="">
<input class="form-control" type="text" name="username" value="" required>
</div>
<div class="col">
<label for="Username">Private Key</label>
......@@ -45,7 +45,7 @@
<div class="row">
<div class="col">
<label for="Password">Password</label>
<input class="form-control" type="password" name="password" placeholder="" value="">
<input class="form-control" type="password" name="password" value="">
</div>
<div class="col">
If Private Key is chosen, password will be used to decrypt the Private Key if it is encrypted, otherwise used as the password of username.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment