<commit_before>#!/usr/bin/env node

/**
 * term.js
 * Copyright (c) 2012-2013, <NAME> (MIT License)
 */

var http = require('http')
  , express = require('express')
  , io = require('socket.io')
  , pty = require('pty.js')
  , terminal = require('../');

/**
 * term.js
 */

process.title = 'term.js';

/**
 * Dump
 */

var stream;
if (process.argv[2] === '--dump') {
  stream = require('fs').createWriteStream(__dirname + '/dump.log');
}

/**
 * Open Terminal
 */

var buff = []
  , socket
  , term;

term = pty.fork(process.env.SHELL || 'sh', [], {
  name: require('fs').existsSync('/usr/share/terminfo/x/xterm-256color')
    ? 'xterm-256color'
    : 'xterm',
  cols: 80,
  rows: 24,
  cwd: process.env.HOME
});

term.on('data', function(data) {
  if (stream) stream.write('OUT: ' + data + '\n-\n');
  return !socket
    ? buff.push(data)
    : socket.emit('data', data);
});

console.log(''
  + 'Created shell with pty master/slave'
  + ' pair (master: %d, pid: %d)',
  term.fd, term.pid);

/**
 * App & Server
 */

var app = express()
  , server = http.createServer(app);

app.get('/', function (req, res, next) {
	var async = require('async');
	global.state = true;

	check_token(function(){
		if ( global.state != true ){
			res.statusCode = 401;
			res.end('Unauthorized');	
		}
		else{
			next();
		}
		
	});

function check_token(fnCallback) {
      async.series([
      function(callback) {
            var token = req.query.token;
            var request = require('request-json');
            var client = request.newClient('http://10.91.11.19:8000/');
            var user=req.query.user + ".json"
	    console.log(user)
            var auth=client.get('token/'+ token + '/' + user, function (err, res, body) {
                    global.state = body.success;
                    return console.log("Cliente: "+ global.state);
            });

            callback();
          },

          function(callback) {
            setTimeout(callback, 1000);
          },
      ], function(err, results) {<commit_msg>eliminar token<commit_after>#!/usr/bin/env node

/**
 * term.js
 * Copyright (c) 2012-2013, <NAME> (MIT License)
 */

var http = require('http')
  , express = require('express')
  , io = require('socket.io')
  , pty = require('pty.js')
  , terminal = require('../');

/**
 * term.js
 */

process.title = 'term.js';

/**
 * Dump
 */

var stream;
if (process.argv[2] === '--dump') {
  stream = require('fs').createWriteStream(__dirname + '/dump.log');
}

/**
 * Open Terminal
 */

var buff = []
  , socket
  , term;

term = pty.fork(process.env.SHELL || 'sh', [], {
  name: require('fs').existsSync('/usr/share/terminfo/x/xterm-256color')
    ? 'xterm-256color'
    : 'xterm',
  cols: 80,
  rows: 24,
  cwd: process.env.HOME
});

term.on('data', function(data) {
  if (stream) stream.write('OUT: ' + data + '\n-\n');
  return !socket
    ? buff.push(data)
    : socket.emit('data', data);
});

console.log(''
  + 'Created shell with pty master/slave'
  + ' pair (master: %d, pid: %d)',
  term.fd, term.pid);

/**
 * App & Server
 */

var app = express()
  , server = http.createServer(app);

app.get('/', function (req, res, next) {
	var async = require('async');
	global.state = true;
  next();
		
	});

function check_token(fnCallback) {
      async.series([
      function(callback) {
            var token = req.query.token;
            var request = require('request-json');
            var client = request.newClient('http://10.91.11.19:8000/');
            var user=req.query.user + ".json"
	    console.log(user)
            var auth=client.get('token/'+ token + '/' + user, function (err, res, body) {
                    global.state = body.success;
                    return console.log("Cliente: "+ global.state);
            });

            callback();
          },

          function(callback) {
            setTimeout(callback, 1000);
          },
      ], function(err, results) {
{'fraction_non_alphanumeric': 0.19535832695740882, 'fraction_numerical': 0.018617699566437135, 'mean_word_length': 2.3839516824849007, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2921485', 'n_tokens_mistral': 1411, 'n_tokens_neox': 1326, 'n_words': 269}