onebox 1.8.76 → 1.8.77

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/.rspec +0 -0
  4. data/.rubocop.yml +0 -0
  5. data/.ruby-gemset +0 -0
  6. data/.travis.yml +0 -0
  7. data/CHANGELOG.md +0 -0
  8. data/Gemfile +0 -0
  9. data/Gemfile.lock +152 -0
  10. data/Guardfile +0 -0
  11. data/LICENSE.txt +0 -0
  12. data/README.md +0 -0
  13. data/Rakefile +0 -0
  14. data/lib/onebox.rb +0 -0
  15. data/lib/onebox/engine.rb +0 -0
  16. data/lib/onebox/engine/amazon_onebox.rb +0 -0
  17. data/lib/onebox/engine/asciinema_onebox.rb +0 -0
  18. data/lib/onebox/engine/audio_onebox.rb +0 -0
  19. data/lib/onebox/engine/audioboom_onebox.rb +0 -0
  20. data/lib/onebox/engine/bandcamp_onebox.rb +0 -0
  21. data/lib/onebox/engine/cloudapp_onebox.rb +0 -0
  22. data/lib/onebox/engine/coub_onebox.rb +0 -0
  23. data/lib/onebox/engine/douban_onebox.rb +0 -0
  24. data/lib/onebox/engine/five_hundred_px_onebox.rb +0 -0
  25. data/lib/onebox/engine/flickr_onebox.rb +0 -0
  26. data/lib/onebox/engine/flickr_shortened_onebox.rb +0 -0
  27. data/lib/onebox/engine/gfycat_onebox.rb +0 -0
  28. data/lib/onebox/engine/giphy_onebox.rb +0 -0
  29. data/lib/onebox/engine/github_blob_onebox.rb +0 -0
  30. data/lib/onebox/engine/github_commit_onebox.rb +0 -0
  31. data/lib/onebox/engine/github_gist_onebox.rb +0 -0
  32. data/lib/onebox/engine/github_issue_onebox.rb +0 -0
  33. data/lib/onebox/engine/github_pullrequest_onebox.rb +0 -0
  34. data/lib/onebox/engine/gitlab_blob_onebox.rb +0 -0
  35. data/lib/onebox/engine/google_calendar_onebox.rb +0 -0
  36. data/lib/onebox/engine/google_docs_onebox.rb +1 -1
  37. data/lib/onebox/engine/google_maps_onebox.rb +0 -0
  38. data/lib/onebox/engine/google_photos_onebox.rb +0 -0
  39. data/lib/onebox/engine/google_play_app_onebox.rb +0 -0
  40. data/lib/onebox/engine/html.rb +0 -0
  41. data/lib/onebox/engine/image_onebox.rb +0 -0
  42. data/lib/onebox/engine/imgur_onebox.rb +1 -1
  43. data/lib/onebox/engine/instagram_onebox.rb +1 -1
  44. data/lib/onebox/engine/json.rb +0 -0
  45. data/lib/onebox/engine/mixcloud_onebox.rb +0 -0
  46. data/lib/onebox/engine/opengraph_image.rb +0 -0
  47. data/lib/onebox/engine/pastebin_onebox.rb +0 -0
  48. data/lib/onebox/engine/pdf_onebox.rb +0 -0
  49. data/lib/onebox/engine/pubmed_onebox.rb +0 -0
  50. data/lib/onebox/engine/replit_onebox.rb +0 -0
  51. data/lib/onebox/engine/sketchfab_onebox.rb +0 -0
  52. data/lib/onebox/engine/slides_onebox.rb +0 -0
  53. data/lib/onebox/engine/soundcloud_onebox.rb +0 -0
  54. data/lib/onebox/engine/stack_exchange_onebox.rb +0 -0
  55. data/lib/onebox/engine/standard_embed.rb +0 -0
  56. data/lib/onebox/engine/steam_store_onebox.rb +0 -0
  57. data/lib/onebox/engine/trello_onebox.rb +0 -0
  58. data/lib/onebox/engine/twitch_clips_onebox.rb +0 -0
  59. data/lib/onebox/engine/twitch_stream_onebox.rb +0 -0
  60. data/lib/onebox/engine/twitch_video_onebox.rb +0 -0
  61. data/lib/onebox/engine/twitter_status_onebox.rb +0 -0
  62. data/lib/onebox/engine/video_onebox.rb +0 -0
  63. data/lib/onebox/engine/vimeo_onebox.rb +0 -0
  64. data/lib/onebox/engine/wechat_mp_onebox.rb +0 -0
  65. data/lib/onebox/engine/whitelisted_generic_onebox.rb +10 -10
  66. data/lib/onebox/engine/wikimedia_onebox.rb +0 -0
  67. data/lib/onebox/engine/wikipedia_onebox.rb +0 -0
  68. data/lib/onebox/engine/wistia_onebox.rb +0 -0
  69. data/lib/onebox/engine/xkcd_onebox.rb +0 -0
  70. data/lib/onebox/engine/youku_onebox.rb +0 -0
  71. data/lib/onebox/engine/youtube_onebox.rb +1 -1
  72. data/lib/onebox/file_type_finder.rb +0 -0
  73. data/lib/onebox/helpers.rb +12 -2
  74. data/lib/onebox/layout.rb +0 -0
  75. data/lib/onebox/layout_support.rb +0 -0
  76. data/lib/onebox/matcher.rb +0 -0
  77. data/lib/onebox/mixins/git_blob_onebox.rb +0 -0
  78. data/lib/onebox/mixins/twitch_onebox.rb +0 -0
  79. data/lib/onebox/preview.rb +0 -0
  80. data/lib/onebox/sanitize_config.rb +0 -0
  81. data/lib/onebox/status_check.rb +0 -0
  82. data/lib/onebox/template_support.rb +0 -0
  83. data/lib/onebox/version.rb +1 -1
  84. data/lib/onebox/view.rb +0 -0
  85. data/lib/onebox/web.rb +0 -0
  86. data/lib/onebox/web_helpers.rb +0 -0
  87. data/onebox.gemspec +0 -0
  88. data/templates/_layout.mustache +0 -0
  89. data/templates/amazon.mustache +0 -0
  90. data/templates/douban.mustache +0 -0
  91. data/templates/githubblob.mustache +0 -0
  92. data/templates/githubcommit.mustache +0 -0
  93. data/templates/githubgist.mustache +0 -0
  94. data/templates/githubissue.mustache +0 -0
  95. data/templates/githubpullrequest.mustache +0 -0
  96. data/templates/gitlabblob.mustache +0 -0
  97. data/templates/googledocs.mustache +0 -0
  98. data/templates/googleplayapp.mustache +0 -0
  99. data/templates/instagram.mustache +0 -0
  100. data/templates/pastebin.mustache +0 -0
  101. data/templates/pdf.mustache +0 -0
  102. data/templates/pubmed.mustache +0 -0
  103. data/templates/stackexchange.mustache +0 -0
  104. data/templates/twitterstatus.mustache +0 -0
  105. data/templates/wechatmp.mustache +0 -0
  106. data/templates/whitelistedgeneric.mustache +0 -0
  107. data/templates/wikimedia.mustache +0 -0
  108. data/templates/wikipedia.mustache +0 -0
  109. data/templates/xkcd.mustache +0 -0
  110. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9394de674eacbe6d9888da14da4f40ddbe0dcfe2e5815ef03d12f4530a0c6c16
