diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub')
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index d8986b2a0..8ec7df49a 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -49,9 +49,9 @@ function isVideoTorrentObjectValid (video: any) { | |||
49 | isActivityPubVideoDurationValid(video.duration) && | 49 | isActivityPubVideoDurationValid(video.duration) && |
50 | isUUIDValid(video.uuid) && | 50 | isUUIDValid(video.uuid) && |
51 | setValidRemoteTags(video) && | 51 | setValidRemoteTags(video) && |
52 | (!video.category || isRemoteIdentifierValid(video.category)) && | 52 | (!video.category || isRemoteNumberIdentifierValid(video.category)) && |
53 | (!video.licence || isRemoteIdentifierValid(video.licence)) && | 53 | (!video.licence || isRemoteNumberIdentifierValid(video.licence)) && |
54 | (!video.language || isRemoteIdentifierValid(video.language)) && | 54 | (!video.language || isRemoteStringIdentifierValid(video.language)) && |
55 | isVideoViewsValid(video.views) && | 55 | isVideoViewsValid(video.views) && |
56 | isBooleanValid(video.sensitive) && | 56 | isBooleanValid(video.sensitive) && |
57 | isBooleanValid(video.commentsEnabled) && | 57 | isBooleanValid(video.commentsEnabled) && |
@@ -72,6 +72,7 @@ export { | |||
72 | isVideoTorrentCreateActivityValid, | 72 | isVideoTorrentCreateActivityValid, |
73 | isVideoTorrentUpdateActivityValid, | 73 | isVideoTorrentUpdateActivityValid, |
74 | isVideoTorrentDeleteActivityValid, | 74 | isVideoTorrentDeleteActivityValid, |
75 | isRemoteStringIdentifierValid, | ||
75 | isVideoFlagValid, | 76 | isVideoFlagValid, |
76 | isVideoTorrentObjectValid | 77 | isVideoTorrentObjectValid |
77 | } | 78 | } |
@@ -89,10 +90,14 @@ function setValidRemoteTags (video: any) { | |||
89 | return true | 90 | return true |
90 | } | 91 | } |
91 | 92 | ||
92 | function isRemoteIdentifierValid (data: any) { | 93 | function isRemoteNumberIdentifierValid (data: any) { |
93 | return validator.isInt(data.identifier, { min: 0 }) | 94 | return validator.isInt(data.identifier, { min: 0 }) |
94 | } | 95 | } |
95 | 96 | ||
97 | function isRemoteStringIdentifierValid (data: any) { | ||
98 | return typeof data.identifier === 'string' | ||
99 | } | ||
100 | |||
96 | function isRemoteVideoContentValid (mediaType: string, content: string) { | 101 | function isRemoteVideoContentValid (mediaType: string, content: string) { |
97 | return mediaType === 'text/markdown' && isVideoTruncatedDescriptionValid(content) | 102 | return mediaType === 'text/markdown' && isVideoTruncatedDescriptionValid(content) |
98 | } | 103 | } |