// 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('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage))
+clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage))
-clientsRouter.use('' +
+clientsRouter.use(
'/videos/embed',
embedCSP,
- (req: express.Request, res: express.Response, next: express.NextFunction) => {
+ (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
// ---------------------------------------------------------------------------
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)
}
return sendHTML(html, res)
}
+async function generateAccountHtmlPage (req: express.Request, res: express.Response) {
+ const html = await ClientHtml.getAccountHTMLPage(req.params.nameWithHost, req, res)
+
+ return sendHTML(html, res)
+}
+
+async function generateVideoChannelHtmlPage (req: express.Request, res: express.Response) {
+ const html = await ClientHtml.getVideoChannelHTMLPage(req.params.nameWithHost, req, res)
+
+ return sendHTML(html, res)
+}
+
function sendHTML (html: string, res: express.Response) {
res.set('Content-Type', 'text/html; charset=UTF-8')