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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02dde152acf886fd61f163cf5b484ac8a90b0041190566b77510e019710d190b
4
- data.tar.gz: 13070cca8bb8b9e821b9217b46aa5a067950f201d514bc0e53368b1d75b1d7e6
3
+ metadata.gz: 4a08cfcea7f4b84d1a07dde3fd32f4bd05c86c8daba270ca35f7d55c331c1043
4
+ data.tar.gz: 988c9d45ce626ac665cbb7447afd64a4629ace8c83cfa43bc54a3e6a3de0e12b
5
5
  SHA512:
6
- metadata.gz: b83742da55beb7f0c2ea45b832287f1ccaead85c38ddccc4e5be6f34c1cd7174404d30533b84b10e4c61aaa2ca42088c7a09d6ec45cd59dad297720ddc22eb13
7
- data.tar.gz: 359a0ec20cf87962124b001bb2e8b2e5c93be573dbae88578e63a43c854509e61b909f85e90ad9faa5116a5b046a41c4a4b1f278347d142c3443ad71adc59dd9
6
+ metadata.gz: 33719b6c4d8f1fb50b1c7c81c3503c2f7416c91ea1e2eb9fcfdbacc7fceefafc3af61f7904fe53dc368b5e514f04f7b20e6f174ab19217334e899fb54796bcae
7
+ data.tar.gz: 6cdcdcdef8dcc6f4bbd9231cf45739748af5aa436c515ee466f05400981b997d8fcd8cf66d160acaa36a1ef0e73da85f7d4ecc563d2140e647d5068deb099f91
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- onebox (1.8.81)
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.0.0)
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.1)
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)
@@ -186,3 +186,4 @@ require_relative "engine/instagram_onebox"
186
186
  require_relative "engine/gitlab_blob_onebox"
187
187
  require_relative "engine/google_photos_onebox"
188
188
  require_relative "engine/kaltura_onebox"
189
+ require_relative "engine/reddit_image_onebox"
@@ -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
@@ -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!("'", "&apos;")
168
169
  url.gsub!('"', "&quot;")
169
170
  url.gsub!(/[^\w\-`.~:\/?#\[\]@!$&'\(\)*+,;=%]/, "")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "1.8.82"
4
+ VERSION = "1.8.83"
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.8.82
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-03-07 00:00:00.000000000 Z
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.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.