formatting changes
This commit is contained in:
parent
6b05e5e34f
commit
cef50b870c
2 changed files with 29 additions and 26 deletions
|
@ -33,6 +33,7 @@
|
|||
"read-config": "^1.6.0",
|
||||
"socket.io": "^1.6.0",
|
||||
"ssh2": "^0.5.4",
|
||||
"strip-ansi": "^3.0.1",
|
||||
"xterm": "^2.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -3,29 +3,7 @@ var sessionLog,
|
|||
sessionFooter,
|
||||
logDate;
|
||||
|
||||
document.getElementById('downloadLog').style.display = 'none';
|
||||
document.getElementById('credentials').style.display = 'none';
|
||||
|
||||
var terminalContainer = document.getElementById('terminal-container'),
|
||||
term = new Terminal({
|
||||
cursorBlink: true
|
||||
}),
|
||||
socket,
|
||||
termid;
|
||||
term.open(terminalContainer);
|
||||
term.fit();
|
||||
|
||||
if (document.location.pathname) {
|
||||
var parts = document.location.pathname.split('/'),
|
||||
base = parts.slice(0, parts.length - 1).join('/') + '/',
|
||||
resource = base.substring(1) + 'socket.io';
|
||||
socket = io.connect(null, {
|
||||
resource: resource
|
||||
});
|
||||
} else {
|
||||
socket = io.connect();
|
||||
}
|
||||
|
||||
// replay password to server, requires
|
||||
function replayCredentials() {
|
||||
socket.emit('control', 'replayCredentials');
|
||||
console.log("replaying credentials");
|
||||
|
@ -59,7 +37,8 @@ function toggleLog() {
|
|||
// used for our client-side logging feature
|
||||
function downloadLog() {
|
||||
myFile = "WebSSH2-" + logDate.getFullYear() + (logDate.getMonth() + 1) + logDate.getDate() + "_" + logDate.getHours() + logDate.getMinutes() + logDate.getSeconds() + ".log";
|
||||
var blob = new Blob([sessionLog], {
|
||||
// regex should eliminate escape sequences from being logged.
|
||||
var blob = new Blob([sessionLog.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '')], {
|
||||
type: 'text/plain'
|
||||
});
|
||||
if (window.navigator.msSaveOrOpenBlob) {
|
||||
|
@ -74,6 +53,29 @@ function downloadLog() {
|
|||
}
|
||||
}
|
||||
|
||||
document.getElementById('downloadLog').style.display = 'none';
|
||||
document.getElementById('credentials').style.display = 'none';
|
||||
|
||||
var terminalContainer = document.getElementById('terminal-container'),
|
||||
term = new Terminal({
|
||||
cursorBlink: true
|
||||
}),
|
||||
socket,
|
||||
termid;
|
||||
term.open(terminalContainer);
|
||||
term.fit();
|
||||
|
||||
if (document.location.pathname) {
|
||||
var parts = document.location.pathname.split('/'),
|
||||
base = parts.slice(0, parts.length - 1).join('/') + '/',
|
||||
resource = base.substring(1) + 'socket.io';
|
||||
socket = io.connect(null, {
|
||||
resource: resource
|
||||
});
|
||||
} else {
|
||||
socket = io.connect();
|
||||
}
|
||||
|
||||
socket.on('connect', function() {
|
||||
socket.emit('geometry', term.cols, term.rows);
|
||||
term.on('data', function(data) {
|
||||
|
@ -102,7 +104,7 @@ socket.on('connect', function() {
|
|||
}).on('data', function(data) {
|
||||
term.write(data);
|
||||
if (sessionLogEnable) {
|
||||
sessionLog = sessionLog + data;
|
||||
sessionLog = sessionLog + data
|
||||
}
|
||||
}).on('disconnect', function(err) {
|
||||
document.getElementById('status').style.backgroundColor = 'red';
|
||||
|
@ -112,4 +114,4 @@ socket.on('connect', function() {
|
|||
document.getElementById('status').style.backgroundColor = 'red';
|
||||
document.getElementById('status').innerHTML = 'ERROR ' + err;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue