aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r--server/controllers/client.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index 7c80820f4..b97c935a5 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -22,19 +22,20 @@ clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage))
22clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) 22clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage))
23clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) 23clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage))
24 24
25const embedCSPMiddleware = CONFIG.CSP.ENABLED 25const embedMiddlewares = [
26 ? embedCSP 26 CONFIG.CSP.ENABLED
27 : (req: express.Request, res: express.Response, next: express.NextFunction) => next() 27 ? embedCSP
28 : (req: express.Request, res: express.Response, next: express.NextFunction) => next(),
28 29
29clientsRouter.use(
30 '/videos/embed',
31 embedCSPMiddleware,
32 (req: express.Request, res: express.Response) => { 30 (req: express.Request, res: express.Response) => {
33 res.removeHeader('X-Frame-Options') 31 res.removeHeader('X-Frame-Options')
34 // Don't cache HTML file since it's an index to the immutable JS/CSS files 32 // Don't cache HTML file since it's an index to the immutable JS/CSS files
35 res.sendFile(embedPath, { maxAge: 0 }) 33 res.sendFile(embedPath, { maxAge: 0 })
36 } 34 }
37) 35]
36
37clientsRouter.use('/videos/embed', ...embedMiddlewares)
38clientsRouter.use('/video-playlists/embed', ...embedMiddlewares)
38clientsRouter.use( 39clientsRouter.use(
39 '/videos/test-embed', 40 '/videos/test-embed',
40 (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath) 41 (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath)