diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-08 11:06:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-08 11:06:40 +0200 |
commit | 655c957cc3004c4b4841538486f009511573cdf2 (patch) | |
tree | 822241e6136171b6866201933a5207ecf6b834a1 /server/controllers/client.ts | |
parent | 4d3e611dd2764d1d5d0a7e777312631e1e7005d4 (diff) | |
download | PeerTube-655c957cc3004c4b4841538486f009511573cdf2.tar.gz PeerTube-655c957cc3004c4b4841538486f009511573cdf2.tar.zst PeerTube-655c957cc3004c4b4841538486f009511573cdf2.zip |
Stop indexing /about/peertube
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 d81e35ec3..cdc556da2 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -5,12 +5,12 @@ import { join } from 'path' | |||
5 | import { logger } from '@server/helpers/logger' | 5 | import { logger } from '@server/helpers/logger' |
6 | import { CONFIG } from '@server/initializers/config' | 6 | import { CONFIG } from '@server/initializers/config' |
7 | import { Hooks } from '@server/lib/plugins/hooks' | 7 | import { Hooks } from '@server/lib/plugins/hooks' |
8 | import { HttpStatusCode } from '@shared/models' | ||
9 | import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@shared/core-utils/i18n' | 8 | import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@shared/core-utils/i18n' |
9 | import { HttpStatusCode } from '@shared/models' | ||
10 | import { root } from '../helpers/core-utils' | 10 | import { root } from '../helpers/core-utils' |
11 | import { STATIC_MAX_AGE } from '../initializers/constants' | 11 | import { STATIC_MAX_AGE } from '../initializers/constants' |
12 | import { ClientHtml, sendHTML, serveIndexHTML } from '../lib/client-html' | 12 | import { ClientHtml, sendHTML, serveIndexHTML } from '../lib/client-html' |
13 | import { asyncMiddleware, embedCSP } from '../middlewares' | 13 | import { asyncMiddleware, disableRobots, embedCSP } from '../middlewares' |
14 | 14 | ||
15 | const clientsRouter = express.Router() | 15 | const clientsRouter = express.Router() |
16 | 16 | ||
@@ -81,6 +81,12 @@ clientsRouter.use('/client/*', (req: express.Request, res: express.Response) => | |||
81 | res.status(HttpStatusCode.NOT_FOUND_404).end() | 81 | res.status(HttpStatusCode.NOT_FOUND_404).end() |
82 | }) | 82 | }) |
83 | 83 | ||
84 | // No index exceptions | ||
85 | clientsRouter.all('/about/peertube', | ||
86 | disableRobots, | ||
87 | asyncMiddleware(serveIndexHTML) | ||
88 | ) | ||
89 | |||
84 | // Always serve index client page (the client is a single page application, let it handle routing) | 90 | // Always serve index client page (the client is a single page application, let it handle routing) |
85 | // Try to provide the right language index.html | 91 | // Try to provide the right language index.html |
86 | clientsRouter.use('/(:language)?', asyncMiddleware(serveIndexHTML)) | 92 | clientsRouter.use('/(:language)?', asyncMiddleware(serveIndexHTML)) |