diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/services.ts | 16 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | 2 | ||
3 | import { CONFIG, THUMBNAILS_SIZE } from '../initializers' | 3 | import { CONFIG, PREVIEWS_SIZE, EMBED_SIZE } from '../initializers' |
4 | import { oembedValidator } from '../middlewares' | 4 | import { oembedValidator } from '../middlewares' |
5 | import { VideoInstance } from '../models' | 5 | import { 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) |