X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fclient-html.ts;h=fc013e0c3bc2601af26d7cf7e171886c62c9ba44;hb=ecf3f060ef8e40846ee41c9dcdf288065f4c461d;hp=a69e09c32d8df849487d1768b5ed5ac7b9b63152;hpb=62689b942b71cd1dd0d050c6ed05f884a0b325c2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index a69e09c32..fc013e0c3 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -8,6 +8,7 @@ import { VideoModel } from '../models/video/video' import * as validator from 'validator' import { VideoPrivacy } from '../../shared/models/videos' import { readFile } from 'fs-extra' +import { getActivityStreamDuration } from '../models/video/video-format-utils' export class ClientHtml { @@ -38,10 +39,8 @@ export class ClientHtml { let videoPromise: Bluebird // Let Angular application handle errors - if (validator.isUUID(videoId, 4)) { - videoPromise = VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) - } else if (validator.isInt(videoId)) { - videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(+videoId) + if (validator.isInt(videoId) || validator.isUUID(videoId, 4)) { + videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) } else { return ClientHtml.getIndexHTML(req, res) } @@ -150,7 +149,7 @@ export class ClientHtml { description: videoDescriptionEscaped, thumbnailUrl: previewUrl, uploadDate: video.createdAt.toISOString(), - duration: video.getActivityStreamDuration(), + duration: getActivityStreamDuration(video.duration), contentUrl: videoUrl, embedUrl: embedUrl, interactionCount: video.views