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

34 lines (26 loc) 657 B
'use strict'; const convert = require('koa-convert'); const { xframe } = require('koa-lusca'); /** * CRON hook */ module.exports = strapi => { return { /** * Initialize the hook */ initialize() { const defaults = require('./defaults.json'); strapi.app.use(async (ctx, next) => { if (ctx.request.admin) { return await convert(xframe(defaults.xframe))(ctx, next); } const { enabled, value } = strapi.config.get('middleware.settings.xframe', {}); if (enabled) { return await convert(xframe(value))(ctx, next); } await next(); }); }, }; };