diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 11:52:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 11:52:34 +0100 |
commit | 88108880bbdba473cfe36ecbebc1c3c4f972e102 (patch) | |
tree | b242efb3b4f0d7e49d88f2d1f2063b5b3b0489c0 /server/controllers/client.ts | |
parent | 53a94c7cfa8368da4cd248d65df8346905938f0c (diff) | |
parent | 9b712a2017e4ab3cf12cd6bd58278905520159d0 (diff) | |
download | PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.gz PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.zst PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.zip |
Merge branch 'develop' into pr/1217
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 73b40cf65..f17f2a5d2 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -2,7 +2,7 @@ import * as express from 'express' | |||
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { root } from '../helpers/core-utils' | 3 | import { root } from '../helpers/core-utils' |
4 | import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers' | 4 | import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers' |
5 | import { asyncMiddleware } from '../middlewares' | 5 | import { asyncMiddleware, embedCSP } from '../middlewares' |
6 | import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' | 6 | import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' |
7 | import { ClientHtml } from '../lib/client-html' | 7 | import { ClientHtml } from '../lib/client-html' |
8 | import { logger } from '../helpers/logger' | 8 | import { logger } from '../helpers/logger' |
@@ -16,21 +16,20 @@ const testEmbedPath = join(distPath, 'standalone', 'videos', 'test-embed.html') | |||
16 | 16 | ||
17 | // Special route that add OpenGraph and oEmbed tags | 17 | // Special route that add OpenGraph and oEmbed tags |
18 | // Do not use a template engine for a so little thing | 18 | // Do not use a template engine for a so little thing |
19 | clientsRouter.use('/videos/watch/:id', | 19 | clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) |
20 | asyncMiddleware(generateWatchHtmlPage) | ||
21 | ) | ||
22 | 20 | ||
23 | clientsRouter.use('' + | 21 | clientsRouter.use( |
24 | '/videos/embed', | 22 | '/videos/embed', |
25 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 23 | embedCSP, |
24 | (req: express.Request, res: express.Response) => { | ||
26 | res.removeHeader('X-Frame-Options') | 25 | res.removeHeader('X-Frame-Options') |
27 | res.sendFile(embedPath) | 26 | res.sendFile(embedPath) |
28 | } | 27 | } |
29 | ) | 28 | ) |
30 | clientsRouter.use('' + | 29 | clientsRouter.use( |
31 | '/videos/test-embed', (req: express.Request, res: express.Response, next: express.NextFunction) => { | 30 | '/videos/test-embed', |
32 | res.sendFile(testEmbedPath) | 31 | (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath) |
33 | }) | 32 | ) |
34 | 33 | ||
35 | // Static HTML/CSS/JS client files | 34 | // Static HTML/CSS/JS client files |
36 | 35 | ||
@@ -89,7 +88,7 @@ export { | |||
89 | // --------------------------------------------------------------------------- | 88 | // --------------------------------------------------------------------------- |
90 | 89 | ||
91 | async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { | 90 | async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { |
92 | const html = await ClientHtml.getIndexHTML(req, res, paramLang) | 91 | const html = await ClientHtml.getDefaultHTMLPage(req, res, paramLang) |
93 | 92 | ||
94 | return sendHTML(html, res) | 93 | return sendHTML(html, res) |
95 | } | 94 | } |