1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

selective route permission to use embeds with x-frame-deny

This commit is contained in:
Rigel Kent 2018-07-16 09:02:08 +02:00 committed by Rigel Kent
parent a7dbc7dfc7
commit d00e2393d4
4 changed files with 184 additions and 3 deletions

View file

@ -1,5 +1,6 @@
import * as Bluebird from 'bluebird'
import * as express from 'express'
import * as helmet from 'helmet'
import { join } from 'path'
import * as validator from 'validator'
import { escapeHTML, readFileBufferPromise, root } from '../helpers/core-utils'
@ -30,9 +31,12 @@ clientsRouter.use('/videos/watch/:id',
)
clientsRouter.use('' +
'/videos/embed', (req: express.Request, res: express.Response, next: express.NextFunction) => {
res.sendFile(embedPath)
})
'/videos/embed',
(req: express.Request, res: express.Response, next: express.NextFunction) => {
res.removeHeader('X-Frame-Options')
res.sendFile(embedPath)
}
)
clientsRouter.use('' +
'/videos/test-embed', (req: express.Request, res: express.Response, next: express.NextFunction) => {
res.sendFile(testEmbedPath)