From c158a5faabb8ef0bc5d121fda4522d63603e8bc5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 May 2021 14:51:17 +0200 Subject: Refactor a little bit controllers --- server/controllers/services.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/controllers/services.ts') 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: { const maxWidth = parseInt(req.query.maxwidth, 10) const embedUrl = webserverUrl + embedPath - let embedWidth = EMBED_SIZE.width - let embedHeight = EMBED_SIZE.height const embedTitle = escapeHTML(title) let thumbnailUrl = previewPath ? webserverUrl + previewPath : undefined - if (maxHeight < embedHeight) embedHeight = maxHeight + let embedWidth = EMBED_SIZE.width if (maxWidth < embedWidth) embedWidth = maxWidth + let embedHeight = EMBED_SIZE.height + if (maxHeight < embedHeight) embedHeight = maxHeight + // Our thumbnail is too big for the consumer if ( (maxHeight !== undefined && maxHeight < previewSize.height) || -- cgit v1.2.3