mirror of https://github.com/huashengdun/webssh
Update main.js
parent
c6bed4a679
commit
176e6c6fa7
|
@ -32,8 +32,28 @@ var wssh = {};
|
|||
data[name] = value;
|
||||
};
|
||||
}
|
||||
|
||||
document.querySelector('#sshlinkBtn').addEventListener("click", updateSSHlink);
|
||||
}());
|
||||
|
||||
function updateSSHlink() {
|
||||
var thisPageProtocol = window.location.protocol;
|
||||
var thisPageUrl = window.location.host;
|
||||
|
||||
var hostnamestr = document.getElementById("hostname").value;
|
||||
var portstr = document.getElementById("port").value;
|
||||
if (portstr == "") {
|
||||
portstr = "22"
|
||||
}
|
||||
var usrnamestr = document.getElementById("username").value;
|
||||
var passwdstr = document.getElementById("password").value;
|
||||
var passwdstrAfterBase64 = window.btoa(passwdstr);
|
||||
|
||||
var sshlinkstr;
|
||||
sshlinkstr = thisPageProtocol+"//"+thisPageUrl+"/?hostname="+hostnamestr+"&port="+portstr+"&username="+usrnamestr+"&password="+passwdstrAfterBase64;
|
||||
|
||||
document.getElementById("sshlink").innerHTML = sshlinkstr;
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
var status = $('#status'),
|
||||
|
|
Loading…
Reference in New Issue