X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideos.ts;h=dd04aa5f65c4346aac6fa04d44efd2d72bb9d37b;hb=92bf2f62995bbaa0402cb4657473ad8d5b6fcf8d;hp=95e256b8fb9e8fdbe72959651dade5e7fdac58bd;hpb=307902e2b3248073aeb677e420aafd8b5e041117;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 95e256b8f..dd04aa5f6 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -13,7 +13,7 @@ import { VIDEO_STATES } from '../../initializers' import { VideoModel } from '../../models/video/video' -import { exists, isArray, isFileValid } from './misc' +import { exists, isArray, isDateValid, isFileValid } from './misc' import { VideoChannelModel } from '../../models/video/video-channel' import { UserModel } from '../../models/account/user' import * as magnetUtil from 'magnet-uri' @@ -115,6 +115,10 @@ function isScheduleVideoUpdatePrivacyValid (value: number) { ) } +function isVideoOriginallyPublishedAtValid (value: string | null) { + return value === null || isDateValid(value) +} + function isVideoFileInfoHashValid (value: string | null | undefined) { return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH) } @@ -220,6 +224,7 @@ export { isVideoTagsValid, isVideoFPSResolutionValid, isScheduleVideoUpdatePrivacyValid, + isVideoOriginallyPublishedAtValid, isVideoFile, isVideoMagnetUriValid, isVideoStateValid,