aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r--server/controllers/api/videos/comment.ts8
-rw-r--r--server/controllers/api/videos/import.ts6
-rw-r--r--server/controllers/api/videos/index.ts8
3 files changed, 11 insertions, 11 deletions
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
index 8d0692b2b..40ad54d09 100644
--- a/server/controllers/api/videos/comment.ts
+++ b/server/controllers/api/videos/comment.ts
@@ -23,7 +23,7 @@ import {
23} from '../../../middlewares/validators/video-comments' 23} from '../../../middlewares/validators/video-comments'
24import { VideoModel } from '../../../models/video/video' 24import { VideoModel } from '../../../models/video/video'
25import { VideoCommentModel } from '../../../models/video/video-comment' 25import { VideoCommentModel } from '../../../models/video/video-comment'
26import { auditLoggerFactory, CommentAuditView } from '../../../helpers/audit-logger' 26import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
27 27
28const auditLogger = auditLoggerFactory('comments') 28const auditLogger = auditLoggerFactory('comments')
29const videoCommentRouter = express.Router() 29const videoCommentRouter = express.Router()
@@ -109,7 +109,7 @@ async function addVideoCommentThread (req: express.Request, res: express.Respons
109 }, t) 109 }, t)
110 }) 110 })
111 111
112 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new CommentAuditView(comment.toFormattedJSON())) 112 auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON()))
113 113
114 return res.json({ 114 return res.json({
115 comment: comment.toFormattedJSON() 115 comment: comment.toFormattedJSON()
@@ -128,7 +128,7 @@ async function addVideoCommentReply (req: express.Request, res: express.Response
128 }, t) 128 }, t)
129 }) 129 })
130 130
131 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new CommentAuditView(comment.toFormattedJSON())) 131 auditLogger.create(getAuditIdFromRes(res), new CommentAuditView(comment.toFormattedJSON()))
132 132
133 return res.json({ 133 return res.json({
134 comment: comment.toFormattedJSON() 134 comment: comment.toFormattedJSON()
@@ -143,7 +143,7 @@ async function removeVideoComment (req: express.Request, res: express.Response)
143 }) 143 })
144 144
145 auditLogger.delete( 145 auditLogger.delete(
146 res.locals.oauth.token.User.Account.Actor.getIdentifier(), 146 getAuditIdFromRes(res),
147 new CommentAuditView(videoCommentInstance.toFormattedJSON()) 147 new CommentAuditView(videoCommentInstance.toFormattedJSON())
148 ) 148 )
149 logger.info('Video comment %d deleted.', videoCommentInstance.id) 149 logger.info('Video comment %d deleted.', videoCommentInstance.id)
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 44f15ef74..398fd5a7f 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as magnetUtil from 'magnet-uri' 2import * as magnetUtil from 'magnet-uri'
3import 'multer' 3import 'multer'
4import { auditLoggerFactory, VideoImportAuditView } from '../../../helpers/audit-logger' 4import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger'
5import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares' 5import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares'
6import { 6import {
7 CONFIG, 7 CONFIG,
@@ -114,7 +114,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
114 } 114 }
115 await JobQueue.Instance.createJob({ type: 'video-import', payload }) 115 await JobQueue.Instance.createJob({ type: 'video-import', payload })
116 116
117 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoImportAuditView(videoImport.toFormattedJSON())) 117 auditLogger.create(getAuditIdFromRes(res), new VideoImportAuditView(videoImport.toFormattedJSON()))
118 118
119 return res.json(videoImport.toFormattedJSON()).end() 119 return res.json(videoImport.toFormattedJSON()).end()
120} 120}
@@ -158,7 +158,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
158 } 158 }
159 await JobQueue.Instance.createJob({ type: 'video-import', payload }) 159 await JobQueue.Instance.createJob({ type: 'video-import', payload })
160 160
161 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoImportAuditView(videoImport.toFormattedJSON())) 161 auditLogger.create(getAuditIdFromRes(res), new VideoImportAuditView(videoImport.toFormattedJSON()))
162 162
163 return res.json(videoImport.toFormattedJSON()).end() 163 return res.json(videoImport.toFormattedJSON()).end()
164} 164}
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 8353a649a..581046782 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -4,7 +4,7 @@ import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../
4import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' 4import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
5import { processImage } from '../../../helpers/image-utils' 5import { processImage } from '../../../helpers/image-utils'
6import { logger } from '../../../helpers/logger' 6import { logger } from '../../../helpers/logger'
7import { auditLoggerFactory, VideoAuditView } from '../../../helpers/audit-logger' 7import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
8import { getFormattedObjects, getServerActor } from '../../../helpers/utils' 8import { getFormattedObjects, getServerActor } from '../../../helpers/utils'
9import { 9import {
10 CONFIG, 10 CONFIG,
@@ -253,7 +253,7 @@ async function addVideo (req: express.Request, res: express.Response) {
253 253
254 await federateVideoIfNeeded(video, true, t) 254 await federateVideoIfNeeded(video, true, t)
255 255
256 auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoAuditView(videoCreated.toFormattedDetailsJSON())) 256 auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(videoCreated.toFormattedDetailsJSON()))
257 logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) 257 logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid)
258 258
259 return videoCreated 259 return videoCreated
@@ -354,7 +354,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
354 await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, t) 354 await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, t)
355 355
356 auditLogger.update( 356 auditLogger.update(
357 res.locals.oauth.token.User.Account.Actor.getIdentifier(), 357 getAuditIdFromRes(res),
358 new VideoAuditView(videoInstanceUpdated.toFormattedDetailsJSON()), 358 new VideoAuditView(videoInstanceUpdated.toFormattedDetailsJSON()),
359 oldVideoAuditView 359 oldVideoAuditView
360 ) 360 )
@@ -439,7 +439,7 @@ async function removeVideo (req: express.Request, res: express.Response) {
439 await videoInstance.destroy({ transaction: t }) 439 await videoInstance.destroy({ transaction: t })
440 }) 440 })
441 441
442 auditLogger.delete(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoAuditView(videoInstance.toFormattedDetailsJSON())) 442 auditLogger.delete(getAuditIdFromRes(res), new VideoAuditView(videoInstance.toFormattedDetailsJSON()))
443 logger.info('Video with name %s and uuid %s deleted.', videoInstance.name, videoInstance.uuid) 443 logger.info('Video with name %s and uuid %s deleted.', videoInstance.name, videoInstance.uuid)
444 444
445 return res.type('json').status(204).end() 445 return res.type('json').status(204).end()