<commit_before>'use strict';

const config     = require('config');
const path       = require('path');
const express    = require('express');
const fs         = require('fs');
const superagent = require('superagent');
const favicon    = require('serve-favicon');
const RouteUtils = require('../utils/route_utils');
const api        = require('../api');

const enforceSSL = RouteUtils.enforceSSL({ port: config.server.ssl.port });

function serveBundledView(view, page, bundleMappingsPath) {
  return function(req, res, next) {
    fs.readFileAsync(bundleMappingsPath)
    .then(JSON.parse)
    .then(function(mappings) {
      res.render(view, {
        settings : config.app[page],
        scripts  : {
          commons : mappings.commons.js,
          app     : mappings[page].js
        }
      });
    })
    .catch(next);
  };
}

module.exports = function(app) {

  if (config.app.favicon) {
    app.use(favicon(path.join(__dirname, config.app.favicon)));
  } else {
    app.use('favicon.ico', function(req, res) {
      res.status(200);
      res.type('image/x-icon');
    });
  }

  // Secured content
  app.use(config.app.dashboard.base, enforceSSL);<commit_msg>Secure Redeem content<commit_after>'use strict';

const config     = require('config');
const path       = require('path');
const express    = require('express');
const fs         = require('fs');
const superagent = require('superagent');
const favicon    = require('serve-favicon');
const RouteUtils = require('../utils/route_utils');
const api        = require('../api');

const enforceSSL = RouteUtils.enforceSSL({ port: config.server.ssl.port });

function serveBundledView(view, page, bundleMappingsPath) {
  return function(req, res, next) {
    fs.readFileAsync(bundleMappingsPath)
    .then(JSON.parse)
    .then(function(mappings) {
      res.render(view, {
        settings : config.app[page],
        scripts  : {
          commons : mappings.commons.js,
          app     : mappings[page].js
        }
      });
    })
    .catch(next);
  };
}

module.exports = function(app) {

  if (config.app.favicon) {
    app.use(favicon(path.join(__dirname, config.app.favicon)));
  } else {
    app.use('favicon.ico', function(req, res) {
      res.status(200);
      res.type('image/x-icon');
    });
  }

  // Secured content
  app.use(config.app.dashboard.base, enforceSSL);
  app.use(config.app.redeem.base,    enforceSSL);
{'fraction_non_alphanumeric': 0.15903413821815154, 'fraction_numerical': 0.002497918401332223, 'mean_word_length': 2.9653465346534653, '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': '7357698', 'n_tokens_mistral': 780, 'n_tokens_neox': 757, 'n_words': 137}