From 5abc96fca2496f33075796db208fccc3543e0f65 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Aug 2020 11:42:06 +0200 Subject: Add logic to handle playlist in embed --- server/controllers/client.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'server/controllers') 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)) 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/embed', ...embedMiddlewares) +clientsRouter.use('/video-playlists/embed', ...embedMiddlewares) clientsRouter.use( '/videos/test-embed', (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath) -- cgit v1.2.3