diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-04 11:42:06 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-07 08:58:29 +0200 |
commit | 5abc96fca2496f33075796db208fccc3543e0f65 (patch) | |
tree | 72da3df83df172a7a66b9ecff9b136e171c830bf /server/controllers | |
parent | a4ff3100d36f2fe9a4dfc00e8487c28a94433c4f (diff) | |
download | PeerTube-5abc96fca2496f33075796db208fccc3543e0f65.tar.gz PeerTube-5abc96fca2496f33075796db208fccc3543e0f65.tar.zst PeerTube-5abc96fca2496f33075796db208fccc3543e0f65.zip |
Add logic to handle playlist in embed
Diffstat (limited to 'server/controllers')
-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) |