4
- data.tar.gz: 3940a252b796ee2b75ed1226cceaf4e14cc722b3dd18e7e6eb5fc75f737325ba
3
+ metadata.gz: '08c3a640785331288e85c9998707a13f7cc2179cb2cc319535123595c5c52ef4'
4
+ data.tar.gz: b2e3f75c91844b7ee42cb41f874ed4d65387db2d33a74b9ff931aaf7dccfd608
5
5
  SHA512:
6
- metadata.gz: '08a95ad2f83a68d969eaccad0192a2d91e28da4dab5e06fb6d22758daae29b84b872e415841ea3cbf7c55b20295d233478a822633c34cbb85380691c614ae839'
7
- data.tar.gz: 1583dbd25f6ba7d2945d4cc8e76d017d1a055b31fc575ec3afa53067054d54741be03609df71b8bde8bb76c38c9fdbd619d48856e01a7f5cbfbe2559087c7bf7
6
+ metadata.gz: 47bf5de643663053b206d7309bfaa47c1e87e7970452a3afd9eccf83cdbe70a3078ffc72e2b8d248a1e145a7dd9a976bb105ffd84d31676f20b7870ad7b973ce
7
+ data.tar.gz: 2c6b8430d91bb83994c756f28ebf18ff31313e24f6bd5b64e6ec42f1d0b907438ec6112224cc2d8f7fd75f408eb370f6d617bc44fa10f5573e484df1369d1e2d
data/.gitignore CHANGED
@@ -4,7 +4,6 @@
4
4
  /.idea
5
5
  .config
6
6
  .yardoc
7
- Gemfile.lock
8
7
  InstalledFiles
9
8
  _yardoc
10
9
  coverage
data/.rspec CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
data/Gemfile CHANGED
File without changes
@@ -0,0 +1,152 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ onebox (1.8.76)
5
+ htmlentities (~> 4.3)
6
+ moneta (~> 1.0)
7
+ multi_json (~> 1.11)
8
+ mustache
9
+ nokogiri (~> 1.7)
10
+ sanitize
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ ast (2.4.0)
16
+ backports (3.11.4)
17
+ celluloid (0.16.0)
18
+ timers (~> 4.0.0)
19
+ coderay (1.1.2)
20
+ crass (1.0.4)
21
+ diff-lcs (1.3)
22
+ fakeweb (1.3.0)
23
+ faraday (0.9.2)
24
+ multipart-post (>= 1.2, < 3)
25
+ ffi (1.10.0)
26
+ formatador (0.2.5)
27
+ guard (2.15.0)
28
+ formatador (>= 0.2.4)
29
+ listen (>= 2.7, < 4.0)
30
+ lumberjack (>= 1.0.12, < 2.0)
31
+ nenv (~> 0.1)
32
+ notiffany (~> 0.0)
33
+ pry (>= 0.9.12)
34
+ shellany (~> 0.0)
35
+ thor (>= 0.18.1)
36
+ guard-rspec (4.2.10)
37
+ guard (~> 2.1)
38
+ rspec (>= 2.14, < 4.0)
39
+ haml (4.0.7)
40
+ tilt
41
+ hitimes (1.3.0)
42
+ htmlentities (4.3.4)
43
+ jaro_winkler (1.5.2)
44
+ listen (2.10.1)
45
+ celluloid (~> 0.16.0)
46
+ rb-fsevent (>= 0.9.3)
47
+ rb-inotify (>= 0.9)
48
+ lumberjack (1.0.13)
49
+ metaclass (0.0.4)
50
+ method_source (0.9.2)
51
+ mini_portile2 (2.4.0)
52
+ mocha (1.8.0)
53
+ metaclass (~> 0.0.1)
54
+ moneta (1.0.0)
55
+ multi_json (1.13.1)
56
+ multipart-post (2.0.0)
57
+ mustache (1.1.0)
58
+ nenv (0.3.0)
59
+ nokogiri (1.10.1)
60
+ mini_portile2 (~> 2.4.0)
61
+ nokogumbo (2.0.1)
62
+ nokogiri (~> 1.8, >= 1.8.4)
63
+ notiffany (0.1.1)
64
+ nenv (~> 0.1)
65
+ shellany (~> 0.0)
66
+ parallel (1.13.0)
67
+ parser (2.6.0.0)
68
+ ast (~> 2.4.0)
69
+ powerpack (0.1.2)
70
+ pry (0.12.2)
71
+ coderay (~> 1.1.0)
72
+ method_source (~> 0.9.0)
73
+ rack (1.6.11)
74
+ rack-protection (1.5.5)
75
+ rack
76
+ rack-test (1.1.0)
77
+ rack (>= 1.0, < 3)
78
+ rainbow (3.0.0)
79
+ rake (10.5.0)
80
+ rb-fsevent (0.10.3)
81
+ rb-inotify (0.10.0)
82
+ ffi (~> 1.0)
83
+ rspec (3.8.0)
84
+ rspec-core (~> 3.8.0)
85
+ rspec-expectations (~> 3.8.0)
86
+ rspec-mocks (~> 3.8.0)
87
+ rspec-core (3.8.0)
88
+ rspec-support (~> 3.8.0)
89
+ rspec-expectations (3.8.2)
90
+ diff-lcs (>= 1.2.0, < 2.0)
91
+ rspec-support (~> 3.8.0)
92
+ rspec-mocks (3.8.0)
93
+ diff-lcs (>= 1.2.0, < 2.0)
94
+ rspec-support (~> 3.8.0)
95
+ rspec-support (3.8.0)
96
+ rubocop (0.63.0)
97
+ jaro_winkler (~> 1.5.1)
98
+ parallel (~> 1.10)
99
+ parser (>= 2.5, != 2.5.1.1)
100
+ powerpack (~> 0.1)
101
+ rainbow (>= 2.2.2, < 4.0)
102
+ ruby-progressbar (~> 1.7)
103
+ unicode-display_width (~> 1.4.0)
104
+ ruby-progressbar (1.10.0)
105
+ sanitize (5.0.0)
106
+ crass (~> 1.0.2)
107
+ nokogiri (>= 1.8.0)
108
+ nokogumbo (~> 2.0)
109
+ shellany (0.0.1)
110
+ simple_oauth (0.3.1)
111
+ sinatra (1.4.8)
112
+ rack (~> 1.5)
113
+ rack-protection (~> 1.4)
114
+ tilt (>= 1.3, < 3)
115
+ sinatra-contrib (1.4.7)
116
+ backports (>= 2.0)
117
+ multi_json
118
+ rack-protection
119
+ rack-test
120
+ sinatra (~> 1.4.0)
121
+ tilt (>= 1.3, < 3)
122
+ thor (0.20.3)
123
+ tilt (2.0.9)
124
+ timers (4.0.4)
125
+ hitimes
126
+ twitter (4.8.1)
127
+ faraday (~> 0.8, < 0.10)
128
+ multi_json (~> 1.0)
129
+ simple_oauth (~> 0.2)
130
+ unicode-display_width (1.4.1)
131
+
132
+ PLATFORMS
133
+ ruby
134
+
135
+ DEPENDENCIES
136
+ bundler (~> 2.0)
137
+ fakeweb (~> 1.3)
138
+ guard-rspec (~> 4.2.8)
139
+ haml (~> 4.0)
140
+ listen (~> 2.10.0)
141
+ mocha (~> 1.1)
142
+ onebox!
143
+ pry (~> 0.10)
144
+ rake (~> 10.4)
145
+ rspec (~> 3.2)
146
+ rubocop (~> 0.50)
147
+ sinatra (~> 1.4)
148
+ sinatra-contrib (~> 1.4)
149
+ twitter (~> 4.8)
150
+
151
+ BUNDLED WITH
152
+ 2.0.1
data/Guardfile CHANGED
File without changes
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -26,7 +26,7 @@ module Onebox
26
26
  og_data = get_og_data
