X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fclient.ts;h=39a198b59bf9cd1896af1f2660d416d74648ec49;hb=7294aab0c879ef96c0fde15c389a2c4c1463d3c7;hp=7c80820f45d439a1029c382fd9dd6c5630b933c0;hpb=bd45d503e5d007e730f4e81dccd7e7864c9a85cc;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 7c80820f4..39a198b59 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -22,23 +22,25 @@ clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) -const embedCSPMiddleware = CONFIG.CSP.ENABLED - ? embedCSP - : (req: express.Request, res: express.Response, next: express.NextFunction) => next() +const embedMiddlewares = [ + CONFIG.CSP.ENABLED + ? embedCSP + : (req: express.Request, res: express.Response, next: express.NextFunction) => next(), -clientsRouter.use( - '/videos/embed', - embedCSPMiddleware, (req: express.Request, res: express.Response) => { res.removeHeader('X-Frame-Options') // Don't cache HTML file since it's an index to the immutable JS/CSS files res.sendFile(embedPath, { maxAge: 0 }) } -) -clientsRouter.use( - '/videos/test-embed', - (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath) -) +] + +clientsRouter.use('/videos/embed', ...embedMiddlewares) +clientsRouter.use('/video-playlists/embed', ...embedMiddlewares) + +const testEmbedController = (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath) + +clientsRouter.use('/videos/test-embed', testEmbedController) +clientsRouter.use('/video-playlists/test-embed', testEmbedController) // Static HTML/CSS/JS client files const staticClientFiles = [