diff options
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/captions.ts | 11 | ||||
-rw-r--r-- | server/controllers/api/videos/editor.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/import.ts | 7 | ||||
-rw-r--r-- | server/controllers/api/videos/live.ts | 10 | ||||
-rw-r--r-- | server/controllers/api/videos/update.ts | 10 | ||||
-rw-r--r-- | server/controllers/api/videos/upload.ts | 15 |
6 files changed, 8 insertions, 47 deletions
diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 2a9a9d233..2b511a398 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts | |||
@@ -1,26 +1,19 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { Hooks } from '@server/lib/plugins/hooks' | ||
2 | import { MVideoCaption } from '@server/types/models' | 3 | import { MVideoCaption } from '@server/types/models' |
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 4 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
4 | import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' | 5 | import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' |
5 | import { createReqFiles } from '../../../helpers/express-utils' | 6 | import { createReqFiles } from '../../../helpers/express-utils' |
6 | import { logger } from '../../../helpers/logger' | 7 | import { logger } from '../../../helpers/logger' |
7 | import { getFormattedObjects } from '../../../helpers/utils' | 8 | import { getFormattedObjects } from '../../../helpers/utils' |
8 | import { CONFIG } from '../../../initializers/config' | ||
9 | import { MIMETYPES } from '../../../initializers/constants' | 9 | import { MIMETYPES } from '../../../initializers/constants' |
10 | import { sequelizeTypescript } from '../../../initializers/database' | 10 | import { sequelizeTypescript } from '../../../initializers/database' |
11 | import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' | 11 | import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' |
12 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' | 12 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' |
13 | import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' | 13 | import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' |
14 | import { VideoCaptionModel } from '../../../models/video/video-caption' | 14 | import { VideoCaptionModel } from '../../../models/video/video-caption' |
15 | import { Hooks } from '@server/lib/plugins/hooks' | ||
16 | 15 | ||
17 | const reqVideoCaptionAdd = createReqFiles( | 16 | const reqVideoCaptionAdd = createReqFiles([ 'captionfile' ], MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT) |
18 | [ 'captionfile' ], | ||
19 | MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT, | ||
20 | { | ||
21 | captionfile: CONFIG.STORAGE.CAPTIONS_DIR | ||
22 | } | ||
23 | ) | ||
24 | 17 | ||
25 | const videoCaptionsRouter = express.Router() | 18 | const videoCaptionsRouter = express.Router() |
26 | 19 | ||
diff --git a/server/controllers/api/videos/editor.ts b/server/controllers/api/videos/editor.ts index 61e2eb5da..588cc1a8c 100644 --- a/server/controllers/api/videos/editor.ts +++ b/server/controllers/api/videos/editor.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { createAnyReqFiles } from '@server/helpers/express-utils' | 2 | import { createAnyReqFiles } from '@server/helpers/express-utils' |
3 | import { CONFIG } from '@server/initializers/config' | ||
4 | import { MIMETYPES } from '@server/initializers/constants' | 3 | import { MIMETYPES } from '@server/initializers/constants' |
5 | import { JobQueue } from '@server/lib/job-queue' | 4 | import { JobQueue } from '@server/lib/job-queue' |
6 | import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-editor' | 5 | import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-editor' |
@@ -21,7 +20,6 @@ const editorRouter = express.Router() | |||
21 | 20 | ||
22 | const tasksFiles = createAnyReqFiles( | 21 | const tasksFiles = createAnyReqFiles( |
23 | MIMETYPES.VIDEO.MIMETYPE_EXT, | 22 | MIMETYPES.VIDEO.MIMETYPE_EXT, |
24 | CONFIG.STORAGE.TMP_DIR, | ||
25 | (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => { | 23 | (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => { |
26 | const body = req.body as VideoEditorCreateEdition | 24 | const body = req.body as VideoEditorCreateEdition |
27 | 25 | ||
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index b54fa822c..44283e266 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -61,12 +61,7 @@ const videoImportsRouter = express.Router() | |||
61 | 61 | ||
62 | const reqVideoFileImport = createReqFiles( | 62 | const reqVideoFileImport = createReqFiles( |
63 | [ 'thumbnailfile', 'previewfile', 'torrentfile' ], | 63 | [ 'thumbnailfile', 'previewfile', 'torrentfile' ], |
64 | Object.assign({}, MIMETYPES.TORRENT.MIMETYPE_EXT, MIMETYPES.IMAGE.MIMETYPE_EXT), | 64 | { ...MIMETYPES.TORRENT.MIMETYPE_EXT, ...MIMETYPES.IMAGE.MIMETYPE_EXT } |
65 | { | ||
66 | thumbnailfile: CONFIG.STORAGE.TMP_DIR, | ||
67 | previewfile: CONFIG.STORAGE.TMP_DIR, | ||
68 | torrentfile: CONFIG.STORAGE.TMP_DIR | ||
69 | } | ||
70 | ) | 65 | ) |
71 | 66 | ||
72 | videoImportsRouter.post('/imports', | 67 | videoImportsRouter.post('/imports', |
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 8b8cacff9..49cabb6f3 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { createReqFiles } from '@server/helpers/express-utils' | 2 | import { createReqFiles } from '@server/helpers/express-utils' |
3 | import { CONFIG } from '@server/initializers/config' | ||
4 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' | 3 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' |
5 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 4 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
6 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | 5 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' |
@@ -19,14 +18,7 @@ import { VideoModel } from '../../../models/video/video' | |||
19 | 18 | ||
20 | const liveRouter = express.Router() | 19 | const liveRouter = express.Router() |
21 | 20 | ||
22 | const reqVideoFileLive = createReqFiles( | 21 | const reqVideoFileLive = createReqFiles([ 'thumbnailfile', 'previewfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT) |
23 | [ 'thumbnailfile', 'previewfile' ], | ||
24 | MIMETYPES.IMAGE.MIMETYPE_EXT, | ||
25 | { | ||
26 | thumbnailfile: CONFIG.STORAGE.TMP_DIR, | ||
27 | previewfile: CONFIG.STORAGE.TMP_DIR | ||
28 | } | ||
29 | ) | ||
30 | 22 | ||
31 | liveRouter.post('/live', | 23 | liveRouter.post('/live', |
32 | authenticate, | 24 | authenticate, |
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index f600847d4..8906003fc 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts | |||
@@ -11,7 +11,6 @@ import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../ | |||
11 | import { resetSequelizeInstance } from '../../../helpers/database-utils' | 11 | import { resetSequelizeInstance } from '../../../helpers/database-utils' |
12 | import { createReqFiles } from '../../../helpers/express-utils' | 12 | import { createReqFiles } from '../../../helpers/express-utils' |
13 | import { logger, loggerTagsFactory } from '../../../helpers/logger' | 13 | import { logger, loggerTagsFactory } from '../../../helpers/logger' |
14 | import { CONFIG } from '../../../initializers/config' | ||
15 | import { MIMETYPES } from '../../../initializers/constants' | 14 | import { MIMETYPES } from '../../../initializers/constants' |
16 | import { sequelizeTypescript } from '../../../initializers/database' | 15 | import { sequelizeTypescript } from '../../../initializers/database' |
17 | import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' | 16 | import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' |
@@ -26,14 +25,7 @@ const lTags = loggerTagsFactory('api', 'video') | |||
26 | const auditLogger = auditLoggerFactory('videos') | 25 | const auditLogger = auditLoggerFactory('videos') |
27 | const updateRouter = express.Router() | 26 | const updateRouter = express.Router() |
28 | 27 | ||
29 | const reqVideoFileUpdate = createReqFiles( | 28 | const reqVideoFileUpdate = createReqFiles([ 'thumbnailfile', 'previewfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT) |
30 | [ 'thumbnailfile', 'previewfile' ], | ||
31 | MIMETYPES.IMAGE.MIMETYPE_EXT, | ||
32 | { | ||
33 | thumbnailfile: CONFIG.STORAGE.TMP_DIR, | ||
34 | previewfile: CONFIG.STORAGE.TMP_DIR | ||
35 | } | ||
36 | ) | ||
37 | 29 | ||
38 | updateRouter.put('/:id', | 30 | updateRouter.put('/:id', |
39 | openapiOperationDoc({ operationId: 'putVideo' }), | 31 | openapiOperationDoc({ operationId: 'putVideo' }), |
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index 3c026ad1f..dd69cf238 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts | |||
@@ -24,9 +24,8 @@ import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@share | |||
24 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | 24 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
25 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 25 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
26 | import { createReqFiles } from '../../../helpers/express-utils' | 26 | import { createReqFiles } from '../../../helpers/express-utils' |
27 | import { ffprobePromise, buildFileMetadata, getVideoStreamFPS, getVideoStreamDimensionsInfo } from '../../../helpers/ffmpeg' | 27 | import { buildFileMetadata, ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '../../../helpers/ffmpeg' |
28 | import { logger, loggerTagsFactory } from '../../../helpers/logger' | 28 | import { logger, loggerTagsFactory } from '../../../helpers/logger' |
29 | import { CONFIG } from '../../../initializers/config' | ||
30 | import { MIMETYPES } from '../../../initializers/constants' | 29 | import { MIMETYPES } from '../../../initializers/constants' |
31 | import { sequelizeTypescript } from '../../../initializers/database' | 30 | import { sequelizeTypescript } from '../../../initializers/database' |
32 | import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' | 31 | import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' |
@@ -52,21 +51,13 @@ const uploadRouter = express.Router() | |||
52 | 51 | ||
53 | const reqVideoFileAdd = createReqFiles( | 52 | const reqVideoFileAdd = createReqFiles( |
54 | [ 'videofile', 'thumbnailfile', 'previewfile' ], | 53 | [ 'videofile', 'thumbnailfile', 'previewfile' ], |
55 | Object.assign({}, MIMETYPES.VIDEO.MIMETYPE_EXT, MIMETYPES.IMAGE.MIMETYPE_EXT), | 54 | { ...MIMETYPES.VIDEO.MIMETYPE_EXT, ...MIMETYPES.IMAGE.MIMETYPE_EXT } |
56 | { | ||
57 | videofile: CONFIG.STORAGE.TMP_DIR, | ||
58 | thumbnailfile: CONFIG.STORAGE.TMP_DIR, | ||
59 | previewfile: CONFIG.STORAGE.TMP_DIR | ||
60 | } | ||
61 | ) | 55 | ) |
62 | 56 | ||
63 | const reqVideoFileAddResumable = createReqFiles( | 57 | const reqVideoFileAddResumable = createReqFiles( |
64 | [ 'thumbnailfile', 'previewfile' ], | 58 | [ 'thumbnailfile', 'previewfile' ], |
65 | MIMETYPES.IMAGE.MIMETYPE_EXT, | 59 | MIMETYPES.IMAGE.MIMETYPE_EXT, |
66 | { | 60 | getResumableUploadPath() |
67 | thumbnailfile: getResumableUploadPath(), | ||
68 | previewfile: getResumableUploadPath() | ||
69 | } | ||
70 | ) | 61 | ) |
71 | 62 | ||
72 | uploadRouter.post('/upload', | 63 | uploadRouter.post('/upload', |