mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Use global uuid instead of remoteId for videos
This commit is contained in:
parent
e6d4b0ff24
commit
0a6658fdcb
58 changed files with 450 additions and 176 deletions
|
@ -78,7 +78,7 @@ function addOpenGraphTags (htmlStringPage: string, video: VideoInstance) {
|
|||
}
|
||||
|
||||
let tagsString = ''
|
||||
Object.keys(metaTags).forEach(function (tagName) {
|
||||
Object.keys(metaTags).forEach(tagName => {
|
||||
const tagValue = metaTags[tagName]
|
||||
|
||||
tagsString += '<meta property="' + tagName + '" content="' + tagValue + '" />'
|
||||
|
@ -89,13 +89,20 @@ function addOpenGraphTags (htmlStringPage: string, video: VideoInstance) {
|
|||
|
||||
function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const videoId = '' + req.params.id
|
||||
let videoPromise: Promise<VideoInstance>
|
||||
|
||||
// Let Angular application handle errors
|
||||
if (!validator.isUUID(videoId, 4)) return res.sendFile(indexPath)
|
||||
if (validator.isUUID(videoId, 4)) {
|
||||
videoPromise = db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(videoId)
|
||||
} else if (validator.isInt(videoId)) {
|
||||
videoPromise = db.Video.loadAndPopulateAuthorAndPodAndTags(+videoId)
|
||||
} else {
|
||||
return res.sendFile(indexPath)
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
readFileBufferPromise(indexPath),
|
||||
db.Video.loadAndPopulateAuthorAndPodAndTags(videoId)
|
||||
videoPromise
|
||||
])
|
||||
.then(([ file, video ]) => {
|
||||
file = file as Buffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue