aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.js')
-rw-r--r--server/controllers/client.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/server/controllers/client.js b/server/controllers/client.js
index 68ffdbcd5..746c9b62b 100644
--- a/server/controllers/client.js
+++ b/server/controllers/client.js
@@ -33,25 +33,36 @@ module.exports = router
33// --------------------------------------------------------------------------- 33// ---------------------------------------------------------------------------
34 34
35function addOpenGraphTags (htmlStringPage, video) { 35function addOpenGraphTags (htmlStringPage, video) {
36 const thumbnailUrl = constants.CONFIG.WEBSERVER.URL + video.thumbnailPath
37 const videoUrl = constants.CONFIG.WEBSERVER.URL + '/videos/watch/' 36 const videoUrl = constants.CONFIG.WEBSERVER.URL + '/videos/watch/'
37 let baseUrlHttp
38
39 if (video.isOwned()) {
40 baseUrlHttp = constants.CONFIG.WEBSERVER.URL
41 } else {
42 baseUrlHttp = constants.REMOTE_SCHEME.HTTP + '://' + video.podUrl
43 }
44
45 // We fetch the remote preview (bigger than the thumbnail)
46 // This should not overhead the remote server since social websites put in a cache the OpenGraph tags
47 // We can't use the thumbnail because these social websites want bigger images (> 200x200 for Facebook for example)
48 const previewUrl = baseUrlHttp + constants.STATIC_PATHS.PREVIEWS + video.getPreviewName()
38 49
39 const metaTags = { 50 const metaTags = {
40 'og:type': 'video', 51 'og:type': 'video',
41 'og:title': video.name, 52 'og:title': video.name,
42 'og:image': thumbnailUrl, 53 'og:image': previewUrl,
43 'og:url': videoUrl, 54 'og:url': videoUrl,
44 'og:description': video.description, 55 'og:description': video.description,
45 56
46 'name': video.name, 57 'name': video.name,
47 'description': video.description, 58 'description': video.description,
48 'image': thumbnailUrl, 59 'image': previewUrl,
49 60
50 'twitter:card': 'summary_large_image', 61 'twitter:card': 'summary_large_image',
51 'twitter:site': '@Chocobozzz', 62 'twitter:site': '@Chocobozzz',
52 'twitter:title': video.name, 63 'twitter:title': video.name,
53 'twitter:description': video.description, 64 'twitter:description': video.description,
54 'twitter:image': thumbnailUrl 65 'twitter:image': previewUrl
55 } 66 }
56 67
57 let tagsString = '' 68 let tagsString = ''