<commit_before>#!/usr/bin/env node
// jshint camelcase:false

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const path = require('path');
const fs = require('fs');
const url = require('url');

const express = require('express');
const i18n = require('i18n-abide');
const openid = require('openid');
const clientSessions = require('client-sessions');
const fonts = require('connect-fonts');
const opensans = require('connect-fonts-opensans');

const caching = require('../lib/caching');
const config = require('../lib/config');
const csp = require('../lib/csp');
const email = require('../lib/email');
const logger = require('../lib/logging').logger;
const cert = require('../lib/cert');
const keys = require('../lib/keys');
const statsd = require('../lib/statsd');
const validate = require('../lib/validate');

const IS_SECURE = url.parse(config.get('publicUrl')).protocol === 'https:';
if (config.get('secret') === config.default('secret')) {
  logger.warn('*** Using ephemeral secret for signing cookies. ***');
}

// start loading, or make ephmeral keys if none exist
keys(function() {
  logger.debug('*** Keys loaded. ***');
});

var openidRP = new openid.RelyingParty(
  config.get('publicUrl') + '/authenticate/verify', // Verification URL
  config.get('openidRealm'), // Realm
  true, // Use stateless verification
  false, // Strict mode
  [ // List of extensions to enable and include
    new openid.AttributeExchange(
      {'http://axschema.org/contact/email': 'required'}),
    new openid.UserInterface({mode: 'popup', icon: true})
  ]);
const googleEndpoint = 'https://www.google.com/accounts/o8/id';

const app = express();

// -- Express Configuration --

app.set('views', path.join(__dirname, '..', 'views'));
app.set('view engine', 'ejs');

app.locals.personaUrl = config.get('personaUrl');
app.locals.errorInfo = undefined;

// -- Express Middleware --

app.use(statsd.middleware());
app.use(express.json());

if (IS_SECURE) {
  app.use(function(req, res, next) {
    req.connection.proxySecure = true;
    res.setHeader('Strict-Transport-Security',
        'max-age=10886400; includeSubdomains');
    next();
  });
}<commit_msg>Disable openid favicon. Broken as of ee33e26.<commit_after>#!/usr/bin/env node
// jshint camelcase:false

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const path = require('path');
const fs = require('fs');
const url = require('url');

const express = require('express');
const i18n = require('i18n-abide');
const openid = require('openid');
const clientSessions = require('client-sessions');
const fonts = require('connect-fonts');
const opensans = require('connect-fonts-opensans');

const caching = require('../lib/caching');
const config = require('../lib/config');
const csp = require('../lib/csp');
const email = require('../lib/email');
const logger = require('../lib/logging').logger;
const cert = require('../lib/cert');
const keys = require('../lib/keys');
const statsd = require('../lib/statsd');
const validate = require('../lib/validate');

const IS_SECURE = url.parse(config.get('publicUrl')).protocol === 'https:';
if (config.get('secret') === config.default('secret')) {
  logger.warn('*** Using ephemeral secret for signing cookies. ***');
}

// start loading, or make ephmeral keys if none exist
keys(function() {
  logger.debug('*** Keys loaded. ***');
});

var openidRP = new openid.RelyingParty(
  config.get('publicUrl') + '/authenticate/verify', // Verification URL
  config.get('openidRealm'), // Realm
  true, // Use stateless verification
  false, // Strict mode
  [ // List of extensions to enable and include
    new openid.AttributeExchange(
      {'http://axschema.org/contact/email': 'required'}),
    new openid.UserInterface({mode: 'popup'})
  ]);
const googleEndpoint = 'https://www.google.com/accounts/o8/id';

const app = express();

// -- Express Configuration --

app.set('views', path.join(__dirname, '..', 'views'));
app.set('view engine', 'ejs');

app.locals.personaUrl = config.get('personaUrl');
app.locals.errorInfo = undefined;

// -- Express Middleware --

app.use(statsd.middleware());
app.use(express.json());

if (IS_SECURE) {
  app.use(function(req, res, next) {
    req.connection.proxySecure = true;
    res.setHeader('Strict-Transport-Security',
        'max-age=10886400; includeSubdomains');
    next();
  });
}
{'fraction_non_alphanumeric': 0.1860164005179111, 'fraction_numerical': 0.008200258955545965, 'mean_word_length': 4.167224080267559, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1625188', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1442, 'n_words': 374}