diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub/activity.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/activity.ts | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts index 8b8c0685f..da79b2782 100644 --- a/server/helpers/custom-validators/activitypub/activity.ts +++ b/server/helpers/custom-validators/activitypub/activity.ts | |||
@@ -1,15 +1,16 @@ | |||
1 | import validator from 'validator' | 1 | import validator from 'validator' |
2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' | 2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' |
3 | import { exists } from '../misc' | ||
3 | import { sanitizeAndCheckActorObject } from './actor' | 4 | import { sanitizeAndCheckActorObject } from './actor' |
5 | import { isCacheFileObjectValid } from './cache-file' | ||
6 | import { isFlagActivityValid } from './flag' | ||
4 | import { isActivityPubUrlValid, isBaseActivityValid, isObjectValid } from './misc' | 7 | import { isActivityPubUrlValid, isBaseActivityValid, isObjectValid } from './misc' |
5 | import { isDislikeActivityValid } from './rate' | 8 | import { isPlaylistObjectValid } from './playlist' |
9 | import { isDislikeActivityValid, isLikeActivityValid } from './rate' | ||
10 | import { isShareActivityValid } from './share' | ||
6 | import { sanitizeAndCheckVideoCommentObject } from './video-comments' | 11 | import { sanitizeAndCheckVideoCommentObject } from './video-comments' |
7 | import { sanitizeAndCheckVideoTorrentObject } from './videos' | 12 | import { sanitizeAndCheckVideoTorrentObject } from './videos' |
8 | import { isViewActivityValid } from './view' | 13 | import { isViewActivityValid } from './view' |
9 | import { exists } from '../misc' | ||
10 | import { isCacheFileObjectValid } from './cache-file' | ||
11 | import { isFlagActivityValid } from './flag' | ||
12 | import { isPlaylistObjectValid } from './playlist' | ||
13 | 14 | ||
14 | function isRootActivityValid (activity: any) { | 15 | function isRootActivityValid (activity: any) { |
15 | return isCollection(activity) || isActivity(activity) | 16 | return isCollection(activity) || isActivity(activity) |
@@ -70,8 +71,11 @@ function checkFlagActivity (activity: any) { | |||
70 | } | 71 | } |
71 | 72 | ||
72 | function checkDislikeActivity (activity: any) { | 73 | function checkDislikeActivity (activity: any) { |
73 | return isBaseActivityValid(activity, 'Dislike') && | 74 | return isDislikeActivityValid(activity) |
74 | isDislikeActivityValid(activity) | 75 | } |
76 | |||
77 | function checkLikeActivity (activity: any) { | ||
78 | return isLikeActivityValid(activity) | ||
75 | } | 79 | } |
76 | 80 | ||
77 | function checkCreateActivity (activity: any) { | 81 | function checkCreateActivity (activity: any) { |
@@ -118,8 +122,7 @@ function checkRejectActivity (activity: any) { | |||
118 | } | 122 | } |
119 | 123 | ||
120 | function checkAnnounceActivity (activity: any) { | 124 | function checkAnnounceActivity (activity: any) { |
121 | return isBaseActivityValid(activity, 'Announce') && | 125 | return isShareActivityValid(activity) |
122 | isObjectValid(activity.object) | ||
123 | } | 126 | } |
124 | 127 | ||
125 | function checkUndoActivity (activity: any) { | 128 | function checkUndoActivity (activity: any) { |
@@ -132,8 +135,3 @@ function checkUndoActivity (activity: any) { | |||
132 | checkCreateActivity(activity.object) | 135 | checkCreateActivity(activity.object) |
133 | ) | 136 | ) |
134 | } | 137 | } |
135 | |||
136 | function checkLikeActivity (activity: any) { | ||
137 | return isBaseActivityValid(activity, 'Like') && | ||
138 | isObjectValid(activity.object) | ||
139 | } | ||