aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-04 11:42:06 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-07 08:58:29 +0200
commit5abc96fca2496f33075796db208fccc3543e0f65 (patch)
tree72da3df83df172a7a66b9ecff9b136e171c830bf /server
parenta4ff3100d36f2fe9a4dfc00e8487c28a94433c4f (diff)
downloadPeerTube-5abc96fca2496f33075796db208fccc3543e0f65.tar.gz
PeerTube-5abc96fca2496f33075796db208fccc3543e0f65.tar.zst
PeerTube-5abc96fca2496f33075796db208fccc3543e0f65.zip
Add logic to handle playlist in embed
Diffstat (limited to 'server')
-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)