diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-12 20:04:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-12 20:37:51 +0200 |
commit | 2186386cca113506791583cb07d6ccacba7af4e0 (patch) | |
tree | 3c214c0b5fbd64332624267fa6e51fd4a9cf6474 /server/helpers/custom-validators/activitypub | |
parent | 6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf (diff) | |
download | PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.gz PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.zst PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.zip |
Add concept of video state, and add ability to wait transcoding before
publishing a video
Diffstat (limited to 'server/helpers/custom-validators/activitypub')
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 7e1d57c34..37c90a0c8 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -6,11 +6,13 @@ import { | |||
6 | isVideoAbuseReasonValid, | 6 | isVideoAbuseReasonValid, |
7 | isVideoDurationValid, | 7 | isVideoDurationValid, |
8 | isVideoNameValid, | 8 | isVideoNameValid, |
9 | isVideoStateValid, | ||
9 | isVideoTagValid, | 10 | isVideoTagValid, |
10 | isVideoTruncatedDescriptionValid, | 11 | isVideoTruncatedDescriptionValid, |
11 | isVideoViewsValid | 12 | isVideoViewsValid |
12 | } from '../videos' | 13 | } from '../videos' |
13 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' | 14 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' |
15 | import { VideoState } from '../../../../shared/models/videos' | ||
14 | 16 | ||
15 | function sanitizeAndCheckVideoTorrentCreateActivity (activity: any) { | 17 | function sanitizeAndCheckVideoTorrentCreateActivity (activity: any) { |
16 | return isBaseActivityValid(activity, 'Create') && | 18 | return isBaseActivityValid(activity, 'Create') && |
@@ -50,6 +52,10 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { | |||
50 | if (!setRemoteVideoTruncatedContent(video)) return false | 52 | if (!setRemoteVideoTruncatedContent(video)) return false |
51 | if (!setValidAttributedTo(video)) return false | 53 | if (!setValidAttributedTo(video)) return false |
52 | 54 | ||
55 | // Default attributes | ||
56 | if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED | ||
57 | if (!isBooleanValid(video.waitTranscoding)) video.waitTranscoding = false | ||
58 | |||
53 | return isActivityPubUrlValid(video.id) && | 59 | return isActivityPubUrlValid(video.id) && |
54 | isVideoNameValid(video.name) && | 60 | isVideoNameValid(video.name) && |
55 | isActivityPubVideoDurationValid(video.duration) && | 61 | isActivityPubVideoDurationValid(video.duration) && |