mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Implement captions/subtitles
This commit is contained in:
@@ -51,6 +51,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) {
|
||||
if (!setValidRemoteVideoUrls(video)) return false
|
||||
if (!setRemoteVideoTruncatedContent(video)) return false
|
||||
if (!setValidAttributedTo(video)) return false
|
||||
if (!setValidRemoteCaptions(video)) return false
|
||||
|
||||
// Default attributes
|
||||
if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED
|
||||
@@ -98,6 +99,18 @@ function setValidRemoteTags (video: any) {
|
||||
return true
|
||||
}
|
||||
|
||||
function setValidRemoteCaptions (video: any) {
|
||||
if (!video.subtitleLanguage) video.subtitleLanguage = []
|
||||
|
||||
if (Array.isArray(video.subtitleLanguage) === false) return false
|
||||
|
||||
video.subtitleLanguage = video.subtitleLanguage.filter(caption => {
|
||||
return isRemoteStringIdentifierValid(caption)
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function isRemoteNumberIdentifierValid (data: any) {
|
||||
return validator.isInt(data.identifier, { min: 0 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user