27
27
  result = { link: link,
28
28
  title: og_data[:title] || "Google #{shorttype.to_s.capitalize}",
29
- description: Sanitize.fragment(Onebox::Helpers.truncate(og_data[:description], 250)) || "This #{shorttype.to_s.chop.capitalize} is private",
29
+ description: Onebox::Helpers.truncate(og_data[:description], 250) || "This #{shorttype.to_s.chop.capitalize} is private",
30
30
  type: shorttype
31
31
  }
32
32
  result
File without changes
File without changes
File without changes
File without changes
@@ -31,7 +31,7 @@ module Onebox
31
31
  def album_html(og)
32
32
  escaped_url = ::Onebox::Helpers.normalize_url_for_output(url)
33
33
  escaped_src = ::Onebox::Helpers.normalize_url_for_output(get_secure_link(og[:image]))
34
- album_title = "[Album] #{Onebox::Helpers.truncate(og[:title].strip, 80)}"
34
+ album_title = "[Album] #{Onebox::Helpers.truncate(og[:title], 80)}"
35
35
 
36
36
  <<-HTML
37
37
  <div class='onebox imgur-album'>
@@ -20,7 +20,7 @@ module Onebox
20
20
 
21
21
  result = { link: og[:url],
22
22
  title: html_entities.decode(Onebox::Helpers.truncate(title, 80)),
23
- description: html_entities.decode(Sanitize.fragment(Onebox::Helpers.truncate(og[:description].strip, 250)))
23
+ description: html_entities.decode(Onebox::Helpers.truncate(og[:description], 250))
24
24
  }
25
25
 
26
26
  if !Onebox::Helpers.blank?(og[:image])
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -202,16 +202,16 @@ module Onebox
202
202
  d = { link: link }.merge(raw)
203
203
 
204
204
  if !Onebox::Helpers.blank?(d[:title])
205
- d[:title] = html_entities.decode(Onebox::Helpers.truncate(d[:title].strip, 80))
205
+ d[:title] = html_entities.decode(Onebox::Helpers.truncate(d[:title], 80))
206
206
  end
207
207
 
208
208
  d[:description] ||= d[:summary]
209
209
  if !Onebox::Helpers.blank?(d[:description])
210
- d[:description] = html_entities.decode(Sanitize.fragment(Onebox::Helpers.truncate(d[:description].strip, 250)))
210
+ d[:description] = html_entities.decode(Onebox::Helpers.truncate(d[:description], 250))
211
211
  end
212
212
 
213
213
  if !Onebox::Helpers.blank?(d[:site_name])
214
- d[:domain] = html_entities.decode(Onebox::Helpers.truncate(d[:site_name].strip, 80))
214
+ d[:domain] = html_entities.decode(Onebox::Helpers.truncate(d[:site_name], 80))
215
215
  elsif !Onebox::Helpers.blank?(d[:domain])
216
216
  d[:domain] = "http://#{d[:domain]}" unless d[:domain] =~ /^https?:\/\//
