aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/import.ts12
-rw-r--r--server/controllers/client.ts10
-rw-r--r--server/controllers/static.ts1
3 files changed, 19 insertions, 4 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 5f90e4308..4265f3217 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -158,7 +158,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
158 158
159 // Process video thumbnail from url if processing from request.files failed 159 // Process video thumbnail from url if processing from request.files failed
160 if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) { 160 if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) {
161 thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video) 161 try {
162 thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video)
163 } catch (err) {
164 logger.warn('Cannot process thumbnail %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err })
165 }
162 } 166 }
163 167
164 // Process video preview from request.files 168 // Process video preview from request.files
@@ -166,7 +170,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
166 170
167 // Process video preview from url if processing from request.files failed 171 // Process video preview from url if processing from request.files failed
168 if (!previewModel && youtubeDLInfo.thumbnailUrl) { 172 if (!previewModel && youtubeDLInfo.thumbnailUrl) {
169 previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video) 173 try {
174 previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video)
175 } catch (err) {
176 logger.warn('Cannot process preview %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err })
177 }
170 } 178 }
171 179
172 const videoImport = await insertIntoDB({ 180 const videoImport = await insertIntoDB({
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'
5import { logger } from '@server/helpers/logger' 5import { logger } from '@server/helpers/logger'
6import { CONFIG } from '@server/initializers/config' 6import { CONFIG } from '@server/initializers/config'
7import { Hooks } from '@server/lib/plugins/hooks' 7import { Hooks } from '@server/lib/plugins/hooks'
8import { HttpStatusCode } from '@shared/models'
9import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@shared/core-utils/i18n' 8import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@shared/core-utils/i18n'
9import { HttpStatusCode } from '@shared/models'
10import { root } from '../helpers/core-utils' 10import { root } from '../helpers/core-utils'
11import { STATIC_MAX_AGE } from '../initializers/constants' 11import { STATIC_MAX_AGE } from '../initializers/constants'
12import { ClientHtml, sendHTML, serveIndexHTML } from '../lib/client-html' 12import { ClientHtml, sendHTML, serveIndexHTML } from '../lib/client-html'
13import { asyncMiddleware, embedCSP } from '../middlewares' 13import { asyncMiddleware, disableRobots, embedCSP } from '../middlewares'
14 14
15const clientsRouter = express.Router() 15const 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
85clientsRouter.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
86clientsRouter.use('/(:language)?', asyncMiddleware(serveIndexHTML)) 92clientsRouter.use('/(:language)?', asyncMiddleware(serveIndexHTML))
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index 1c04e4b11..fe1629910 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -69,6 +69,7 @@ staticRouter.get('/robots.txt',
69 cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS), 69 cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS),
70 (_, res: express.Response) => { 70 (_, res: express.Response) => {
71 res.type('text/plain') 71 res.type('text/plain')
72
72 return res.send(CONFIG.INSTANCE.ROBOTS) 73 return res.send(CONFIG.INSTANCE.ROBOTS)
73 } 74 }
74) 75)