aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/activitypub/activity.ts10
-rw-r--r--server/helpers/custom-validators/activitypub/actor.ts5
2 files changed, 14 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts
index 577cf4b52..632f14223 100644
--- a/server/helpers/custom-validators/activitypub/activity.ts
+++ b/server/helpers/custom-validators/activitypub/activity.ts
@@ -1,6 +1,9 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { Activity, ActivityType } from '../../../../shared/models/activitypub' 2import { Activity, ActivityType } from '../../../../shared/models/activitypub'
3import { isActorAcceptActivityValid, isActorDeleteActivityValid, isActorFollowActivityValid, isActorUpdateActivityValid } from './actor' 3import {
4 isActorAcceptActivityValid, isActorDeleteActivityValid, isActorFollowActivityValid, isActorRejectActivityValid,
5 isActorUpdateActivityValid
6} from './actor'
4import { isAnnounceActivityValid } from './announce' 7import { isAnnounceActivityValid } from './announce'
5import { isActivityPubUrlValid } from './misc' 8import { isActivityPubUrlValid } from './misc'
6import { isDislikeActivityValid, isLikeActivityValid } from './rate' 9import { isDislikeActivityValid, isLikeActivityValid } from './rate'
@@ -33,6 +36,7 @@ const activityCheckers: { [ P in ActivityType ]: (activity: Activity) => boolean
33 Delete: checkDeleteActivity, 36 Delete: checkDeleteActivity,
34 Follow: checkFollowActivity, 37 Follow: checkFollowActivity,
35 Accept: checkAcceptActivity, 38 Accept: checkAcceptActivity,
39 Reject: checkRejectActivity,
36 Announce: checkAnnounceActivity, 40 Announce: checkAnnounceActivity,
37 Undo: checkUndoActivity, 41 Undo: checkUndoActivity,
38 Like: checkLikeActivity 42 Like: checkLikeActivity
@@ -82,6 +86,10 @@ function checkAcceptActivity (activity: any) {
82 return isActorAcceptActivityValid(activity) 86 return isActorAcceptActivityValid(activity)
83} 87}
84 88
89function checkRejectActivity (activity: any) {
90 return isActorRejectActivityValid(activity)
91}
92
85function checkAnnounceActivity (activity: any) { 93function checkAnnounceActivity (activity: any) {
86 return isAnnounceActivityValid(activity) 94 return isAnnounceActivityValid(activity)
87} 95}
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts
index e1a4b5b8f..df0edc30e 100644
--- a/server/helpers/custom-validators/activitypub/actor.ts
+++ b/server/helpers/custom-validators/activitypub/actor.ts
@@ -78,6 +78,10 @@ function isActorAcceptActivityValid (activity: any) {
78 return isBaseActivityValid(activity, 'Accept') 78 return isBaseActivityValid(activity, 'Accept')
79} 79}
80 80
81function isActorRejectActivityValid (activity: any) {
82 return isBaseActivityValid(activity, 'Reject')
83}
84
81function isActorUpdateActivityValid (activity: any) { 85function isActorUpdateActivityValid (activity: any) {
82 return isBaseActivityValid(activity, 'Update') && 86 return isBaseActivityValid(activity, 'Update') &&
83 isActorObjectValid(activity.object) 87 isActorObjectValid(activity.object)
@@ -97,6 +101,7 @@ export {
97 isActorFollowersCountValid, 101 isActorFollowersCountValid,
98 isActorFollowActivityValid, 102 isActorFollowActivityValid,
99 isActorAcceptActivityValid, 103 isActorAcceptActivityValid,
104 isActorRejectActivityValid,
100 isActorDeleteActivityValid, 105 isActorDeleteActivityValid,
101 isActorUpdateActivityValid 106 isActorUpdateActivityValid
102} 107}