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 +4 -4
- data/lib/onebox/engine/google_photos_onebox.rb +18 -4
- data/lib/onebox/helpers.rb +9 -10
- data/lib/onebox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72df1362582e006323722a42dc0787537c297df11f0c0e950b243759b10f74d7
|
4
|
+
data.tar.gz: d0e483271248e8efc72207ec28dae1836e3469376fc7849383201906d4c522e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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)
|
data/lib/onebox/helpers.rb
CHANGED
@@ -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(
|
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.
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
90
|
+
redir_header
|
92
91
|
)
|
93
92
|
end
|
94
93
|
|
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.9.
|
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-
|
13
|
+
date: 2020-07-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|