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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1576d08884bfa434b9bd3448ad8e961f67927d0
4
- data.tar.gz: 665f05efa8854392a32f73604d01e363dd40d7c2
3
+ metadata.gz: e1352380dded0936ef25582e1d72ea8f265ea275
4
+ data.tar.gz: 335b4a502bd143fd6b926d7607087699c096c989
5
5
  SHA512:
6
- metadata.gz: c02bcbd0202b81ab2e04f0764d5145fb1ed43db4c519fa208200569be4832bb74418c7b4e9425ad54a7757cafccd9860bad4d2b5dafdd2aa9c890d00f0742e05
7
- data.tar.gz: ff0de27100b65d232d6274e3a862c8e6d5ecdbda2907cffae3e82f87a033d977ac744b9dec3aec10e871cae7703eeddc28d14566766b8d48c7e502e68c4e63cf
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[:"player:width"]}' height='#{imgur_data[:"player:height"]}' controls autoplay loop><source src='#{imgur_data[:"player:stream"]}' type='video/mp4'><source src='#{imgur_data[:"player:stream"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"player:stream"]
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[:"player:width"]}' height='#{imgur_data[:"player:height"]}' controls autoplay loop><source src='#{imgur_data[:"player:stream"]}' type='video/mp4'><source src='#{imgur_data[:"player:stream"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"player:stream"]
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('name') && m.attribute('name').to_s.match(/^twitter:/i)
31
+ if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i)
32
32
  m_content = m.attribute('content').to_s.strip
33
- m_name = m.attribute('name').to_s.gsub('twitter:', '')
34
- imgur_data[m_name.to_sym] = m_content
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
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.5.37"
2
+ VERSION = "1.5.38"
3
3
  end
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.37
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-29 00:00:00.000000000 Z
13
+ date: 2016-03-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json