mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Add shares forward and collection on videos/video channels
This commit is contained in:
parent
74bb2cb834
commit
4e50b6a1c9
29 changed files with 546 additions and 133 deletions
|
@ -130,6 +130,27 @@ function checkVideoExists (id: string, res: Response, callback: () => void) {
|
|||
})
|
||||
}
|
||||
|
||||
async function isVideoExistsPromise (id: string, res: Response) {
|
||||
let video: VideoInstance
|
||||
|
||||
if (validator.isInt(id)) {
|
||||
video = await db.Video.loadAndPopulateAccountAndServerAndTags(+id)
|
||||
} else { // UUID
|
||||
video = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(id)
|
||||
}
|
||||
|
||||
if (!video) {
|
||||
res.status(404)
|
||||
.json({ error: 'Video not found' })
|
||||
.end()
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
res.locals.video = video
|
||||
return true
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
|
@ -152,5 +173,6 @@ export {
|
|||
isVideoPrivacyValid,
|
||||
isVideoFileResolutionValid,
|
||||
isVideoFileSizeValid,
|
||||
checkVideoExists
|
||||
checkVideoExists,
|
||||
isVideoExistsPromise
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue