onebox 1.8.36 → 1.8.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/onebox/engine/gfycat_onebox.rb +37 -10
- data/lib/onebox/engine/sketchfab_onebox.rb +1 -1
- data/lib/onebox/sanitize_config.rb +1 -1
- data/lib/onebox/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 93d84795208b6845f986569134baa989a7b0413f
|
4
|
+
data.tar.gz: 065ab0d91d48f0f70accf25491945a0e42f6484d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a3ba89b23f5930a2aff0eef44644d69927b4a816220b68c0f8cc953961b226d611564863a491f492c97e9f01674bd872ff19200eac74283043bd18e1a318e7a
|
7
|
+
data.tar.gz: b27d5b3b1f4f898ef4540899858db5420762df9aa855fef9ea11c651caf681fe081891ace02cb5502908d9b019dc0a8021a9928066c3902887624156ef88867f
|
@@ -18,14 +18,32 @@ module Onebox
|
|
18
18
|
|
19
19
|
def to_html
|
20
20
|
<<-HTML
|
21
|
-
<
|
22
|
-
<
|
23
|
-
<
|
24
|
-
<
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
<aside class="onebox gfycat">
|
22
|
+
<header class="source">
|
23
|
+
<img src="https://gfycat.com/static/favicons/favicon-96x96.png" class="site-icon" width="64" height="64">
|
24
|
+
<a href="#{data[:url]}" target="_blank" rel="nofollow noopener">Gfycat.com</a>
|
25
|
+
</header>
|
26
|
+
<article class="onebox-body">
|
27
|
+
<h4>
|
28
|
+
#{data[:title]} by
|
29
|
+
<a href="https://gfycat.com/@#{data[:author]}" target="_blank" rel="nofollow noopener">
|
30
|
+
<span>#{data[:author]}</span>
|
31
|
+
</a>
|
32
|
+
</h4>
|
33
|
+
|
34
|
+
<div class="video">
|
35
|
+
<video controls loop #{data[:autoplay]} muted poster="#{data[:posterUrl]}" style="--aspect-ratio: #{data[:width]}/#{data[:height]}">
|
36
|
+
<source id="webmSource" src="#{data[:webmUrl]}" type="video/webm">
|
37
|
+
<source id="mp4Source" src="#{data[:mp4Url]}" type="video/mp4">
|
38
|
+
<img title="Sorry, your browser doesn't support HTML5 video." src="#{data[:posterUrl]}">
|
39
|
+
</video>
|
40
|
+
</div>
|
41
|
+
<p>
|
42
|
+
<span class="label1">#{data[:tags]}</span>
|
43
|
+
</p>
|
44
|
+
|
45
|
+
</article>
|
46
|
+
</aside>
|
29
47
|
HTML
|
30
48
|
end
|
31
49
|
|
@@ -41,18 +59,27 @@ module Onebox
|
|
41
59
|
private
|
42
60
|
|
43
61
|
def match
|
44
|
-
@match ||= @url.match(/^https?:\/\/gfycat\.com\/(?<name>.+)/)
|
62
|
+
@match ||= @url.match(/^https?:\/\/gfycat\.com\/(gifs\/detail\/)?(?<name>.+)/)
|
45
63
|
end
|
46
64
|
|
47
65
|
def data
|
66
|
+
|
67
|
+
total_tags = [raw['gfyItem']['tags'], raw['gfyItem']['userTags']].flatten.compact
|
68
|
+
tag_links = total_tags.map { |t| "<a href='https://gfycat.com/gifs/search/#{t}'>##{t}</a>" }.join(' ') if total_tags
|
69
|
+
autoplay = raw['gfyItem']['webmSize'].to_i < 10485760 ? 'autoplay' : ''
|
70
|
+
|
48
71
|
{
|
49
72
|
name: raw['gfyItem']['gfyName'],
|
73
|
+
title: raw['gfyItem']['title'] || 'No Title',
|
74
|
+
author: raw['gfyItem']['userName'],
|
75
|
+
tags: tag_links,
|
50
76
|
url: @url,
|
51
77
|
posterUrl: raw['gfyItem']['posterUrl'],
|
52
78
|
webmUrl: raw['gfyItem']['webmUrl'],
|
53
79
|
mp4Url: raw['gfyItem']['mp4Url'],
|
54
80
|
width: raw['gfyItem']['width'],
|
55
|
-
height: raw['gfyItem']['height']
|
81
|
+
height: raw['gfyItem']['height'],
|
82
|
+
autoplay: autoplay
|
56
83
|
}
|
57
84
|
end
|
58
85
|
|
@@ -12,7 +12,7 @@ class Sanitize
|
|
12
12
|
'embed' => %w[height src type width],
|
13
13
|
'iframe' => %w[allowfullscreen frameborder height scrolling src width],
|
14
14
|
'source' => %w[src type],
|
15
|
-
'video' => %w[controls height loop width],
|
15
|
+
'video' => %w[controls height loop width autoplay muted poster],
|
16
16
|
'div' => [:data], # any data-* attributes
|
17
17
|
},
|
18
18
|
|
data/lib/onebox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joanna Zeta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
511
511
|
version: '0'
|
512
512
|
requirements: []
|
513
513
|
rubyforge_project:
|
514
|
-
rubygems_version: 2.
|
514
|
+
rubygems_version: 2.5.2
|
515
515
|
signing_key:
|
516
516
|
specification_version: 4
|
517
517
|
summary: A gem for turning URLs into previews.
|