Set correctly preview image for open graph
authorChocobozzz <florian.bigard@gmail.com>
Wed, 12 Jul 2017 10:19:39 +0000 (12:19 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Wed, 12 Jul 2017 10:19:39 +0000 (12:19 +0200)
client/src/app/videos/video-watch/video-watch.component.ts
server/controllers/client.ts

index 104ba0db6d8dbc055588eb1e90b503664792c241..05a2c296cb002ace648d00269823f8da9669aa6e 100644 (file)
@@ -321,7 +321,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     this.metaService.setTag('og:description', this.video.description)
     this.metaService.setTag('description', this.video.description)
 
-    this.metaService.setTag('og:image', this.video.thumbnailPath)
+    this.metaService.setTag('og:image', this.video.previewPath)
 
     this.metaService.setTag('og:duration', this.video.duration.toString())
 
index d913f81b808faaed80e76f0fce76a334168fd580..1324e62cd607c6eae0d344533e65bd3d29b62289 100644 (file)
@@ -45,18 +45,7 @@ export {
 // ---------------------------------------------------------------------------
 
 function addOpenGraphTags (htmlStringPage: string, video: VideoInstance) {
-  let basePreviewUrlHttp
-
-  if (video.isOwned()) {
-    basePreviewUrlHttp = CONFIG.WEBSERVER.URL
-  } else {
-    basePreviewUrlHttp = REMOTE_SCHEME.HTTP + '://' + video.Author.Pod.host
-  }
-
-  // We fetch the remote preview (bigger than the thumbnail)
-  // This should not overhead the remote server since social websites put in a cache the OpenGraph tags
-  // We can't use the thumbnail because these social websites want bigger images (> 200x200 for Facebook for example)
-  const previewUrl = basePreviewUrlHttp + STATIC_PATHS.PREVIEWS + video.getPreviewName()
+  const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName()
   const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.id
 
   const metaTags = {