onebox 1.8.82 → 1.8.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/onebox/engine.rb +1 -0
- data/lib/onebox/engine/reddit_image_onebox.rb +34 -0
- data/lib/onebox/helpers.rb +1 -0
- data/lib/onebox/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a08cfcea7f4b84d1a07dde3fd32f4bd05c86c8daba270ca35f7d55c331c1043
|
4
|
+
data.tar.gz: 988c9d45ce626ac665cbb7447afd64a4629ace8c83cfa43bc54a3e6a3de0e12b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33719b6c4d8f1fb50b1c7c81c3503c2f7416c91ea1e2eb9fcfdbacc7fceefafc3af61f7904fe53dc368b5e514f04f7b20e6f174ab19217334e899fb54796bcae
|
7
|
+
data.tar.gz: 6cdcdcdef8dcc6f4bbd9231cf45739748af5aa436c515ee466f05400981b997d8fcd8cf66d160acaa36a1ef0e73da85f7d4ecc563d2140e647d5068deb099f91
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
onebox (1.8.
|
4
|
+
onebox (1.8.83)
|
5
5
|
htmlentities (~> 4.3)
|
6
6
|
moneta (~> 1.0)
|
7
7
|
multi_json (~> 1.11)
|
@@ -51,12 +51,12 @@ GEM
|
|
51
51
|
mini_portile2 (2.4.0)
|
52
52
|
mocha (1.8.0)
|
53
53
|
metaclass (~> 0.0.1)
|
54
|
-
moneta (1.
|
54
|
+
moneta (1.1.0)
|
55
55
|
multi_json (1.13.1)
|
56
56
|
multipart-post (2.0.0)
|
57
57
|
mustache (1.1.0)
|
58
58
|
nenv (0.3.0)
|
59
|
-
nokogiri (1.10.
|
59
|
+
nokogiri (1.10.2)
|
60
60
|
mini_portile2 (~> 2.4.0)
|
61
61
|
nokogumbo (2.0.1)
|
62
62
|
nokogiri (~> 1.8, >= 1.8.4)
|
data/lib/onebox/engine.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Onebox
|
2
|
+
module Engine
|
3
|
+
class RedditImageOnebox
|
4
|
+
include Engine
|
5
|
+
include StandardEmbed
|
6
|
+
|
7
|
+
matches_regexp(/^https?:\/\/(www\.)?reddit\.com/)
|
8
|
+
|
9
|
+
def to_html
|
10
|
+
if raw[:type] == "image"
|
11
|
+
<<-HTML
|
12
|
+
<aside class="onebox reddit">
|
13
|
+
<header class="source">
|
14
|
+
<img src="#{raw[:favicon]}" class="site-icon" width="16" height="16">
|
15
|
+
<a href="#{raw[:url]}" target="_blank" rel="nofollow noopener">#{raw[:site_name]}</a>
|
16
|
+
</header>
|
17
|
+
<article class="onebox-body">
|
18
|
+
<h3><a href="#{raw[:url]}" target="_blank" rel="nofollow noopener">#{raw[:title]}</a></h3>
|
19
|
+
<div class="scale-images">
|
20
|
+
<img src="#{raw[:image]}" class="scale-image"/>
|
21
|
+
</div>
|
22
|
+
<div class="description"><p>#{raw[:description]}</p></div>
|
23
|
+
</article>
|
24
|
+
</aside>
|
25
|
+
HTML
|
26
|
+
else
|
27
|
+
html = Onebox::Engine::WhitelistedGenericOnebox.new(@url, @cache, @timeout).to_html
|
28
|
+
return if Onebox::Helpers.blank?(html)
|
29
|
+
html
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/onebox/helpers.rb
CHANGED
@@ -164,6 +164,7 @@ module Onebox
|
|
164
164
|
return "" unless url
|
165
165
|
url = url.dup
|
166
166
|
# expect properly encoded url, remove any unsafe chars
|
167
|
+
url.gsub!(' ', '%20')
|
167
168
|
url.gsub!("'", "'")
|
168
169
|
url.gsub!('"', """)
|
169
170
|
url.gsub!(/[^\w\-`.~:\/?#\[\]@!$&'\(\)*+,;=%]/, "")
|
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.83
|
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: 2019-
|
13
|
+
date: 2019-04-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -336,6 +336,7 @@ files:
|
|
336
336
|
- lib/onebox/engine/pastebin_onebox.rb
|
337
337
|
- lib/onebox/engine/pdf_onebox.rb
|
338
338
|
- lib/onebox/engine/pubmed_onebox.rb
|
339
|
+
- lib/onebox/engine/reddit_image_onebox.rb
|
339
340
|
- lib/onebox/engine/replit_onebox.rb
|
340
341
|
- lib/onebox/engine/sketchfab_onebox.rb
|
341
342
|
- lib/onebox/engine/slides_onebox.rb
|
@@ -418,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
419
|
- !ruby/object:Gem::Version
|
419
420
|
version: '0'
|
420
421
|
requirements: []
|
421
|
-
rubygems_version: 3.0.
|
422
|
+
rubygems_version: 3.0.3
|
422
423
|
signing_key:
|
423
424
|
specification_version: 4
|
424
425
|
summary: A gem for generating embeddable HTML previews from URLs.
|