diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 37c90a0c8..d97bbd2a9 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -51,6 +51,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { | |||
51 | if (!setValidRemoteVideoUrls(video)) return false | 51 | if (!setValidRemoteVideoUrls(video)) return false |
52 | if (!setRemoteVideoTruncatedContent(video)) return false | 52 | if (!setRemoteVideoTruncatedContent(video)) return false |
53 | if (!setValidAttributedTo(video)) return false | 53 | if (!setValidAttributedTo(video)) return false |
54 | if (!setValidRemoteCaptions(video)) return false | ||
54 | 55 | ||
55 | // Default attributes | 56 | // Default attributes |
56 | if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED | 57 | if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED |
@@ -98,6 +99,18 @@ function setValidRemoteTags (video: any) { | |||
98 | return true | 99 | return true |
99 | } | 100 | } |
100 | 101 | ||
102 | function setValidRemoteCaptions (video: any) { | ||
103 | if (!video.subtitleLanguage) video.subtitleLanguage = [] | ||
104 | |||
105 | if (Array.isArray(video.subtitleLanguage) === false) return false | ||
106 | |||
107 | video.subtitleLanguage = video.subtitleLanguage.filter(caption => { | ||
108 | return isRemoteStringIdentifierValid(caption) | ||
109 | }) | ||
110 | |||
111 | return true | ||
112 | } | ||
113 | |||
101 | function isRemoteNumberIdentifierValid (data: any) { | 114 | function isRemoteNumberIdentifierValid (data: any) { |
102 | return validator.isInt(data.identifier, { min: 0 }) | 115 | return validator.isInt(data.identifier, { min: 0 }) |
103 | } | 116 | } |