diff options
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 15 |
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)) | |||
22 | clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) | 22 | clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) |
23 | clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) | 23 | clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) |
24 | 24 | ||
25 | const embedCSPMiddleware = CONFIG.CSP.ENABLED | 25 | const 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 | ||
29 | clientsRouter.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 | |||
37 | clientsRouter.use('/videos/embed', ...embedMiddlewares) | ||
38 | clientsRouter.use('/video-playlists/embed', ...embedMiddlewares) | ||
38 | clientsRouter.use( | 39 | clientsRouter.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) |