aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/client-html.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-20 16:24:31 +0200
committerGitHub <noreply@github.com>2018-09-20 16:24:31 +0200
commit0491173a61aed66205c017e0d7e0503ea316c144 (patch)
treece6621597505f9518cfdf0981977d097c63f9fad /server/lib/client-html.ts
parent8704acf49efc770d73bf07c10468ed8c74d28a83 (diff)
parent6247b2057b792cea155a1abd9788c363ae7d2cc2 (diff)
downloadPeerTube-0491173a61aed66205c017e0d7e0503ea316c144.tar.gz
PeerTube-0491173a61aed66205c017e0d7e0503ea316c144.tar.zst
PeerTube-0491173a61aed66205c017e0d7e0503ea316c144.zip
Merge branch 'develop' into cli-wrapper
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r--server/lib/client-html.ts9
1 files changed, 4 insertions, 5 deletions
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'
8import * as validator from 'validator' 8import * as validator from 'validator'
9import { VideoPrivacy } from '../../shared/models/videos' 9import { VideoPrivacy } from '../../shared/models/videos'
10import { readFile } from 'fs-extra' 10import { readFile } from 'fs-extra'
11import { getActivityStreamDuration } from '../models/video/video-format-utils'
11 12
12export class ClientHtml { 13export class ClientHtml {
13 14
@@ -38,10 +39,8 @@ export class ClientHtml {
38 let videoPromise: Bluebird<VideoModel> 39 let videoPromise: Bluebird<VideoModel>
39 40
40 // Let Angular application handle errors 41 // Let Angular application handle errors
41 if (validator.isUUID(videoId, 4)) { 42 if (validator.isInt(videoId) || validator.isUUID(videoId, 4)) {
42 videoPromise = VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) 43 videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
43 } else if (validator.isInt(videoId)) {
44 videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(+videoId)
45 } else { 44 } else {
46 return ClientHtml.getIndexHTML(req, res) 45 return ClientHtml.getIndexHTML(req, res)
47 } 46 }
@@ -150,7 +149,7 @@ export class ClientHtml {
150 description: videoDescriptionEscaped, 149 description: videoDescriptionEscaped,
151 thumbnailUrl: previewUrl, 150 thumbnailUrl: previewUrl,
152 uploadDate: video.createdAt.toISOString(), 151 uploadDate: video.createdAt.toISOString(),
153 duration: video.getActivityStreamDuration(), 152 duration: getActivityStreamDuration(video.duration),
154 contentUrl: videoUrl, 153 contentUrl: videoUrl,
155 embedUrl: embedUrl, 154 embedUrl: embedUrl,
156 interactionCount: video.views 155 interactionCount: video.views