@akemona-org/strapi
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite
24 lines (19 loc) • 426 B
JavaScript
;
const convert = require('koa-convert');
const { csp } = require('koa-lusca');
/**
* CSP hook
*/
module.exports = (strapi) => {
return {
/**
* Initialize the hook
*/
initialize() {
strapi.app.use(async (ctx, next) => {
if (ctx.request.admin) return await next();
return await convert(csp(strapi.config.middleware.settings.csp))(ctx, next);
});
},
};
};