diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 2ed2988f5..b485e5fcf 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -10,10 +10,10 @@ import { | |||
10 | isVideoTruncatedDescriptionValid, | 10 | isVideoTruncatedDescriptionValid, |
11 | isVideoViewsValid | 11 | isVideoViewsValid |
12 | } from '../videos' | 12 | } from '../videos' |
13 | import { isActivityPubUrlValid, isBaseActivityValid } from './misc' | 13 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' |
14 | 14 | ||
15 | function isVideoTorrentAddActivityValid (activity: any) { | 15 | function isVideoTorrentCreateActivityValid (activity: any) { |
16 | return isBaseActivityValid(activity, 'Add') && | 16 | return isBaseActivityValid(activity, 'Create') && |
17 | isVideoTorrentObjectValid(activity.object) | 17 | isVideoTorrentObjectValid(activity.object) |
18 | } | 18 | } |
19 | 19 | ||
@@ -43,6 +43,8 @@ function isActivityPubVideoDurationValid (value: string) { | |||
43 | } | 43 | } |
44 | 44 | ||
45 | function isVideoTorrentObjectValid (video: any) { | 45 | function isVideoTorrentObjectValid (video: any) { |
46 | console.log(video) | ||
47 | |||
46 | return video.type === 'Video' && | 48 | return video.type === 'Video' && |
47 | isActivityPubUrlValid(video.id) && | 49 | isActivityPubUrlValid(video.id) && |
48 | isVideoNameValid(video.name) && | 50 | isVideoNameValid(video.name) && |
@@ -59,13 +61,15 @@ function isVideoTorrentObjectValid (video: any) { | |||
59 | (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) && | 61 | (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) && |
60 | isRemoteVideoIconValid(video.icon) && | 62 | isRemoteVideoIconValid(video.icon) && |
61 | setValidRemoteVideoUrls(video) && | 63 | setValidRemoteVideoUrls(video) && |
62 | video.url.length !== 0 | 64 | video.url.length !== 0 && |
65 | setValidAttributedTo(video) && | ||
66 | video.attributedTo.length !== 0 | ||
63 | } | 67 | } |
64 | 68 | ||
65 | // --------------------------------------------------------------------------- | 69 | // --------------------------------------------------------------------------- |
66 | 70 | ||
67 | export { | 71 | export { |
68 | isVideoTorrentAddActivityValid, | 72 | isVideoTorrentCreateActivityValid, |
69 | isVideoTorrentUpdateActivityValid, | 73 | isVideoTorrentUpdateActivityValid, |
70 | isVideoTorrentDeleteActivityValid, | 74 | isVideoTorrentDeleteActivityValid, |
71 | isVideoFlagValid | 75 | isVideoFlagValid |