added ability to execute commands on server thrue terminal

This commit is contained in:
coderaiser 2012-09-20 11:13:49 -04:00
parent aa7befc238
commit b52910a2cf
7 changed files with 21 additions and 20 deletions

View file

@ -1,10 +1,10 @@
/* module make possible connectoin thrue socket.io on a client */
var CloudCommander, io, socket;
var CloudCommander, io, socket, Term;
(function(){
"use strict";
var Util = CloudCommander.Util;
Util.jsload("http://localhost:31337/socket.io/lib/socket.io.js", {
Util.jsload("/socket.io/lib/socket.io.js", {
onload : function(){
socket = io.connect(document.location.hostname);
@ -14,6 +14,7 @@ var CloudCommander, io, socket;
socket.on('message', function (msg) {
console.log(msg);
Term.echo(msg);
});
socket.on('disconnect', function () {

View file

@ -1,4 +1,4 @@
var CloudCommander, $;
var CloudCommander, $, Term, socket;
/* object contains terminal jqconsole */
(function(){
@ -20,17 +20,7 @@ var CloudCommander, $;
src : 'lib/client/terminal/jquery-terminal/jquery.terminal.css'
});
Util.cssSet({
id :'terminal-css',
inner :'#terminal{' +
'position : relative' +
'},' +
'#terminal::selection{' +
'background: #fe57a1;' +
'color: #fff;' +
'text-shadow: none;' +
'}'
});
Util.jsload('lib/client/socket.js');
var lLoadTerm_func = function(){
Util.jsload('lib/client/terminal/jquery-terminal/jquery.terminal.js',
@ -67,7 +57,9 @@ var CloudCommander, $;
$(function($, undefined) {
$('#terminal').terminal(function(command, term) {
term.echo('');
Term = term;
term.echo('');
socket.send(command);
});
});
};

View file

@ -11,7 +11,6 @@
position: fixed;
}
.terminal {
padding: 10px;
position: relative;
overflow: hidden;
}
@ -27,7 +26,6 @@
font-family: FreeMono, monospace;
color: #aaa;
background-color: #000;
font-size: 12px;
line-height: 14px;
}
.terminal .cmd span {

View file

@ -1656,7 +1656,9 @@ function get_stack(caller) {
div = $('<div/>').html(encodeHTML(string));
}
output.append(div);
div.width('100%');
/*
div.width('100%');
*/
scroll_to_bottom();
return div;
}

View file

@ -20,7 +20,7 @@ exports.listen = function(pServer){
socket.on('message', function(pCommand) {
console.log(pCommand);
exec(pCommand, exec);
exec(pCommand, getExec);
});
});
@ -33,7 +33,7 @@ exports.listen = function(pServer){
* @param stdout
* @param stderr
*/
function exec(error, stdout, stderr) {
function getExec(error, stdout, stderr) {
if(stdout){
console.log(stdout);
Socket.send(stdout);