diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub/activity.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/activity.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts index 381a29e66..2562ead9b 100644 --- a/server/helpers/custom-validators/activitypub/activity.ts +++ b/server/helpers/custom-validators/activitypub/activity.ts | |||
@@ -1,7 +1,10 @@ | |||
1 | import * as validator from 'validator' | 1 | import * as validator from 'validator' |
2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' | 2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' |
3 | import { | 3 | import { |
4 | isActorAcceptActivityValid, isActorDeleteActivityValid, isActorFollowActivityValid, isActorRejectActivityValid, | 4 | isActorAcceptActivityValid, |
5 | isActorDeleteActivityValid, | ||
6 | isActorFollowActivityValid, | ||
7 | isActorRejectActivityValid, | ||
5 | isActorUpdateActivityValid | 8 | isActorUpdateActivityValid |
6 | } from './actor' | 9 | } from './actor' |
7 | import { isAnnounceActivityValid } from './announce' | 10 | import { isAnnounceActivityValid } from './announce' |
@@ -11,12 +14,13 @@ import { isUndoActivityValid } from './undo' | |||
11 | import { isVideoCommentCreateActivityValid, isVideoCommentDeleteActivityValid } from './video-comments' | 14 | import { isVideoCommentCreateActivityValid, isVideoCommentDeleteActivityValid } from './video-comments' |
12 | import { | 15 | import { |
13 | isVideoFlagValid, | 16 | isVideoFlagValid, |
14 | sanitizeAndCheckVideoTorrentCreateActivity, | ||
15 | isVideoTorrentDeleteActivityValid, | 17 | isVideoTorrentDeleteActivityValid, |
18 | sanitizeAndCheckVideoTorrentCreateActivity, | ||
16 | sanitizeAndCheckVideoTorrentUpdateActivity | 19 | sanitizeAndCheckVideoTorrentUpdateActivity |
17 | } from './videos' | 20 | } from './videos' |
18 | import { isViewActivityValid } from './view' | 21 | import { isViewActivityValid } from './view' |
19 | import { exists } from '../misc' | 22 | import { exists } from '../misc' |
23 | import { isCacheFileCreateActivityValid, isCacheFileUpdateActivityValid } from './cache-file' | ||
20 | 24 | ||
21 | function isRootActivityValid (activity: any) { | 25 | function isRootActivityValid (activity: any) { |
22 | return Array.isArray(activity['@context']) && ( | 26 | return Array.isArray(activity['@context']) && ( |
@@ -67,11 +71,13 @@ function checkCreateActivity (activity: any) { | |||
67 | isDislikeActivityValid(activity) || | 71 | isDislikeActivityValid(activity) || |
68 | sanitizeAndCheckVideoTorrentCreateActivity(activity) || | 72 | sanitizeAndCheckVideoTorrentCreateActivity(activity) || |
69 | isVideoFlagValid(activity) || | 73 | isVideoFlagValid(activity) || |
70 | isVideoCommentCreateActivityValid(activity) | 74 | isVideoCommentCreateActivityValid(activity) || |
75 | isCacheFileCreateActivityValid(activity) | ||
71 | } | 76 | } |
72 | 77 | ||
73 | function checkUpdateActivity (activity: any) { | 78 | function checkUpdateActivity (activity: any) { |
74 | return sanitizeAndCheckVideoTorrentUpdateActivity(activity) || | 79 | return isCacheFileUpdateActivityValid(activity) || |
80 | sanitizeAndCheckVideoTorrentUpdateActivity(activity) || | ||
75 | isActorUpdateActivityValid(activity) | 81 | isActorUpdateActivityValid(activity) |
76 | } | 82 | } |
77 | 83 | ||