aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r--server/controllers/client.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index 592233676..49e6fd661 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -8,6 +8,7 @@ import { logger } from '../helpers/logger'
8import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants' 8import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants'
9import { ClientHtml } from '../lib/client-html' 9import { ClientHtml } from '../lib/client-html'
10import { asyncMiddleware, embedCSP } from '../middlewares' 10import { asyncMiddleware, embedCSP } from '../middlewares'
11import { HttpStatusCode } from '@shared/core-utils'
11 12
12const clientsRouter = express.Router() 13const clientsRouter = express.Router()
13 14
@@ -87,7 +88,7 @@ clientsRouter.use('/client', express.static(distPath, { maxAge: STATIC_MAX_AGE.C
87 88
88// 404 for static files not found 89// 404 for static files not found
89clientsRouter.use('/client/*', (req: express.Request, res: express.Response) => { 90clientsRouter.use('/client/*', (req: express.Request, res: express.Response) => {
90 res.sendStatus(404) 91 res.sendStatus(HttpStatusCode.NOT_FOUND_404)
91}) 92})
92 93
93// Always serve index client page (the client is a single page application, let it handle routing) 94// Always serve index client page (the client is a single page application, let it handle routing)
@@ -114,7 +115,7 @@ function serveServerTranslations (req: express.Request, res: express.Response) {
114 return res.sendFile(path, { maxAge: STATIC_MAX_AGE.SERVER }) 115 return res.sendFile(path, { maxAge: STATIC_MAX_AGE.SERVER })
115 } 116 }
116 117
117 return res.sendStatus(404) 118 return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
118} 119}
119 120
120async function serveIndexHTML (req: express.Request, res: express.Response) { 121async function serveIndexHTML (req: express.Request, res: express.Response) {
@@ -127,7 +128,7 @@ async function serveIndexHTML (req: express.Request, res: express.Response) {
127 } 128 }
128 } 129 }
129 130
130 return res.status(404).end() 131 return res.status(HttpStatusCode.INTERNAL_SERVER_ERROR_500).end()
131} 132}
132 133
133async function generateEmbedHtmlPage (req: express.Request, res: express.Response) { 134async function generateEmbedHtmlPage (req: express.Request, res: express.Response) {