diff options
Diffstat (limited to 'server/controllers/api/videos/upload.ts')
-rw-r--r-- | server/controllers/api/videos/upload.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index 27fef0b1a..e520bf4b5 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts | |||
@@ -11,8 +11,9 @@ import { buildNewFile } from '@server/lib/video-file' | |||
11 | import { VideoPathManager } from '@server/lib/video-path-manager' | 11 | import { VideoPathManager } from '@server/lib/video-path-manager' |
12 | import { buildNextVideoState } from '@server/lib/video-state' | 12 | import { buildNextVideoState } from '@server/lib/video-state' |
13 | import { openapiOperationDoc } from '@server/middlewares/doc' | 13 | import { openapiOperationDoc } from '@server/middlewares/doc' |
14 | import { VideoPasswordModel } from '@server/models/video/video-password' | ||
14 | import { VideoSourceModel } from '@server/models/video/video-source' | 15 | import { VideoSourceModel } from '@server/models/video/video-source' |
15 | import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models' | 16 | import { MVideoFile, MVideoFullLight } from '@server/types/models' |
16 | import { uuidToShort } from '@shared/extra-utils' | 17 | import { uuidToShort } from '@shared/extra-utils' |
17 | import { HttpStatusCode, VideoCreate, VideoPrivacy, VideoState } from '@shared/models' | 18 | import { HttpStatusCode, VideoCreate, VideoPrivacy, VideoState } from '@shared/models' |
18 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | 19 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
@@ -33,7 +34,6 @@ import { | |||
33 | } from '../../../middlewares' | 34 | } from '../../../middlewares' |
34 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | 35 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' |
35 | import { VideoModel } from '../../../models/video/video' | 36 | import { VideoModel } from '../../../models/video/video' |
36 | import { VideoPasswordModel } from '@server/models/video/video-password' | ||
37 | 37 | ||
38 | const lTags = loggerTagsFactory('api', 'video') | 38 | const lTags = loggerTagsFactory('api', 'video') |
39 | const auditLogger = auditLoggerFactory('videos') | 39 | const auditLogger = auditLoggerFactory('videos') |
@@ -109,7 +109,7 @@ async function addVideoLegacy (req: express.Request, res: express.Response) { | |||
109 | } | 109 | } |
110 | 110 | ||
111 | async function addVideoResumable (req: express.Request, res: express.Response) { | 111 | async function addVideoResumable (req: express.Request, res: express.Response) { |
112 | const videoPhysicalFile = res.locals.videoFileResumable | 112 | const videoPhysicalFile = res.locals.uploadVideoFileResumable |
113 | const videoInfo = videoPhysicalFile.metadata | 113 | const videoInfo = videoPhysicalFile.metadata |
114 | const files = { previewfile: videoInfo.previewfile, thumbnailfile: videoInfo.thumbnailfile } | 114 | const files = { previewfile: videoInfo.previewfile, thumbnailfile: videoInfo.thumbnailfile } |
115 | 115 | ||
@@ -193,6 +193,7 @@ async function addVideo (options: { | |||
193 | user, | 193 | user, |
194 | isRemote: false, | 194 | isRemote: false, |
195 | isNew: true, | 195 | isNew: true, |
196 | isNewFile: true, | ||
196 | transaction: t | 197 | transaction: t |
197 | }) | 198 | }) |
198 | 199 | ||
@@ -209,7 +210,7 @@ async function addVideo (options: { | |||
209 | // Channel has a new content, set as updated | 210 | // Channel has a new content, set as updated |
210 | await videoCreated.VideoChannel.setAsUpdated() | 211 | await videoCreated.VideoChannel.setAsUpdated() |
211 | 212 | ||
212 | addVideoJobsAfterUpload(videoCreated, videoFile, user) | 213 | addVideoJobsAfterUpload(videoCreated, videoFile) |
213 | .catch(err => logger.error('Cannot build new video jobs of %s.', videoCreated.uuid, { err, ...lTags(videoCreated.uuid) })) | 214 | .catch(err => logger.error('Cannot build new video jobs of %s.', videoCreated.uuid, { err, ...lTags(videoCreated.uuid) })) |
214 | 215 | ||
215 | Hooks.runAction('action:api.video.uploaded', { video: videoCreated, req, res }) | 216 | Hooks.runAction('action:api.video.uploaded', { video: videoCreated, req, res }) |
@@ -223,7 +224,7 @@ async function addVideo (options: { | |||
223 | } | 224 | } |
224 | } | 225 | } |
225 | 226 | ||
226 | async function addVideoJobsAfterUpload (video: MVideoFullLight, videoFile: MVideoFile, user: MUserId) { | 227 | async function addVideoJobsAfterUpload (video: MVideoFullLight, videoFile: MVideoFile) { |
227 | const jobs: (CreateJobArgument & CreateJobOptions)[] = [ | 228 | const jobs: (CreateJobArgument & CreateJobOptions)[] = [ |
228 | { | 229 | { |
229 | type: 'manage-video-torrent' as 'manage-video-torrent', | 230 | type: 'manage-video-torrent' as 'manage-video-torrent', |