aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/upload.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/upload.ts')
-rw-r--r--server/controllers/api/videos/upload.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts
index 3e9979330..6773b500f 100644
--- a/server/controllers/api/videos/upload.ts
+++ b/server/controllers/api/videos/upload.ts
@@ -129,7 +129,7 @@ async function addVideoLegacy (req: express.Request, res: express.Response) {
129 const videoInfo: VideoCreate = req.body 129 const videoInfo: VideoCreate = req.body
130 const files = req.files 130 const files = req.files
131 131
132 const response = await addVideo({ res, videoPhysicalFile, videoInfo, files }) 132 const response = await addVideo({ req, res, videoPhysicalFile, videoInfo, files })
133 133
134 return res.json(response) 134 return res.json(response)
135} 135}
@@ -139,19 +139,20 @@ async function addVideoResumable (req: express.Request, res: express.Response) {
139 const videoInfo = videoPhysicalFile.metadata 139 const videoInfo = videoPhysicalFile.metadata
140 const files = { previewfile: videoInfo.previewfile } 140 const files = { previewfile: videoInfo.previewfile }
141 141
142 const response = await addVideo({ res, videoPhysicalFile, videoInfo, files }) 142 const response = await addVideo({ req, res, videoPhysicalFile, videoInfo, files })
143 await Redis.Instance.setUploadSession(req.query.upload_id, response) 143 await Redis.Instance.setUploadSession(req.query.upload_id, response)
144 144
145 return res.json(response) 145 return res.json(response)
146} 146}
147 147
148async function addVideo (options: { 148async function addVideo (options: {
149 req: express.Request
149 res: express.Response 150 res: express.Response
150 videoPhysicalFile: express.VideoUploadFile 151 videoPhysicalFile: express.VideoUploadFile
151 videoInfo: VideoCreate 152 videoInfo: VideoCreate
152 files: express.UploadFiles 153 files: express.UploadFiles
153}) { 154}) {
154 const { res, videoPhysicalFile, videoInfo, files } = options 155 const { req, res, videoPhysicalFile, videoInfo, files } = options
155 const videoChannel = res.locals.videoChannel 156 const videoChannel = res.locals.videoChannel
156 const user = res.locals.oauth.token.User 157 const user = res.locals.oauth.token.User
157 158
@@ -235,7 +236,7 @@ async function addVideo (options: {
235 }) 236 })
236 .catch(err => logger.error('Cannot add optimize/merge audio job for %s.', videoCreated.uuid, { err, ...lTags(videoCreated.uuid) })) 237 .catch(err => logger.error('Cannot add optimize/merge audio job for %s.', videoCreated.uuid, { err, ...lTags(videoCreated.uuid) }))
237 238
238 Hooks.runAction('action:api.video.uploaded', { video: videoCreated }) 239 Hooks.runAction('action:api.video.uploaded', { video: videoCreated, req, res })
239 240
240 return { 241 return {
241 video: { 242 video: {