From f713f36bdf6f696ab0fe8a309035a09e864a48ca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Nov 2022 12:06:31 +0100 Subject: Federate entire description Introduce an explicit field truncatedDescription description in video list is deprecated description in video get will contain the entire description --- server/helpers/custom-validators/activitypub/videos.ts | 10 +++++----- server/helpers/custom-validators/videos.ts | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 2a2f008b9..97b3577af 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -7,11 +7,11 @@ import { peertubeTruncate } from '../../core-utils' import { isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc' import { isLiveLatencyModeValid } from '../video-lives' import { + isVideoDescriptionValid, isVideoDurationValid, isVideoNameValid, isVideoStateValid, isVideoTagValid, - isVideoTruncatedDescriptionValid, isVideoViewsValid } from '../videos' import { isActivityPubUrlValid, isActivityPubVideoDurationValid, isBaseActivityValid, setValidAttributedTo } from './misc' @@ -32,7 +32,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { logger.debug('Video has invalid urls', { video }) return false } - if (!setRemoteVideoTruncatedContent(video)) { + if (!setRemoteVideoContent(video)) { logger.debug('Video has invalid content', { video }) return false } @@ -168,7 +168,7 @@ function isRemoteStringIdentifierValid (data: any) { } function isRemoteVideoContentValid (mediaType: string, content: string) { - return mediaType === 'text/markdown' && isVideoTruncatedDescriptionValid(content) + return mediaType === 'text/markdown' && isVideoDescriptionValid(content) } function setValidRemoteIcon (video: any) { @@ -194,9 +194,9 @@ function setValidRemoteVideoUrls (video: any) { return true } -function setRemoteVideoTruncatedContent (video: any) { +function setRemoteVideoContent (video: any) { if (video.content) { - video.content = peertubeTruncate(video.content, { length: CONSTRAINTS_FIELDS.VIDEOS.TRUNCATED_DESCRIPTION.max }) + video.content = peertubeTruncate(video.content, { length: CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max }) } return true diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 3ebfe2937..9e8177f77 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -45,10 +45,6 @@ function isVideoDurationValid (value: string) { return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION) } -function isVideoTruncatedDescriptionValid (value: string) { - return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.TRUNCATED_DESCRIPTION) -} - function isVideoDescriptionValid (value: string) { return value === null || (exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION)) } @@ -151,7 +147,6 @@ export { isVideoCategoryValid, isVideoLicenceValid, isVideoLanguageValid, - isVideoTruncatedDescriptionValid, isVideoDescriptionValid, isVideoFileInfoHashValid, isVideoNameValid, -- cgit v1.2.3