diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/config.ts | 12 | ||||
-rw-r--r-- | server/controllers/api/videos/import.ts | 12 | ||||
-rw-r--r-- | server/controllers/static.ts | 3 |
3 files changed, 9 insertions, 18 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 8bc3123bf..44f3d3ef7 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -10,6 +10,7 @@ import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '.. | |||
10 | import { objectConverter } from '../../helpers/core-utils' | 10 | import { objectConverter } from '../../helpers/core-utils' |
11 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' | 11 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' |
12 | import { getServerCommit } from '../../helpers/utils' | 12 | import { getServerCommit } from '../../helpers/utils' |
13 | import { getEnabledResolutions } from '../../lib/video-transcoding' | ||
13 | import { CONFIG, isEmailEnabled, reloadConfig } from '../../initializers/config' | 14 | import { CONFIG, isEmailEnabled, reloadConfig } from '../../initializers/config' |
14 | import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '../../initializers/constants' | 15 | import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '../../initializers/constants' |
15 | import { ClientHtml } from '../../lib/client-html' | 16 | import { ClientHtml } from '../../lib/client-html' |
@@ -285,16 +286,6 @@ function getRegisteredThemes () { | |||
285 | })) | 286 | })) |
286 | } | 287 | } |
287 | 288 | ||
288 | function getEnabledResolutions (type: 'vod' | 'live') { | ||
289 | const transcoding = type === 'vod' | ||
290 | ? CONFIG.TRANSCODING | ||
291 | : CONFIG.LIVE.TRANSCODING | ||
292 | |||
293 | return Object.keys(transcoding.RESOLUTIONS) | ||
294 | .filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true) | ||
295 | .map(r => parseInt(r, 10)) | ||
296 | } | ||
297 | |||
298 | function getRegisteredPlugins () { | 289 | function getRegisteredPlugins () { |
299 | return PluginManager.Instance.getRegisteredPlugins() | 290 | return PluginManager.Instance.getRegisteredPlugins() |
300 | .map(p => ({ | 291 | .map(p => ({ |
@@ -345,7 +336,6 @@ function getExternalAuthsPlugins () { | |||
345 | 336 | ||
346 | export { | 337 | export { |
347 | configRouter, | 338 | configRouter, |
348 | getEnabledResolutions, | ||
349 | getRegisteredPlugins, | 339 | getRegisteredPlugins, |
350 | getRegisteredThemes | 340 | getRegisteredThemes |
351 | } | 341 | } |
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 82e084c54..9702e219a 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -146,9 +146,10 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) | |||
146 | } catch (err) { | 146 | } catch (err) { |
147 | logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err }) | 147 | logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err }) |
148 | 148 | ||
149 | return res.status(HttpStatusCode.BAD_REQUEST_400).json({ | 149 | return res.status(HttpStatusCode.BAD_REQUEST_400) |
150 | error: 'Cannot fetch remote information of this URL.' | 150 | .json({ |
151 | }).end() | 151 | error: 'Cannot fetch remote information of this URL.' |
152 | }) | ||
152 | } | 153 | } |
153 | 154 | ||
154 | const video = buildVideo(res.locals.videoChannel.id, body, youtubeDLInfo) | 155 | const video = buildVideo(res.locals.videoChannel.id, body, youtubeDLInfo) |
@@ -219,9 +220,8 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) | |||
219 | videoImportId: videoImport.id, | 220 | videoImportId: videoImport.id, |
220 | generateThumbnail: !thumbnailModel, | 221 | generateThumbnail: !thumbnailModel, |
221 | generatePreview: !previewModel, | 222 | generatePreview: !previewModel, |
222 | fileExt: youtubeDLInfo.fileExt | 223 | fileExt: `.${youtubeDLInfo.ext || 'mp4'}`, |
223 | ? `.${youtubeDLInfo.fileExt}` | 224 | mergeExt: youtubeDLInfo.mergeExt ? `.${youtubeDLInfo.mergeExt}` : '' |
224 | : '.mp4' | ||
225 | } | 225 | } |
226 | await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload }) | 226 | await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload }) |
227 | 227 | ||
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index bdb9c3041..a7b28704c 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -19,13 +19,14 @@ import { VideoCommentModel } from '../models/video/video-comment' | |||
19 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | 19 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' |
20 | import { join } from 'path' | 20 | import { join } from 'path' |
21 | import { root } from '../helpers/core-utils' | 21 | import { root } from '../helpers/core-utils' |
22 | import { getEnabledResolutions } from '../lib/video-transcoding' | ||
22 | import { CONFIG, isEmailEnabled } from '../initializers/config' | 23 | import { CONFIG, isEmailEnabled } from '../initializers/config' |
23 | import { getPreview, getVideoCaption } from './lazy-static' | 24 | import { getPreview, getVideoCaption } from './lazy-static' |
24 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' | 25 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' |
25 | import { MVideoFile, MVideoFullLight } from '@server/types/models' | 26 | import { MVideoFile, MVideoFullLight } from '@server/types/models' |
26 | import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' | 27 | import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' |
27 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' | 28 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' |
28 | import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config' | 29 | import { getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config' |
29 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | 30 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' |
30 | import { serveIndexHTML } from '@server/lib/client-html' | 31 | import { serveIndexHTML } from '@server/lib/client-html' |
31 | 32 | ||