aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r--server/controllers/client.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index f17f2a5d2..f51470b41 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { join } from 'path' 2import { join } from 'path'
3import { root } from '../helpers/core-utils' 3import { root } from '../helpers/core-utils'
4import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers' 4import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants'
5import { asyncMiddleware, embedCSP } from '../middlewares' 5import { asyncMiddleware, embedCSP } from '../middlewares'
6import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' 6import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n'
7import { ClientHtml } from '../lib/client-html' 7import { ClientHtml } from '../lib/client-html'
@@ -17,6 +17,8 @@ const testEmbedPath = join(distPath, 'standalone', 'videos', 'test-embed.html')
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
19clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) 19clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage))
20clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage))
21clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage))
20 22
21clientsRouter.use( 23clientsRouter.use(
22 '/videos/embed', 24 '/videos/embed',
@@ -99,6 +101,18 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons
99 return sendHTML(html, res) 101 return sendHTML(html, res)
100} 102}
101 103
104async function generateAccountHtmlPage (req: express.Request, res: express.Response) {
105 const html = await ClientHtml.getAccountHTMLPage(req.params.nameWithHost, req, res)
106
107 return sendHTML(html, res)
108}
109
110async function generateVideoChannelHtmlPage (req: express.Request, res: express.Response) {
111 const html = await ClientHtml.getVideoChannelHTMLPage(req.params.nameWithHost, req, res)
112
113 return sendHTML(html, res)
114}
115
102function sendHTML (html: string, res: express.Response) { 116function sendHTML (html: string, res: express.Response) {
103 res.set('Content-Type', 'text/html; charset=UTF-8') 117 res.set('Content-Type', 'text/html; charset=UTF-8')
104 118