diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-19 16:17:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-24 14:04:05 +0200 |
commit | 57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (patch) | |
tree | 87ebcd623c06445b9b25a237addefc98a2d64afa /server/controllers/client.ts | |
parent | 7279b455811f4806dcb74a08d17b837bc22533c1 (diff) | |
download | PeerTube-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.ts | 10 |
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' | |||
5 | import { asyncMiddleware } from '../middlewares' | 5 | import { asyncMiddleware } 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' |
8 | import { logger } from '../helpers/logger' | ||
8 | 9 | ||
9 | const clientsRouter = express.Router() | 10 | const 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 |
69 | clientsRouter.use('/(:language)?', function (req, res) { | 70 | clientsRouter.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() |