aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/services.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-17 10:35:27 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-17 10:35:27 +0200
commit164174a6abac3e391e95d479a98749e20eb86f34 (patch)
tree9fac6566299af7b86798cd07e181d269808eacbd /server/controllers/services.ts
parent4b5dc9f1e452723503a3ef07405f80c793d7b5f7 (diff)
downloadPeerTube-164174a6abac3e391e95d479a98749e20eb86f34.tar.gz
PeerTube-164174a6abac3e391e95d479a98749e20eb86f34.tar.zst
PeerTube-164174a6abac3e391e95d479a98749e20eb86f34.zip
Use preview instead of thumbnail for oembed
Diffstat (limited to 'server/controllers/services.ts')
-rw-r--r--server/controllers/services.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index 3ce6bd526..4bbe56a8a 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2 2
3import { CONFIG, THUMBNAILS_SIZE } from '../initializers' 3import { CONFIG, PREVIEWS_SIZE, EMBED_SIZE } from '../initializers'
4import { oembedValidator } from '../middlewares' 4import { oembedValidator } from '../middlewares'
5import { VideoInstance } from '../models' 5import { VideoInstance } from '../models'
6 6
@@ -23,17 +23,17 @@ function generateOEmbed (req: express.Request, res: express.Response, next: expr
23 const maxWidth = parseInt(req.query.maxwidth, 10) 23 const maxWidth = parseInt(req.query.maxwidth, 10)
24 24
25 const embedUrl = webserverUrl + video.getEmbedPath() 25 const embedUrl = webserverUrl + video.getEmbedPath()
26 let thumbnailUrl = webserverUrl + video.getThumbnailPath() 26 let thumbnailUrl = webserverUrl + video.getPreviewPath()
27 let embedWidth = 560 27 let embedWidth = EMBED_SIZE.width
28 let embedHeight = 315 28 let embedHeight = EMBED_SIZE.height
29 29
30 if (maxHeight < embedHeight) embedHeight = maxHeight 30 if (maxHeight < embedHeight) embedHeight = maxHeight
31 if (maxWidth < embedWidth) embedWidth = maxWidth 31 if (maxWidth < embedWidth) embedWidth = maxWidth
32 32
33 // Our thumbnail is too big for the consumer 33 // Our thumbnail is too big for the consumer
34 if ( 34 if (
35 (maxHeight !== undefined && maxHeight < THUMBNAILS_SIZE.height) || 35 (maxHeight !== undefined && maxHeight < PREVIEWS_SIZE.height) ||
36 (maxWidth !== undefined && maxWidth < THUMBNAILS_SIZE.width) 36 (maxWidth !== undefined && maxWidth < PREVIEWS_SIZE.width)
37 ) { 37 ) {
38 thumbnailUrl = undefined 38 thumbnailUrl = undefined
39 } 39 }
@@ -54,8 +54,8 @@ function generateOEmbed (req: express.Request, res: express.Response, next: expr
54 54
55 if (thumbnailUrl !== undefined) { 55 if (thumbnailUrl !== undefined) {
56 json.thumbnail_url = thumbnailUrl 56 json.thumbnail_url = thumbnailUrl
57 json.thumbnail_width = THUMBNAILS_SIZE.width 57 json.thumbnail_width = PREVIEWS_SIZE.width
58 json.thumbnail_height = THUMBNAILS_SIZE.height 58 json.thumbnail_height = PREVIEWS_SIZE.height
59 } 59 }
60 60
61 return res.json(json) 61 return res.json(json)