lbry-desktop/web/middleware/iframe-destroyer.js

16 lines
307 B
JavaScript
Raw Normal View History

2021-02-18 16:57:52 -05:00
const PAGES = require('../../ui/constants/pages');
async function iframeDestroyerMiddleware(ctx, next) {
const {
request: { path },
} = ctx;
if (!path.startsWith(`/$/${PAGES.EMBED}`)) {
ctx.set('X-Frame-Options', 'DENY');
}
return next();
}
module.exports = iframeDestroyerMiddleware;