import * as path from 'path'
+import * as express from 'express'
import { diff } from 'deep-object-diff'
import { chain } from 'lodash'
import * as flatten from 'flat'
import * as winston from 'winston'
import { CONFIG } from '../initializers'
import { jsonLoggerFormat, labelFormatter } from './logger'
-import { VideoDetails, User, VideoChannel, VideoAbuse } from '../../shared'
+import { VideoDetails, User, VideoChannel, VideoAbuse, VideoImport } from '../../shared'
import { VideoComment } from '../../shared/models/videos/video-comment.model'
import { CustomConfig } from '../../shared/models/server/custom-config.model'
+import { UserModel } from '../models/account/user'
+
+function getAuditIdFromRes (res: express.Response) {
+ return (res.locals.oauth.token.User as UserModel).username
+}
enum AUDIT_TYPE {
CREATE = 'create',
'channel-uuid',
'channel-name',
'support',
- 'commentsEnabled'
+ 'commentsEnabled',
+ 'downloadEnabled'
]
class VideoAuditView extends EntityAuditView {
constructor (private video: VideoDetails) {
}
}
+const videoImportKeysToKeep = [
+ 'id',
+ 'targetUrl',
+ 'video-name'
+]
+class VideoImportAuditView extends EntityAuditView {
+ constructor (private videoImport: VideoImport) {
+ super(videoImportKeysToKeep, 'video-import', videoImport)
+ }
+}
+
const commentKeysToKeep = [
'id',
'text',
'cache-captions-size',
'signup-enabled',
'signup-limit',
+ 'signup-requiresEmailVerification',
'admin-email',
'user-videoQuota',
'transcoding-enabled',
const resolutionsDict = infos.transcoding.resolutions
const resolutionsArray = []
Object.entries(resolutionsDict).forEach(([resolution, isEnabled]) => {
- if (isEnabled) {
- resolutionsArray.push(resolution)
- }
+ if (isEnabled) resolutionsArray.push(resolution)
})
- infos.transcoding.resolutions = resolutionsArray
+ Object.assign({}, infos, { transcoding: { resolutions: resolutionsArray } })
super(customConfigKeysToKeep, 'config', infos)
}
}
export {
+ getAuditIdFromRes,
+
auditLoggerFactory,
+ VideoImportAuditView,
VideoChannelAuditView,
CommentAuditView,
UserAuditView,