Browse Source

add script for cron

pull/126/head
butlerx 8 years ago
parent
commit
a19e0119d6
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 1
      bin/cleanup
  2. 75
      public/wetty/wetty.js

1
bin/cleanup

@ -0,0 +1 @@
kill $(ps aux | grep "ssh" | awk '{print $2}')

75
public/wetty/wetty.js

@ -3,67 +3,66 @@ var socket = io(location.origin, {path: '/wetty/socket.io'})
var buf = '';
function Wetty(argv) {
this.argv_ = argv;
this.io = null;
this.pid_ = -1;
this.argv_ = argv;
this.io = null;
this.pid_ = -1;
}
Wetty.prototype.run = function() {
this.io = this.argv_.io.push();
this.io = this.argv_.io.push();
this.io.onVTKeystroke = this.sendString_.bind(this);
this.io.sendString = this.sendString_.bind(this);
this.io.onTerminalResize = this.onTerminalResize.bind(this);
this.io.onVTKeystroke = this.sendString_.bind(this);
this.io.sendString = this.sendString_.bind(this);
this.io.onTerminalResize = this.onTerminalResize.bind(this);
}
Wetty.prototype.sendString_ = function(str) {
socket.emit('input', str);
socket.emit('input', str);
};
Wetty.prototype.onTerminalResize = function(col, row) {
socket.emit('resize', { col: col, row: row });
socket.emit('resize', { col: col, row: row });
};
socket.on('connect', function() {
lib.init(function() {
hterm.defaultStorage = new lib.Storage.Local();
term = new hterm.Terminal();
window.term = term;
term.decorate(document.getElementById('terminal'));
lib.init(function() {
hterm.defaultStorage = new lib.Storage.Local();
term = new hterm.Terminal();
window.term = term;
term.decorate(document.getElementById('terminal'));
term.setCursorPosition(0, 0);
term.setCursorVisible(true);
term.prefs_.set('ctrl-c-copy', true);
term.prefs_.set('ctrl-v-paste', true);
term.prefs_.set('use-default-window-copy', true);
term.setCursorPosition(0, 0);
term.setCursorVisible(true);
term.prefs_.set('ctrl-c-copy', true);
term.prefs_.set('ctrl-v-paste', true);
term.prefs_.set('use-default-window-copy', true);
term.runCommandClass(Wetty, document.location.hash.substr(1));
socket.emit('resize', {
col: term.screenSize.width,
row: term.screenSize.height
});
if (buf && buf != '')
{
term.io.writeUTF16(buf);
buf = '';
}
term.runCommandClass(Wetty, document.location.hash.substr(1));
socket.emit('resize', {
col: term.screenSize.width,
row: term.screenSize.height
});
if (buf && buf != '') {
term.io.writeUTF16(buf);
buf = '';
}
});
});
socket.on('output', function(data) {
if (!term) {
buf += data;
return;
}
term.io.writeUTF16(data);
if (!term) {
buf += data;
return;
}
term.io.writeUTF16(data);
});
socket.on('logout', function(data) {
console.log("user logout");
document.getElementById("overlay").style.display = "block";
console.log("user logout");
document.getElementById("overlay").style.display = "block";
});
socket.on('disconnect', function() {
console.log("Socket.io connection closed");
console.log("Socket.io connection closed");
});

Loading…
Cancel
Save