Commit 20449d03 by Sheng

Added set_encoding and reset_encoding

parent f4197f0e
...@@ -66,9 +66,29 @@ jQuery(function($){ ...@@ -66,9 +66,29 @@ jQuery(function($){
}); });
console.log(url); console.log(url);
console.log(encoding); console.log('The deault encoding of your server is ' + encoding);
wssh.sock = sock; wssh.sock = sock;
wssh.term = term; 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) { term.on('data', function(data) {
// console.log(data); // console.log(data);
...@@ -119,7 +139,7 @@ jQuery(function($){ ...@@ -119,7 +139,7 @@ jQuery(function($){
var form = $(this), var form = $(this),
url = form.attr('action'), url = form.attr('action'),
type = form.attr('type'), type = form.attr('method'),
data = new FormData(this); data = new FormData(this);
if (!data.get('hostname') || !data.get('port') || !data.get('username')) { if (!data.get('hostname') || !data.get('port') || !data.get('username')) {
...@@ -129,7 +149,7 @@ jQuery(function($){ ...@@ -129,7 +149,7 @@ jQuery(function($){
var pk = data.get('privatekey'); var pk = data.get('privatekey');
if (pk && pk.size > 16384) { if (pk && pk.size > 16384) {
status.text('Key size exceeds maximum value.'); status.text('Key size exceeds the maximum value.');
return; return;
} }
......
...@@ -21,21 +21,21 @@ ...@@ -21,21 +21,21 @@
</head> </head>
<body> <body>
<div class="container"> <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="row">
<div class="col"> <div class="col">
<label for="Hostname">Hostname</label> <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>
<div class="col"> <div class="col">
<label for="Port">Port</label> <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> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<label for="Username">Username</label> <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>
<div class="col"> <div class="col">
<label for="Username">Private Key</label> <label for="Username">Private Key</label>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<label for="Password">Password</label> <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>
<div class="col"> <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. 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