aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/activitypub')
-rw-r--r--server/helpers/custom-validators/activitypub/videos.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts
index 702c09842..0362f43ab 100644
--- a/server/helpers/custom-validators/activitypub/videos.ts
+++ b/server/helpers/custom-validators/activitypub/videos.ts
@@ -148,22 +148,25 @@ function setRemoteVideoTruncatedContent (video: any) {
148} 148}
149 149
150function isRemoteVideoUrlValid (url: any) { 150function isRemoteVideoUrlValid (url: any) {
151 // FIXME: Old bug, we used the width to represent the resolution. Remove it in a few realease (currently beta.11)
152 if (url.width && !url.height) url.height = url.width
153
151 return url.type === 'Link' && 154 return url.type === 'Link' &&
152 ( 155 (
153 ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 && 156 ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 &&
154 isActivityPubUrlValid(url.href) && 157 isActivityPubUrlValid(url.href) &&
155 validator.isInt(url.width + '', { min: 0 }) && 158 validator.isInt(url.height + '', { min: 0 }) &&
156 validator.isInt(url.size + '', { min: 0 }) && 159 validator.isInt(url.size + '', { min: 0 }) &&
157 (!url.fps || validator.isInt(url.fps + '', { min: 0 })) 160 (!url.fps || validator.isInt(url.fps + '', { min: 0 }))
158 ) || 161 ) ||
159 ( 162 (
160 ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 && 163 ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 &&
161 isActivityPubUrlValid(url.href) && 164 isActivityPubUrlValid(url.href) &&
162 validator.isInt(url.width + '', { min: 0 }) 165 validator.isInt(url.height + '', { min: 0 })
163 ) || 166 ) ||
164 ( 167 (
165 ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 && 168 ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 &&
166 validator.isLength(url.href, { min: 5 }) && 169 validator.isLength(url.href, { min: 5 }) &&
167 validator.isInt(url.width + '', { min: 0 }) 170 validator.isInt(url.height + '', { min: 0 })
168 ) 171 )
169} 172}