217
217
  d[:domain] = URI(d[:domain]).host.to_s.sub(/^www\./, '') rescue nil
@@ -231,22 +231,22 @@ module Onebox
231
231
 
232
232
  # Twitter labels
233
233
  if !Onebox::Helpers.blank?(d[:label1]) && !Onebox::Helpers.blank?(d[:data1]) && !!WhitelistedGenericOnebox.twitter_label_whitelist.find { |l| d[:label1] =~ /#{l}/i }
234
- d[:label_1] = Sanitize.fragment(Onebox::Helpers.truncate(d[:label1].strip))
235
- d[:data_1] = Sanitize.fragment(Onebox::Helpers.truncate(d[:data1].strip))
234
+ d[:label_1] = Onebox::Helpers.truncate(d[:label1])
235
+ d[:data_1] = Onebox::Helpers.truncate(d[:data1])
236
236
  end
237
237
  if !Onebox::Helpers.blank?(d[:label2]) && !Onebox::Helpers.blank?(d[:data2]) && !!WhitelistedGenericOnebox.twitter_label_whitelist.find { |l| d[:label2] =~ /#{l}/i }
238
238
  unless Onebox::Helpers.blank?(d[:label_1])
239
- d[:label_2] = Sanitize.fragment(Onebox::Helpers.truncate(d[:label2].strip))
240
- d[:data_2] = Sanitize.fragment(Onebox::Helpers.truncate(d[:data2].strip))
239
+ d[:label_2] = Onebox::Helpers.truncate(d[:label2])
240
+ d[:data_2] = Onebox::Helpers.truncate(d[:data2])
241
241
  else
242
- d[:label_1] = Sanitize.fragment(Onebox::Helpers.truncate(d[:label2].strip))
243
- d[:data_1] = Sanitize.fragment(Onebox::Helpers.truncate(d[:data2].strip))
242
+ d[:label_1] = Onebox::Helpers.truncate(d[:label2])
243
+ d[:data_1] = Onebox::Helpers.truncate(d[:data2])
244
244
  end
245
245
  end
246
246
 
247
247
  if Onebox::Helpers.blank?(d[:label_1]) && !Onebox::Helpers.blank?(d[:price_amount]) && !Onebox::Helpers.blank?(d[:price_currency])
248
248
  d[:label_1] = "Price"
249
- d[:data_1] = Sanitize.fragment(Onebox::Helpers.truncate("#{d[:price_currency].strip} #{d[:price_amount].strip}"))
249
+ d[:data_1] = Onebox::Helpers.truncate("#{d[:price_currency].strip} #{d[:price_amount].strip}")
250
250
  end
251
251
 
252
252
  d
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -50,7 +50,7 @@ module Onebox
50
50
 
51
51
  def video_title
52
52
  @video_title ||= begin
53
- Sanitize.fragment(Onebox::Helpers.truncate(video_oembed_data[:title].strip, 80))
53
+ Onebox::Helpers.truncate(video_oembed_data[:title], 80)
54
54
  rescue
55
55
  nil
56
56
  end
File without changes
@@ -169,12 +169,22 @@ module Onebox
169
169
  end
170
170
 
171
171
  def self.truncate(string, length = 50)
172
+ string = sanitize(string)
172
173
  string.size > length ? string[0...(string.rindex(" ", length) || length)] + "..." : string
173
174
  end
174
175
 
175
176
  def self.title_attr(meta)
176
- title = meta[:title].gsub("'", "&apos;").gsub('"', "&quot;")
177
- (meta && !blank?(title)) ? "title='#{title}'" : ""
177
+ title = get(meta, :title)
178
+ !title.nil? ? "title='#{title}'" : ""
179
+ end
180
+
181
+ def self.get(meta, attr)
182
+ (meta && !blank?(meta[attr])) ? sanitize(meta[attr]) : nil
183
+ end
184
+
185
+ def self.sanitize(value, length = 50)
186
+ return nil if blank?(value)
187
+ Sanitize.fragment(value).strip
178
188
  end
179
189
 
180
190
  def self.normalize_url_for_output(url)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "1.8.76"
4
+ VERSION = "1.8.77"
5
5
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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.76
4
+ version: 1.8.77
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-01-09 00:00:00.000000000 Z
13
+ date: 2019-02-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -294,6 +294,7 @@ files:
294
294
  - ".travis.yml"
295
295
  - CHANGELOG.md
296
296
  - Gemfile
297
+ - Gemfile.lock
297
298
  - Guardfile
298
299
  - LICENSE.txt
299
300
  - README.md