UNPKG

strapi-ts

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

27 lines (22 loc) 454 B
'use strict'; 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 ); }); }, }; };