<commit_before>const express = require('express'),
      path = require('path');

module.exports = function setPublicFolderMiddlewares (we, weExpress) {
  const cfg = { maxAge: we.config.cache.maxage },
    publicRouter = express.Router();

  let plugin;

  if (we.view && we.view.themes) {
    // set themes public folder
    for (let themeName in we.view.themes) {
      publicRouter.use(
        '/theme/' + we.view.themes[themeName].name,
        express.static(path.join(
          we.view.themes[themeName].config.themeFolder, 'files/public'
        ), cfg)
      );<commit_msg>update public files CORS to allow access<commit_after>const express = require('express'),
      path = require('path');

module.exports = function setPublicFolderMiddlewares (we, weExpress) {
  const cfg = { maxAge: we.config.cache.maxage },
    publicRouter = express.Router();

  publicRouter.use((req, res, next)=> {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
    next();
  });

  let plugin;

  if (we.view && we.view.themes) {
    // set themes public folder
    for (let themeName in we.view.themes) {
      publicRouter.use(
        '/theme/' + we.view.themes[themeName].name,
        express.static(path.join(
          we.view.themes[themeName].config.themeFolder, 'files/public'
        ), cfg)
      );
{'fraction_non_alphanumeric': 0.14957264957264957, 'fraction_numerical': 0.0, 'mean_word_length': 3.048991354466859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7632248', 'n_tokens_mistral': 444, 'n_tokens_neox': 425, 'n_words': 90}