From 5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 3 Aug 2018 11:10:31 +0200 Subject: Add import http enabled configuration --- server/controllers/api/config.ts | 14 ++++++++++++++ server/controllers/api/users.ts | 1 - server/controllers/api/videos/import.ts | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 411b13539..acbeab70b 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -65,6 +65,13 @@ async function getConfig (req: express.Request, res: express.Response, next: exp transcoding: { enabledResolutions }, + import: { + video: { + http: { + enabled: CONFIG.IMPORT.VIDEOS.HTTP.ENABLED + } + } + }, avatar: { file: { size: { @@ -225,6 +232,13 @@ function customConfig (): CustomConfig { '720p': CONFIG.TRANSCODING.RESOLUTIONS[ '720p' ], '1080p': CONFIG.TRANSCODING.RESOLUTIONS[ '1080p' ] } + }, + import: { + videos: { + http: { + enabled: CONFIG.IMPORT.VIDEOS.HTTP.ENABLED + } + } } } } diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index 6e5f9913e..879ba3f91 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts @@ -68,7 +68,6 @@ usersRouter.get('/me/video-quota-used', asyncMiddleware(getUserVideoQuotaUsed) ) - usersRouter.get('/me/videos/imports', authenticate, paginationValidator, diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 33ac83cb9..ee11b0741 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -77,7 +77,7 @@ async function addVideoImport (req: express.Request, res: express.Response) { video.url = getVideoActivityPubUrl(video) // Process thumbnail file? - const thumbnailField = req.files['thumbnailfile'] + const thumbnailField = req.files ? req.files['thumbnailfile'] : undefined let downloadThumbnail = true if (thumbnailField) { const thumbnailPhysicalFile = thumbnailField[ 0 ] @@ -86,7 +86,7 @@ async function addVideoImport (req: express.Request, res: express.Response) { } // Process preview file? - const previewField = req.files['previewfile'] + const previewField = req.files ? req.files['previewfile'] : undefined let downloadPreview = true if (previewField) { const previewPhysicalFile = previewField[0] -- cgit v1.2.3