From af4ae64f6faf38f8179f2e07d3cd4ad60006be92 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 2 Nov 2020 15:43:44 +0100 Subject: Begin live tests --- server/helpers/custom-validators/activitypub/videos.ts | 2 +- server/helpers/middlewares/videos.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 7ff551ecd..cb385b07d 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -63,6 +63,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { if (!isBooleanValid(video.downloadEnabled)) video.downloadEnabled = true if (!isBooleanValid(video.commentsEnabled)) video.commentsEnabled = false if (!isBooleanValid(video.isLiveBroadcast)) video.isLiveBroadcast = false + if (!isBooleanValid(video.liveSaveReplay)) video.liveSaveReplay = false return isActivityPubUrlValid(video.id) && isVideoNameValid(video.name) && @@ -79,7 +80,6 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { isDateValid(video.updated) && (!video.originallyPublishedAt || isDateValid(video.originallyPublishedAt)) && (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) && - video.url.length !== 0 && video.attributedTo.length !== 0 } diff --git a/server/helpers/middlewares/videos.ts b/server/helpers/middlewares/videos.ts index 77a48a467..3904f762a 100644 --- a/server/helpers/middlewares/videos.ts +++ b/server/helpers/middlewares/videos.ts @@ -92,9 +92,9 @@ async function doesVideoChannelOfAccountExist (channelId: number, user: MUserAcc return true } -function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRight, res: Response) { +function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRight, res: Response, onlyOwned = true) { // Retrieve the user who did the request - if (video.isOwned() === false) { + if (onlyOwned && video.isOwned() === false) { res.status(403) .json({ error: 'Cannot manage a video of another server.' }) .end() -- cgit v1.2.3