X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Faudit-logger.ts;h=6aae5e82112725fc6d843d91c68315e4469741e8;hb=f2eb23cd87cf32b8fe545178143b5f49e06a58da;hp=a4cfeef76c11cb0e0a50e48c29056f6ece7746a4;hpb=134cf2bce96a8c5aefd55154e884964975d8cf23;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index a4cfeef76..6aae5e821 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts @@ -1,15 +1,15 @@ -import * as path from 'path' -import * as express from 'express' import { diff } from 'deep-object-diff' -import { chain } from 'lodash' +import * as express from 'express' import * as flatten from 'flat' +import { chain } from 'lodash' +import * as path from 'path' import * as winston from 'winston' -import { jsonLoggerFormat, labelFormatter } from './logger' -import { User, VideoAbuse, VideoChannel, VideoDetails, VideoImport } from '../../shared' -import { VideoComment } from '../../shared/models/videos/video-comment.model' +import { AUDIT_LOG_FILENAME } from '@server/initializers/constants' +import { AdminAbuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared' import { CustomConfig } from '../../shared/models/server/custom-config.model' +import { VideoComment } from '../../shared/models/videos/video-comment.model' import { CONFIG } from '../initializers/config' -import { AUDIT_LOG_FILENAME } from '@server/initializers/constants' +import { jsonLoggerFormat, labelFormatter } from './logger' function getAuditIdFromRes (res: express.Response) { return res.locals.oauth.token.User.username @@ -36,7 +36,7 @@ const auditLogger = winston.createLogger({ maxFiles: 5, format: winston.format.combine( winston.format.timestamp(), - labelFormatter, + labelFormatter(), winston.format.splat(), jsonLoggerFormat ) @@ -212,18 +212,15 @@ class VideoChannelAuditView extends EntityAuditView { } } -const videoAbuseKeysToKeep = [ +const abuseKeysToKeep = [ 'id', 'reason', 'reporterAccount', - 'video-id', - 'video-name', - 'video-uuid', 'createdAt' ] -class VideoAbuseAuditView extends EntityAuditView { - constructor (private readonly videoAbuse: VideoAbuse) { - super(videoAbuseKeysToKeep, 'abuse', videoAbuse) +class AbuseAuditView extends EntityAuditView { + constructor (private readonly abuse: AdminAbuse) { + super(abuseKeysToKeep, 'abuse', abuse) } } @@ -274,6 +271,6 @@ export { CommentAuditView, UserAuditView, VideoAuditView, - VideoAbuseAuditView, + AbuseAuditView, CustomConfigAuditView }