onebox 2.1.4 → 2.1.5
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/allowlisted_generic_onebox.rb +2 -2
- data/lib/onebox/engine/instagram_onebox.rb +16 -2
- data/lib/onebox/preview.rb +1 -1
- data/lib/onebox/version.rb +1 -1
- data/onebox.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 372344282cacdb38dfceab5dfb6c156d7c9fa5ec04cca9cc21eb8502987ce077
|
4
|
+
data.tar.gz: 02a26147e10f54261596572328cf85a758178cda845a20c9999cc1b5f96ffe18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 187c7a40761cea4d784175373600c00c2045d29ba911c8838614bf51b76454ecd7080ee93ca787d6745e69fc9d823b6de0e592746a2ccc30e9a9d55847e86cd4
|
7
|
+
data.tar.gz: f73f392c9451e85e5678dd0eff146092bfc0f3ae6a261eb4dfae02fb6a614976571837f3ec52e512334a4e815c3e3c8f49694179a7a41ec387d7195153cb7810
|
@@ -316,7 +316,7 @@ module Onebox
|
|
316
316
|
return true if AllowlistedGenericOnebox.html_providers.include?(data[:provider_name])
|
317
317
|
return false unless data[:html]["iframe"]
|
318
318
|
|
319
|
-
fragment = Nokogiri::
|
319
|
+
fragment = Nokogiri::HTML5::fragment(data[:html])
|
320
320
|
src = fragment.at_css('iframe')&.[]("src")
|
321
321
|
options[:allowed_iframe_regexes]&.any? { |r| src =~ r }
|
322
322
|
end
|
@@ -367,7 +367,7 @@ module Onebox
|
|
367
367
|
end
|
368
368
|
|
369
369
|
def embedded_html
|
370
|
-
fragment = Nokogiri::
|
370
|
+
fragment = Nokogiri::HTML5::fragment(data[:html])
|
371
371
|
fragment.css("img").each { |img| img["class"] = "thumbnail" }
|
372
372
|
if iframe = fragment.at_css("iframe")
|
373
373
|
iframe.remove_attribute("style")
|
@@ -16,12 +16,26 @@ module Onebox
|
|
16
16
|
|
17
17
|
def data
|
18
18
|
og = get_opengraph
|
19
|
-
|
19
|
+
|
20
|
+
# There are at least two different versions of the description. e.g.
|
21
|
+
# - "3,227 Likes, 88 Comments - An Account (@user.name) on Instagram: “Look at my picture!”"
|
22
|
+
# - "@user.name posted on their Instagram profile: “Look at my picture!”"
|
23
|
+
|
24
|
+
m = og.description.match(/\(@([\w\.]+)\) on Instagram/)
|
25
|
+
author_name = m[1] if m
|
26
|
+
|
27
|
+
author_name ||= begin
|
28
|
+
m = og.description.match(/^\@([\w\.]+)\ posted/)
|
29
|
+
m[1] if m
|
30
|
+
end
|
31
|
+
|
32
|
+
raise "Author username not found for post #{clean_url}" unless author_name
|
33
|
+
|
20
34
|
permalink = clean_url.gsub("/#{author_name}/", "/")
|
21
35
|
|
22
36
|
{ link: permalink,
|
23
37
|
title: "@#{author_name}",
|
24
|
-
image:
|
38
|
+
image: og.image,
|
25
39
|
description: Onebox::Helpers.truncate(og.title, 250)
|
26
40
|
}
|
27
41
|
end
|
data/lib/onebox/preview.rb
CHANGED
data/lib/onebox/version.rb
CHANGED
data/onebox.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'fakeweb', '~> 1.3'
|
34
34
|
spec.add_development_dependency 'pry', '~> 0.10'
|
35
35
|
spec.add_development_dependency 'mocha', '~> 1.1'
|
36
|
-
spec.add_development_dependency 'rubocop-discourse', '~> 2.
|
36
|
+
spec.add_development_dependency 'rubocop-discourse', '~> 2.4.0'
|
37
37
|
spec.add_development_dependency 'twitter', '~> 4.8'
|
38
38
|
spec.add_development_dependency 'guard-rspec', '~> 4.2.8'
|
39
39
|
spec.add_development_dependency 'sinatra', '~> 1.4'
|
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: 2.1.
|
4
|
+
version: 2.1.5
|
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-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -186,14 +186,14 @@ dependencies:
|
|
186
186
|
requirements:
|
187
187
|
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: 2.
|
189
|
+
version: 2.4.0
|
190
190
|
type: :development
|
191
191
|
prerelease: false
|
192
192
|
version_requirements: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
194
|
- - "~>"
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version: 2.
|
196
|
+
version: 2.4.0
|
197
197
|
- !ruby/object:Gem::Dependency
|
198
198
|
name: twitter
|
199
199
|
requirement: !ruby/object:Gem::Requirement
|