aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-19 16:17:54 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commit57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (patch)
tree87ebcd623c06445b9b25a237addefc98a2d64afa /server/controllers/client.ts
parent7279b455811f4806dcb74a08d17b837bc22533c1 (diff)
downloadPeerTube-57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6.tar.gz
PeerTube-57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6.tar.zst
PeerTube-57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6.zip
Begin advanced search
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r--server/controllers/client.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index 352d45fbf..bbb518c1b 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -5,6 +5,7 @@ import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers'
5import { asyncMiddleware } from '../middlewares' 5import { asyncMiddleware } 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'
8import { logger } from '../helpers/logger'
8 9
9const clientsRouter = express.Router() 10const clientsRouter = express.Router()
10 11
@@ -66,9 +67,14 @@ clientsRouter.use('/client/*', (req: express.Request, res: express.Response, nex
66 67
67// Always serve index client page (the client is a single page application, let it handle routing) 68// Always serve index client page (the client is a single page application, let it handle routing)
68// Try to provide the right language index.html 69// Try to provide the right language index.html
69clientsRouter.use('/(:language)?', function (req, res) { 70clientsRouter.use('/(:language)?', async function (req, res) {
70 if (req.accepts(ACCEPT_HEADERS) === 'html') { 71 if (req.accepts(ACCEPT_HEADERS) === 'html') {
71 return generateHTMLPage(req, res, req.params.language) 72 try {
73 await generateHTMLPage(req, res, req.params.language)
74 return
75 } catch (err) {
76 logger.error('Cannot generate HTML page.', err)
77 }
72 } 78 }
73 79
74 return res.status(404).end() 80 return res.status(404).end()