X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=src%2Findex.js;fp=src%2Findex.js;h=0712a115a5f513da68489e7dabd16011eb9ddd19;hp=82abb7565715783a1dd2ccef41d4965557cfef01;hb=5e96dd57ddd883604e87f62bdddcb111c63a6e1a;hpb=acb5f682a2b75b972710cabd81658f63071324b0 diff --git a/src/index.js b/src/index.js old mode 100644 new mode 100755 index 82abb75..0712a11 --- a/src/index.js +++ b/src/index.js @@ -1,32 +1,7 @@ const express = require('express'); // pide express sea requerido const path = require('path'); // pide que path sea requerido -const pty = require('node-pty'); ////////////////ASKS FOR NODE-PTY // inicializaciones const app = express(); -const expressWs = require('express-ws')(app);///////////////////ASK FOR THE WEBSOCKET FROM EXPRESS -////////////////////////////////////////////////////////////////////////////////////////////////// -// Instantiate shell and set up data handlers -expressWs.app.ws('/shell', (ws, req) => { - // Spawn the shell - const shell = pty.spawn('/bin/bash', [], { - name: 'xterm-color', - cwd: process.env.PWD, - env: process.env - }); - // For all shell data send it to the websocket - shell.on('data', (data) => { - ws.send(data); - }); - // For all websocket data send it to the shell - ws.on('message', (msg) => { - shell.write(msg); - }); -}); -////////////////////////////////////////////////////////////////////////////////////////////////// - - - - //configuraciones app.set('port', process.env.PORT || 3000);