UNPKG

@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

35 lines (27 loc) 711 B
'use strict'; const convert = require('koa-convert'); const { xframe } = require('koa-lusca'); /** * CRON hook */ module.exports = (strapi) => { return { /** * Initialize the hook */ initialize() { // eslint-disable-next-line import/extensions 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(); }); }, }; };