more bashing

This commit is contained in:
Marc Wäckerlin
2016-01-25 15:52:10 +00:00
parent a7139b8fd9
commit 859d13b2e1
8 changed files with 62 additions and 8 deletions

View File

@@ -0,0 +1,3 @@
{
"port": 8889
}

View File

@@ -8,6 +8,8 @@ EXTRA_DIST = servicedock.js package.json.in public routes sockets views
nodejsdir = ${pkgdatadir}/nodejs
sysconf_DATA = etc/@PACKAGE_NAME@.json
all: node_modules
node_modules: package.json.in

View File

@@ -17,5 +17,14 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Marc Wäckerlin",
"license": "LGPL3"
"license": "LGPL3",
"path": {
"prefix": "@PREFIX@",
"sysconf": "@SYSCONFDIR@",
"pkgdata": "@PKGDATADIR@",
"localstate": "@LOCALSTATEDIR@",
"log": "@LOCALSTATEDIR@/log/@PACKAGE_NAME@.log",
"config": "@SYSCONFDIR@/@PACKAGE_NAME@.json",
"nodejs": "@PKGDATADIR@/nodejs"
}
}

View File

@@ -828,19 +828,22 @@ function bash_data(data) {
if (data.type=='done') {
$("#screen").append('<span class="'+data.type+'">\nDONE</span>');
} else {
var done = false;
var buff = "";
console.log("ASCII: ", ascii(data.text));
if (data.text.length==1) {
switch (data.text.charCodeAt(0)) {
for (var i=0; i<data.text.length; ++i) {
switch (data.text.charCodeAt(i)) {
case 7:
$('#screen').text(function (_,txt) {
case 8:
if (buff.length) $("#screen").append(ansifilter(htmlenc(buff)));
buff = "";
$('#screen').html(function (_,txt) {
return txt.slice(0, -1);
});
done = true;
break;
default: buff += data.text[i];
}
}
if (!done) $("#screen").append(ansifilter(htmlenc(data.text)));
if (buff.length) $("#screen").append(ansifilter(htmlenc(buff)));
}
$("#screen").animate({
scrollTop: $("#screen").prop('scrollHeight')

View File

@@ -9,6 +9,8 @@ var express = require('express')
var app = module.exports = express.createServer();
var io = require('socket.io').listen(app);
var sockets = require(__dirname+'/sockets')(io);
var package = require(__dirname+'/package.json');
var config = require(package.path.config);
// Configuration
@@ -34,7 +36,7 @@ app.configure('production', function(){
app.get('/', routes.index);
app.listen(8889, function() {
app.listen(config.port, function() {
console.log("Express server listening on port %d in %s mode",
app.address().port, app.settings.env);
});