diff options
-rwxr-xr-x | scripts/i18n/create-custom-files.ts | 11 | ||||
-rw-r--r-- | server/controllers/api/videos/import.ts | 11 | ||||
-rw-r--r-- | server/helpers/audit-logger.ts | 14 |
3 files changed, 27 insertions, 9 deletions
diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts index a297fa79c..c4f8411e1 100755 --- a/scripts/i18n/create-custom-files.ts +++ b/scripts/i18n/create-custom-files.ts | |||
@@ -1,7 +1,14 @@ | |||
1 | import * as jsToXliff12 from 'xliff/jsToXliff12' | 1 | import * as jsToXliff12 from 'xliff/jsToXliff12' |
2 | import { writeFile } from 'fs' | 2 | import { writeFile } from 'fs' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { buildLanguages, VIDEO_CATEGORIES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../server/initializers/constants' | 4 | import { |
5 | buildLanguages, | ||
6 | VIDEO_CATEGORIES, | ||
7 | VIDEO_IMPORT_STATES, | ||
8 | VIDEO_LICENCES, | ||
9 | VIDEO_PRIVACIES, | ||
10 | VIDEO_STATES | ||
11 | } from '../../server/initializers/constants' | ||
5 | import { values } from 'lodash' | 12 | import { values } from 'lodash' |
6 | 13 | ||
7 | type TranslationType = { | 14 | type TranslationType = { |
@@ -33,6 +40,8 @@ const serverKeys: any = {} | |||
33 | values(VIDEO_CATEGORIES) | 40 | values(VIDEO_CATEGORIES) |
34 | .concat(values(VIDEO_LICENCES)) | 41 | .concat(values(VIDEO_LICENCES)) |
35 | .concat(values(VIDEO_PRIVACIES)) | 42 | .concat(values(VIDEO_PRIVACIES)) |
43 | .concat(values(VIDEO_STATES)) | ||
44 | .concat(values(VIDEO_IMPORT_STATES)) | ||
36 | .forEach(v => serverKeys[v] = v) | 45 | .forEach(v => serverKeys[v] = v) |
37 | 46 | ||
38 | // More keys | 47 | // More keys |
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index ca7a5f9ca..33ac83cb9 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -1,11 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { auditLoggerFactory } from '../../../helpers/audit-logger' | 2 | import { auditLoggerFactory, VideoImportAuditView } from '../../../helpers/audit-logger' |
3 | import { | 3 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares' |
4 | asyncMiddleware, | ||
5 | asyncRetryTransactionMiddleware, | ||
6 | authenticate, | ||
7 | videoImportAddValidator | ||
8 | } from '../../../middlewares' | ||
9 | import { CONFIG, IMAGE_MIMETYPE_EXT, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers' | 4 | import { CONFIG, IMAGE_MIMETYPE_EXT, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers' |
10 | import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl' | 5 | import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl' |
11 | import { createReqFiles } from '../../../helpers/express-utils' | 6 | import { createReqFiles } from '../../../helpers/express-utils' |
@@ -136,5 +131,7 @@ async function addVideoImport (req: express.Request, res: express.Response) { | |||
136 | } | 131 | } |
137 | await JobQueue.Instance.createJob({ type: 'video-import', payload }) | 132 | await JobQueue.Instance.createJob({ type: 'video-import', payload }) |
138 | 133 | ||
134 | auditLogger.create(res.locals.oauth.token.User.Account.Actor.getIdentifier(), new VideoImportAuditView(videoImport.toFormattedJSON())) | ||
135 | |||
139 | return res.json(videoImport.toFormattedJSON()) | 136 | return res.json(videoImport.toFormattedJSON()) |
140 | } | 137 | } |
diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index f6eea7d90..031b1bfbd 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts | |||
@@ -5,7 +5,7 @@ import * as flatten from 'flat' | |||
5 | import * as winston from 'winston' | 5 | import * as winston from 'winston' |
6 | import { CONFIG } from '../initializers' | 6 | import { CONFIG } from '../initializers' |
7 | import { jsonLoggerFormat, labelFormatter } from './logger' | 7 | import { jsonLoggerFormat, labelFormatter } from './logger' |
8 | import { VideoDetails, User, VideoChannel, VideoAbuse } from '../../shared' | 8 | import { VideoDetails, User, VideoChannel, VideoAbuse, VideoImport } from '../../shared' |
9 | import { VideoComment } from '../../shared/models/videos/video-comment.model' | 9 | import { VideoComment } from '../../shared/models/videos/video-comment.model' |
10 | import { CustomConfig } from '../../shared/models/server/custom-config.model' | 10 | import { CustomConfig } from '../../shared/models/server/custom-config.model' |
11 | 11 | ||
@@ -119,6 +119,17 @@ class VideoAuditView extends EntityAuditView { | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | const videoImportKeysToKeep = [ | ||
123 | 'id', | ||
124 | 'targetUrl', | ||
125 | 'video-name' | ||
126 | ] | ||
127 | class VideoImportAuditView extends EntityAuditView { | ||
128 | constructor (private videoImport: VideoImport) { | ||
129 | super(videoImportKeysToKeep, 'video-import', videoImport) | ||
130 | } | ||
131 | } | ||
132 | |||
122 | const commentKeysToKeep = [ | 133 | const commentKeysToKeep = [ |
123 | 'id', | 134 | 'id', |
124 | 'text', | 135 | 'text', |
@@ -246,6 +257,7 @@ class CustomConfigAuditView extends EntityAuditView { | |||
246 | 257 | ||
247 | export { | 258 | export { |
248 | auditLoggerFactory, | 259 | auditLoggerFactory, |
260 | VideoImportAuditView, | ||
249 | VideoChannelAuditView, | 261 | VideoChannelAuditView, |
250 | CommentAuditView, | 262 | CommentAuditView, |
251 | UserAuditView, | 263 | UserAuditView, |