X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fclient.ts;h=f17f2a5d29cb0d1bc4e56aeb5a74706742ed4a04;hb=73471b1a52f242e86364ffb077ea6cadb3b07ae2;hp=73b40cf6513c3941fe5fe9ef1b76c9691db0a456;hpb=fcc7c060374c3a547257d96af847352c14d6144b;p=github%2FChocobozzz%2FPeerTube.git 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' import { join } from 'path' import { root } from '../helpers/core-utils' import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers' -import { asyncMiddleware } from '../middlewares' +import { asyncMiddleware, embedCSP } from '../middlewares' import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' import { ClientHtml } from '../lib/client-html' import { logger } from '../helpers/logger' @@ -16,21 +16,20 @@ const testEmbedPath = join(distPath, 'standalone', 'videos', 'test-embed.html') // Special route that add OpenGraph and oEmbed tags // Do not use a template engine for a so little thing -clientsRouter.use('/videos/watch/:id', - asyncMiddleware(generateWatchHtmlPage) -) +clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) -clientsRouter.use('' + +clientsRouter.use( '/videos/embed', - (req: express.Request, res: express.Response, next: express.NextFunction) => { + embedCSP, + (req: express.Request, res: express.Response) => { res.removeHeader('X-Frame-Options') res.sendFile(embedPath) } ) -clientsRouter.use('' + - '/videos/test-embed', (req: express.Request, res: express.Response, next: express.NextFunction) => { - res.sendFile(testEmbedPath) -}) +clientsRouter.use( + '/videos/test-embed', + (req: express.Request, res: express.Response) => res.sendFile(testEmbedPath) +) // Static HTML/CSS/JS client files @@ -89,7 +88,7 @@ export { // --------------------------------------------------------------------------- async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { - const html = await ClientHtml.getIndexHTML(req, res, paramLang) + const html = await ClientHtml.getDefaultHTMLPage(req, res, paramLang) return sendHTML(html, res) }