1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Begin advanced search

This commit is contained in:
Chocobozzz 2018-07-19 16:17:54 +02:00
parent 7279b45581
commit 57c36b277e
38 changed files with 584 additions and 247 deletions

View file

@ -5,6 +5,7 @@ import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers'
import { asyncMiddleware } from '../middlewares'
import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n'
import { ClientHtml } from '../lib/client-html'
import { logger } from '../helpers/logger'
const clientsRouter = express.Router()
@ -66,9 +67,14 @@ clientsRouter.use('/client/*', (req: express.Request, res: express.Response, nex
// Always serve index client page (the client is a single page application, let it handle routing)
// Try to provide the right language index.html
clientsRouter.use('/(:language)?', function (req, res) {
clientsRouter.use('/(:language)?', async function (req, res) {
if (req.accepts(ACCEPT_HEADERS) === 'html') {
return generateHTMLPage(req, res, req.params.language)
try {
await generateHTMLPage(req, res, req.params.language)
return
} catch (err) {
logger.error('Cannot generate HTML page.', err)
}
}
return res.status(404).end()