aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/services.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-12 14:51:17 +0200
committerChocobozzz <me@florianbigard.com>2021-05-12 16:57:31 +0200
commitc158a5faabb8ef0bc5d121fda4522d63603e8bc5 (patch)
treeca0a7f25a8806805deeb48f48642ec60696256ce /server/controllers/services.ts
parentc00100b607ab97dfea690880434657b7ee11466d (diff)
downloadPeerTube-c158a5faabb8ef0bc5d121fda4522d63603e8bc5.tar.gz
PeerTube-c158a5faabb8ef0bc5d121fda4522d63603e8bc5.tar.zst
PeerTube-c158a5faabb8ef0bc5d121fda4522d63603e8bc5.zip
Refactor a little bit controllers
Diffstat (limited to 'server/controllers/services.ts')
-rw-r--r--server/controllers/services.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index 189e1651b..8c0af9ff7 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -78,17 +78,18 @@ function buildOEmbed (options: {
78 const maxWidth = parseInt(req.query.maxwidth, 10) 78 const maxWidth = parseInt(req.query.maxwidth, 10)
79 79
80 const embedUrl = webserverUrl + embedPath 80 const embedUrl = webserverUrl + embedPath
81 let embedWidth = EMBED_SIZE.width
82 let embedHeight = EMBED_SIZE.height
83 const embedTitle = escapeHTML(title) 81 const embedTitle = escapeHTML(title)
84 82
85 let thumbnailUrl = previewPath 83 let thumbnailUrl = previewPath
86 ? webserverUrl + previewPath 84 ? webserverUrl + previewPath
87 : undefined 85 : undefined
88 86
89 if (maxHeight < embedHeight) embedHeight = maxHeight 87 let embedWidth = EMBED_SIZE.width
90 if (maxWidth < embedWidth) embedWidth = maxWidth 88 if (maxWidth < embedWidth) embedWidth = maxWidth
91 89
90 let embedHeight = EMBED_SIZE.height
91 if (maxHeight < embedHeight) embedHeight = maxHeight
92
92 // Our thumbnail is too big for the consumer 93 // Our thumbnail is too big for the consumer
93 if ( 94 if (
94 (maxHeight !== undefined && maxHeight < previewSize.height) || 95 (maxHeight !== undefined && maxHeight < previewSize.height) ||