diff options
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 16 |
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 @@ | |||
1 | import * as express from 'express' | 1 | 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/constants' |
5 | import { asyncMiddleware, embedCSP } 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' |
@@ -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 |
19 | clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) | 19 | clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) |
20 | clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) | ||
21 | clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) | ||
20 | 22 | ||
21 | clientsRouter.use( | 23 | clientsRouter.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 | ||
104 | async 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 | |||
110 | async 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 | |||
102 | function sendHTML (html: string, res: express.Response) { | 116 | function 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 | ||