aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-26 15:16:05 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-26 15:16:05 +0200
commit7ff7802aa0ee6dd4c90f3e1cef1993170e7807f2 (patch)
treef980749200458c358870d0943cb88b05692027c0
parent9d9597df427542eb5c7d3ba8ff5aeb146fab40e2 (diff)
downloadPeerTube-7ff7802aa0ee6dd4c90f3e1cef1993170e7807f2.tar.gz
PeerTube-7ff7802aa0ee6dd4c90f3e1cef1993170e7807f2.tar.zst
PeerTube-7ff7802aa0ee6dd4c90f3e1cef1993170e7807f2.zip
Add og:video tags
-rw-r--r--server/controllers/client.ts15
-rw-r--r--server/lib/jobs/handlers/video-file-transcoder.ts2
2 files changed, 14 insertions, 3 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index 1391993a7..2071b5f01 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -8,7 +8,8 @@ import {
8 CONFIG, 8 CONFIG,
9 STATIC_PATHS, 9 STATIC_PATHS,
10 STATIC_MAX_AGE, 10 STATIC_MAX_AGE,
11 OPENGRAPH_AND_OEMBED_COMMENT 11 OPENGRAPH_AND_OEMBED_COMMENT,
12 EMBED_SIZE
12} from '../initializers' 13} from '../initializers'
13import { root, readFileBufferPromise, escapeHTML } from '../helpers' 14import { root, readFileBufferPromise, escapeHTML } from '../helpers'
14import { asyncMiddleware } from '../middlewares' 15import { asyncMiddleware } from '../middlewares'
@@ -52,6 +53,7 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
52 53
53 const videoName = escapeHTML(video.name) 54 const videoName = escapeHTML(video.name)
54 const videoDescription = escapeHTML(video.description) 55 const videoDescription = escapeHTML(video.description)
56 const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath()
55 57
56 const openGraphMetaTags = { 58 const openGraphMetaTags = {
57 'og:type': 'video', 59 'og:type': 'video',
@@ -60,6 +62,12 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
60 'og:url': videoUrl, 62 'og:url': videoUrl,
61 'og:description': videoDescription, 63 'og:description': videoDescription,
62 64
65 'og:video:url': embedUrl,
66 'og:video:secure_url': embedUrl,
67 'og:video:type': 'text/html',
68 'og:video:width': EMBED_SIZE.width,
69 'og:video:height': EMBED_SIZE.height,
70
63 'name': videoName, 71 'name': videoName,
64 'description': videoDescription, 72 'description': videoDescription,
65 'image': previewUrl, 73 'image': previewUrl,
@@ -68,7 +76,10 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
68 'twitter:site': '@Chocobozzz', 76 'twitter:site': '@Chocobozzz',
69 'twitter:title': videoName, 77 'twitter:title': videoName,
70 'twitter:description': videoDescription, 78 'twitter:description': videoDescription,
71 'twitter:image': previewUrl 79 'twitter:image': previewUrl,
80 'twitter:player': embedUrl,
81 'twitter:player:width': EMBED_SIZE.width,
82 'twitter:player:height': EMBED_SIZE.height
72 } 83 }
73 84
74 const oembedLinkTags = [ 85 const oembedLinkTags = [
diff --git a/server/lib/jobs/handlers/video-file-transcoder.ts b/server/lib/jobs/handlers/video-file-transcoder.ts
index a8d80ed45..853645510 100644
--- a/server/lib/jobs/handlers/video-file-transcoder.ts
+++ b/server/lib/jobs/handlers/video-file-transcoder.ts
@@ -37,7 +37,7 @@ async function onSuccess (jobId: number, video: VideoInstance) {
37 // Now we'll add the video's meta data to our friends 37 // Now we'll add the video's meta data to our friends
38 await updateVideoToFriends(remoteVideo, null) 38 await updateVideoToFriends(remoteVideo, null)
39 39
40 return 40 return undefined
41} 41}
42 42
43// --------------------------------------------------------------------------- 43// ---------------------------------------------------------------------------