<commit_before>var express = require('express');
var morgan = require('morgan');
var session = require('express-session');
var Grant = require('grant-express');
var bodyParser = require('body-parser');


var projects = JSON.parse(process.env.PROJECTS || "[]");

var grant = new Grant({
  server: {
    protocol: 'https',
    state: true,
    callback: '/doneAuth',
    transport: 'session',
    host: process.env.RETURN_HOST
  },
  github: {
    key: process.env.GITHUB_KEY,
    secret: process.env.GITHUB_SECRET,
    scope: ['public_repo', 'repo']
  }
});

var app = express();
app.set('view engine', 'ejs');
app.use(morgan('combined'));
app.use(session({secret: process.env.EXPRESS_SECRET_TOKEN || 'secret-token'}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(grant);

app.get('/', function (req, res) {
  console.log('session', req.session);
  if (!req.session.grant || !req.session.grant.response.access_token) {
    return res.redirect('/connect/github');
  }
  res.render('index.html.ejs', {
    token: req.session.grant.response.access_token,
    projects: projects
  } );
});

app.get('/doneAuth', function (req, res) {
  return res.redirect('/');<commit_msg>remove console.log now that it seems to work<commit_after>var express = require('express');
var morgan = require('morgan');
var session = require('express-session');
var Grant = require('grant-express');
var bodyParser = require('body-parser');


var projects = JSON.parse(process.env.PROJECTS || "[]");

var grant = new Grant({
  server: {
    protocol: 'https',
    state: true,
    callback: '/doneAuth',
    transport: 'session',
    host: process.env.RETURN_HOST
  },
  github: {
    key: process.env.GITHUB_KEY,
    secret: process.env.GITHUB_SECRET,
    scope: ['public_repo', 'repo']
  }
});

var app = express();
app.set('view engine', 'ejs');
app.use(morgan('combined'));
app.use(session({secret: process.env.EXPRESS_SECRET_TOKEN || 'secret-token'}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(grant);

app.get('/', function (req, res) {
  if (!req.session.grant || !req.session.grant.response.access_token) {
    return res.redirect('/connect/github');
  }
  res.render('index.html.ejs', {
    token: req.session.grant.response.access_token,
    projects: projects
  } );
});

app.get('/doneAuth', function (req, res) {
  return res.redirect('/');
{'fraction_non_alphanumeric': 0.18899917287014062, 'fraction_numerical': 0.0, 'mean_word_length': 4.435955056179775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2024756', 'n_tokens_mistral': 816, 'n_tokens_neox': 807, 'n_words': 160}