onebox 1.9.29 → 1.9.30

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
  SHA256:
3
- metadata.gz: c996c2a3781e2a1d668b65673e7ac68ff530354a6290b83a135fc4e9994525b1
4
- data.tar.gz: 3b2b00129314e9dcfc1cc4acaeb8b3455e675f5eeefae1d732c18cf9d80cbd7c
3
+ metadata.gz: 72df1362582e006323722a42dc0787537c297df11f0c0e950b243759b10f74d7
4
+ data.tar.gz: d0e483271248e8efc72207ec28dae1836e3469376fc7849383201906d4c522e2
5
5
  SHA512:
6
- metadata.gz: d99a41fe572876a523e9abec9319db2abb929745ed33570c814cdf7715378e75a1ad9e8f24d4ede3106a8b86b47dbccddef31e056b3f2561728eec5f6f3baa74
7
- data.tar.gz: 7ea34a65e1424176cea0711ca4c2421e6e38ec4cd2b2d1830ca254e98cfb36d1039ba33cba169874ea83a0cde65171b4a7a6d75ceede019bbf11109c6cc74bd7
6
+ metadata.gz: 2277c8b9be42305155c66fb4d97e5987868e34a997f87827a3189ab8073a538ae3afd0b9c89b0271e0671c334d096e87813360ef140298fcdfac2fa58948239a
7
+ data.tar.gz: ae8306987d4a6ac15fb95a76a9ff44816fc9b84bd73f3ad4af63963fe40834b17de9d7d125f3e92a50ea523ab2cc84cf6b90eea1e8100abe62d991444dd8b946
@@ -20,11 +20,25 @@ module Onebox
20
20
  private
21
21
 
22
22
  def video_html(og)
23
+ escaped_url = ::Onebox::Helpers.normalize_url_for_output(url)
24
+
23
25
  <<-HTML
24
- <video width='#{og.video_width}' height='#{og.video_height}' #{og.title_attr} poster="#{og.get_secure_image}" controls loop>
25
- <source src='#{og.video_secure_url}' type='video/mp4'>
26
- </video>
27
- HTML
26
+ <aside class="onebox google-photos">
27
+ <header class="source">
28
+ <img src="#{raw[:favicon]}" class="site-icon" width="16" height="16">
29
+ <a href="#{escaped_url}" target="_blank" rel="nofollow ugc noopener">#{raw[:site_name]}</a>
30
+ </header>
31
+ <article class="onebox-body">
32
+ <h3><a href="#{escaped_url}" target="_blank" rel="nofollow ugc noopener">#{og.title}</a></h3>
33
+ <div class="aspect-image-full-size">
34
+ <a href="#{escaped_url}" target="_blank" rel="nofollow ugc noopener">
35
+ <img src="#{og.get_secure_image}" class="scale-image"/>
36
+ <span class="instagram-video-icon"></span>
37
+ </a>
38
+ </div>
39
+ </article>
40
+ </aside>
41
+ HTML
28
42
  end
29
43
 
30
44
  def album_html(og)
@@ -51,17 +51,14 @@ module Onebox
51
51
 
52
52
  raise Net::HTTPError.new('HTTP redirect too deep', location) if limit == 0
53
53
 
54
- uri = URI(location)
55
- uri = URI("#{domain}#{location}") if !uri.host
54
+ uri = Addressable::URI.parse(location)
55
+ uri = Addressable::URI.join(domain, uri) if !uri.host
56
56
 
57
57
  result = StringIO.new
58
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.is_a?(URI::HTTPS)) do |http|
58
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.normalized_scheme == 'https') do |http|
59
59
  http.open_timeout = Onebox.options.connect_timeout
60
60
  http.read_timeout = Onebox.options.timeout
61
- if uri.is_a?(URI::HTTPS)
62
- http.use_ssl = true
63
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
64
- end
61
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE # Work around path building bugs
65
62
 
66
63
  headers ||= {}
67
64
 
@@ -76,10 +73,12 @@ module Onebox
76
73
  http.request(request) do |response|
77
74
 
78
75
  if cookie = response.get_fields('set-cookie')
79
- header = { 'Cookie' => cookie.join }
76
+ # HACK: If this breaks again in the future, use HTTP::CookieJar from gem 'http-cookie'
77
+ # See test: it "does not send cookies to the wrong domain"
78
+ redir_header = { 'Cookie' => cookie.join('; ') }
80
79
  end
81
80
 
82
- header = nil unless header.is_a? Hash
81
+ redir_header = nil unless redir_header.is_a? Hash
83
82
 
84
83
  code = response.code.to_i
85
84
  unless code === 200
@@ -88,7 +87,7 @@ module Onebox
88
87
  response['location'],
89
88
  limit - 1,
90
89
  "#{uri.scheme}://#{uri.host}",
91
- header
90
+ redir_header
92
91
  )
93
92
  end
94
93
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "1.9.29"
4
+ VERSION = "1.9.30"
5
5
  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.9.29
4
+ version: 1.9.30
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: 2020-06-24 00:00:00.000000000 Z
13
+ date: 2020-07-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable