mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Continue activitypub
This commit is contained in:
parent
e4f97babf7
commit
0d0e8dd090
27 changed files with 1039 additions and 1086 deletions
|
@ -73,19 +73,26 @@ function isVideoDescriptionValid (value: string) {
|
|||
}
|
||||
|
||||
function isVideoDurationValid (value: string) {
|
||||
return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION)
|
||||
// https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration
|
||||
return exists(value) &&
|
||||
typeof value === 'string' &&
|
||||
value.startsWith('PT') &&
|
||||
value.endsWith('S') &&
|
||||
validator.isInt(value.replace(/[^0-9]+/, ''), VIDEOS_CONSTRAINTS_FIELDS.DURATION)
|
||||
}
|
||||
|
||||
function isVideoNameValid (value: string) {
|
||||
return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME)
|
||||
}
|
||||
|
||||
function isVideoTagValid (tag: string) {
|
||||
return exists(tag) && validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)
|
||||
}
|
||||
|
||||
function isVideoTagsValid (tags: string[]) {
|
||||
return isArray(tags) &&
|
||||
validator.isInt(tags.length.toString(), VIDEOS_CONSTRAINTS_FIELDS.TAGS) &&
|
||||
tags.every(tag => {
|
||||
return exists(tag) && validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)
|
||||
})
|
||||
tags.every(tag => isVideoTagValid(tag))
|
||||
}
|
||||
|
||||
function isVideoThumbnailValid (value: string) {
|
||||
|
@ -209,6 +216,7 @@ export {
|
|||
isRemoteVideoPrivacyValid,
|
||||
isVideoFileResolutionValid,
|
||||
checkVideoExists,
|
||||
isVideoTagValid,
|
||||
isRemoteVideoCategoryValid,
|
||||
isRemoteVideoLicenceValid,
|
||||
isRemoteVideoLanguageValid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue