diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub/video-channels.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/video-channels.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/activitypub/video-channels.ts b/server/helpers/custom-validators/activitypub/video-channels.ts new file mode 100644 index 000000000..9fd3bb149 --- /dev/null +++ b/server/helpers/custom-validators/activitypub/video-channels.ts | |||
@@ -0,0 +1,36 @@ | |||
1 | import { isDateValid, isUUIDValid } from '../misc' | ||
2 | import { isVideoChannelDescriptionValid, isVideoChannelNameValid } from '../video-channels' | ||
3 | import { isActivityPubUrlValid, isBaseActivityValid } from './misc' | ||
4 | |||
5 | function isVideoChannelCreateActivityValid (activity: any) { | ||
6 | return isBaseActivityValid(activity, 'Create') && | ||
7 | isVideoChannelObjectValid(activity.object) | ||
8 | } | ||
9 | |||
10 | function isVideoChannelUpdateActivityValid (activity: any) { | ||
11 | return isBaseActivityValid(activity, 'Update') && | ||
12 | isVideoChannelObjectValid(activity.object) | ||
13 | } | ||
14 | |||
15 | function isVideoChannelDeleteActivityValid (activity: any) { | ||
16 | return isBaseActivityValid(activity, 'Delete') | ||
17 | } | ||
18 | |||
19 | function isVideoChannelObjectValid (videoChannel: any) { | ||
20 | return videoChannel.type === 'VideoChannel' && | ||
21 | isActivityPubUrlValid(videoChannel.id) && | ||
22 | isVideoChannelNameValid(videoChannel.name) && | ||
23 | isVideoChannelDescriptionValid(videoChannel.content) && | ||
24 | isDateValid(videoChannel.published) && | ||
25 | isDateValid(videoChannel.updated) && | ||
26 | isUUIDValid(videoChannel.uuid) | ||
27 | } | ||
28 | |||
29 | // --------------------------------------------------------------------------- | ||
30 | |||
31 | export { | ||
32 | isVideoChannelCreateActivityValid, | ||
33 | isVideoChannelUpdateActivityValid, | ||
34 | isVideoChannelDeleteActivityValid, | ||
35 | isVideoChannelObjectValid | ||
36 | } | ||