fixed login issue on chromium; moved docker into mwaeckerlin/docker.js on github
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
module.exports = function(io, authentication) {
|
||||
module.exports = function(app, io, docker, authentication) {
|
||||
|
||||
var pty = require('pty.js');
|
||||
var proc = require('child_process');
|
||||
var docker = require(__dirname+'/../docker')();
|
||||
|
||||
var module={};
|
||||
var running="";
|
||||
@@ -186,11 +185,13 @@ module.exports = function(io, authentication) {
|
||||
if (!name.match(/^[a-z0-9][-_:.+a-z0-9]*$/i))
|
||||
return this.fail("illegal instance name");
|
||||
if (bash_connections[name]) return;
|
||||
bash_connections[name] =
|
||||
pty.spawn("docker", ["exec", "-it", name, "bash", "-i"]);
|
||||
bash_connections[name] = pty.spawn("docker", ["exec", "-it", name, "bash", "-i"]);
|
||||
bash_connections[name].stdout.on('data', function(data) {
|
||||
emit('bash-data', {name: name, type: 'stdout', text: data.toString()});
|
||||
});
|
||||
bash_connections[name].stderr.on('data', function(data) {
|
||||
emit('bash-data', {name: name, type: 'stderr', text: data.toString()});
|
||||
});
|
||||
}
|
||||
|
||||
function bash_start(name) {
|
||||
@@ -241,11 +242,15 @@ module.exports = function(io, authentication) {
|
||||
authenticate: function (socket, data, callback) {
|
||||
console.log("=> authenticate: ", data.username);
|
||||
//get credentials sent by the client
|
||||
var username = data.username;
|
||||
var password = data.password;
|
||||
authentication(data.username, data.password,
|
||||
function() {console.log("####LOGIN-SUCESS####");callback(null, true)},
|
||||
function() {console.log("####LOGIN-FAIL####");callback(new Error("wrong credentials"))});
|
||||
function() {
|
||||
console.log("####LOGIN-SUCESS####");
|
||||
callback(null, true)
|
||||
},
|
||||
function() {
|
||||
console.log("####LOGIN-FAIL####");
|
||||
callback(new Error("wrong credentials"))
|
||||
});
|
||||
},
|
||||
postAuthenticate: connection,
|
||||
timeout: "none"
|
||||
@@ -259,7 +264,7 @@ module.exports = function(io, authentication) {
|
||||
|
||||
// Regular Update of Stats
|
||||
setInterval(function() {
|
||||
exec('docker stats --no-stream'+running, stats);
|
||||
if (running) exec('docker stats --no-stream'+running, stats);
|
||||
}, 1000);
|
||||
|
||||
return module;
|
||||
|
Reference in New Issue
Block a user