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

const crypto = require('crypto');
const ejs = require('ejs');
const express = require('express');
const fs = require('fs');
const https = require('https');
const openid = require('openid');

const keys = require('./lib/keys');

const CANONICAL_URL = process.env['CANONICAL_URL'] || 'http://localhost:3000';
const EMAIL = '<EMAIL>';
const OPENID_IDENTIFIER = 'https://openid.fmarier.org';
const OPENID_STRICT_MODE = true;
const SESSION_SECRET = crypto.randomBytes(128) + '';

var app = express();
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.use(express.cookieParser());
  app.use(express.session({ secret: SESSION_SECRET, cookie: { secure: true } }));

  app.use(function(req, res, next) {
    if (req.path === '/.well-known/browserid') {
      res.setHeader('Content-Type', 'application/json');
    }
    next();
  });

  app.use(express.static(__dirname + '/public'));
  app.use(express.json());
});

var relyingParty = new openid.RelyingParty(CANONICAL_URL + '/api/openid_verify', null, false,
                                           OPENID_STRICT_MODE, []);

app.get('/', function (req, res) {
  if (req.session.loggedin) {
    res.render('loggedin.ejs');
  } else {
    res.render('loggedout.ejs');
  }
});

app.post('/api/cert_key', function(req, res) {
  if (!req.session.loggedin) {<commit_msg>Disable secure cookies because they don't work<commit_after>#!/usr/bin/env node

const crypto = require('crypto');
const ejs = require('ejs');
const express = require('express');
const fs = require('fs');
const https = require('https');
const openid = require('openid');

const keys = require('./lib/keys');

const CANONICAL_URL = process.env['CANONICAL_URL'] || 'http://localhost:3000';
const EMAIL = '<EMAIL>';
const OPENID_IDENTIFIER = 'https://openid.fmarier.org';
const OPENID_STRICT_MODE = true;
const SESSION_SECRET = crypto.randomBytes(128) + '';

var app = express();
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.use(express.cookieParser());
  // TODO: use secure cookies
  app.use(express.session({ secret: SESSION_SECRET, cookie: { secure: false } }));

  app.use(function(req, res, next) {
    if (req.path === '/.well-known/browserid') {
      res.setHeader('Content-Type', 'application/json');
    }
    next();
  });

  app.use(express.static(__dirname + '/public'));
  app.use(express.json());
});

var relyingParty = new openid.RelyingParty(CANONICAL_URL + '/api/openid_verify', null, false,
                                           OPENID_STRICT_MODE, []);

app.get('/', function (req, res) {
  if (req.session.loggedin) {
    res.render('loggedin.ejs');
  } else {
    res.render('loggedout.ejs');
  }
});

app.post('/api/cert_key', function(req, res) {
  if (!req.session.loggedin) {
{'fraction_non_alphanumeric': 0.18830242510699002, 'fraction_numerical': 0.004992867332382311, 'mean_word_length': 3.9558303886925796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6968885', 'n_tokens_mistral': 961, 'n_tokens_neox': 935, 'n_words': 184}