onebox 1.5.37 → 1.5.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onebox/engine/imgur_onebox.rb +14 -8
- data/lib/onebox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1352380dded0936ef25582e1d72ea8f265ea275
|
4
|
+
data.tar.gz: 335b4a502bd143fd6b926d7607087699c096c989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61bc29488640968ffa24af64d7efc44869f29a2464f7cd6f5f82624e19bfa07cf9e0a13eb542fa230721cad22e39fe0156123fd52dde4591f401e6758553cab2
|
7
|
+
data.tar.gz: ae7c475fdec87a70d8788cf60a7bfa286df26c114ece3edc7993771202c19a9fcc8e239adca087f15feeca533fdf3b83e354207686b8ce01c186990c4321ce3f
|
@@ -9,16 +9,16 @@ module Onebox
|
|
9
9
|
|
10
10
|
def to_html
|
11
11
|
imgur_data = get_imgur_data
|
12
|
-
return "<video width='#{imgur_data[:"
|
13
|
-
return "<div class='onebox imgur-album'><a href='#{url}' target='_blank'><span class='outer-box'><span class='inner-box'><span class='album-title'>[Album] #{imgur_data[:title]}</span></span></span><img src='#{imgur_data[:image]}' alt='Imgur'></a></div>" if is_album?
|
14
|
-
return "<a href='#{url}' target='_blank'><img src='#{imgur_data[:image]}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'></a>" if imgur_data[:image]
|
12
|
+
return "<video width='#{imgur_data[:"video:width"]}' height='#{imgur_data[:"video:height"]}' controls autoplay loop><source src='#{imgur_data[:"video:secure_url"]}' type='video/mp4'><source src='#{imgur_data[:"video:secure_url"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"video:secure_url"]
|
13
|
+
return "<div class='onebox imgur-album'><a href='#{url}' target='_blank'><span class='outer-box' style='width:#{imgur_data[:"image:width"]}px'><span class='inner-box'><span class='album-title'>[Album] #{imgur_data[:title]}</span></span></span><img src='#{get_secure_link(imgur_data[:image])}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'></a></div>" if is_album?
|
14
|
+
return "<a href='#{url}' target='_blank'><img src='#{get_secure_link(imgur_data[:image])}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'></a>" if imgur_data[:image]
|
15
15
|
return nil
|
16
16
|
end
|
17
17
|
|
18
18
|
def placeholder_html
|
19
19
|
imgur_data = get_imgur_data
|
20
|
-
return "<video width='#{imgur_data[:"
|
21
|
-
return "<img src='#{imgur_data[:image]}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'>"
|
20
|
+
return "<video width='#{imgur_data[:"video:width"]}' height='#{imgur_data[:"video:height"]}' controls autoplay loop><source src='#{imgur_data[:"video:secure_url"]}' type='video/mp4'><source src='#{imgur_data[:"video:secure_url"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"video:secure_url"]
|
21
|
+
return "<img src='#{get_secure_link(imgur_data[:image])}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'>"
|
22
22
|
return nil
|
23
23
|
end
|
24
24
|
|
@@ -28,10 +28,10 @@ module Onebox
|
|
28
28
|
html = Nokogiri::HTML(response.body)
|
29
29
|
imgur_data = {}
|
30
30
|
html.css('meta').each do |m|
|
31
|
-
if m.attribute('
|
31
|
+
if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i)
|
32
32
|
m_content = m.attribute('content').to_s.strip
|
33
|
-
|
34
|
-
imgur_data[
|
33
|
+
m_property = m.attribute('property').to_s.gsub('og:', '')
|
34
|
+
imgur_data[m_property.to_sym] = m_content
|
35
35
|
end
|
36
36
|
end
|
37
37
|
return imgur_data
|
@@ -42,6 +42,12 @@ module Onebox
|
|
42
42
|
imgur_data_id = Nokogiri::HTML(oembed_data[:html]).xpath("//blockquote").attr("data-id")
|
43
43
|
return !!(imgur_data_id.to_s =~ /a\//)
|
44
44
|
end
|
45
|
+
|
46
|
+
def get_secure_link(link)
|
47
|
+
secure_link = URI(link)
|
48
|
+
secure_link.scheme = 'https'
|
49
|
+
secure_link.to_s
|
50
|
+
end
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
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.5.
|
4
|
+
version: 1.5.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: 2016-03-
|
13
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|