onebox 2.2.12 → 2.2.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -4
  3. data/lib/onebox/engine.rb +7 -11
  4. data/lib/onebox/engine/allowlisted_generic_onebox.rb +11 -18
  5. data/lib/onebox/engine/amazon_onebox.rb +26 -17
  6. data/lib/onebox/engine/asciinema_onebox.rb +0 -1
  7. data/lib/onebox/engine/audioboom_onebox.rb +5 -2
  8. data/lib/onebox/engine/bandcamp_onebox.rb +8 -8
  9. data/lib/onebox/engine/cloudapp_onebox.rb +12 -12
  10. data/lib/onebox/engine/coub_onebox.rb +0 -1
  11. data/lib/onebox/engine/facebook_media_onebox.rb +8 -7
  12. data/lib/onebox/engine/five_hundred_px_onebox.rb +0 -1
  13. data/lib/onebox/engine/flickr_onebox.rb +14 -15
  14. data/lib/onebox/engine/gfycat_onebox.rb +26 -26
  15. data/lib/onebox/engine/giphy_onebox.rb +0 -1
  16. data/lib/onebox/engine/github_blob_onebox.rb +4 -0
  17. data/lib/onebox/engine/github_commit_onebox.rb +13 -16
  18. data/lib/onebox/engine/github_folder_onebox.rb +1 -1
  19. data/lib/onebox/engine/github_gist_onebox.rb +1 -2
  20. data/lib/onebox/engine/github_issue_onebox.rb +16 -18
  21. data/lib/onebox/engine/github_pullrequest_onebox.rb +7 -4
  22. data/lib/onebox/engine/gitlab_blob_onebox.rb +4 -0
  23. data/lib/onebox/engine/google_calendar_onebox.rb +1 -1
  24. data/lib/onebox/engine/google_docs_onebox.rb +23 -41
  25. data/lib/onebox/engine/google_drive_onebox.rb +7 -7
  26. data/lib/onebox/engine/google_maps_onebox.rb +10 -8
  27. data/lib/onebox/engine/google_photos_onebox.rb +18 -18
  28. data/lib/onebox/engine/google_play_app_onebox.rb +3 -7
  29. data/lib/onebox/engine/imgur_onebox.rb +2 -2
  30. data/lib/onebox/engine/instagram_onebox.rb +4 -5
  31. data/lib/onebox/engine/kaltura_onebox.rb +8 -6
  32. data/lib/onebox/engine/opengraph_image.rb +0 -1
  33. data/lib/onebox/engine/pastebin_onebox.rb +11 -15
  34. data/lib/onebox/engine/pdf_onebox.rb +7 -15
  35. data/lib/onebox/engine/pubmed_onebox.rb +17 -12
  36. data/lib/onebox/engine/replit_onebox.rb +0 -1
  37. data/lib/onebox/engine/sketchfab_onebox.rb +8 -8
  38. data/lib/onebox/engine/slides_onebox.rb +10 -10
  39. data/lib/onebox/engine/soundcloud_onebox.rb +0 -1
  40. data/lib/onebox/engine/stack_exchange_onebox.rb +3 -2
  41. data/lib/onebox/engine/standard_embed.rb +2 -5
  42. data/lib/onebox/engine/steam_store_onebox.rb +6 -5
  43. data/lib/onebox/engine/trello_onebox.rb +4 -7
  44. data/lib/onebox/engine/twitch_clips_onebox.rb +1 -3
  45. data/lib/onebox/engine/twitch_stream_onebox.rb +1 -2
  46. data/lib/onebox/engine/twitch_video_onebox.rb +0 -2
  47. data/lib/onebox/engine/typeform_onebox.rb +7 -6
  48. data/lib/onebox/engine/vimeo_onebox.rb +9 -7
  49. data/lib/onebox/engine/wikimedia_onebox.rb +1 -2
  50. data/lib/onebox/engine/wikipedia_onebox.rb +12 -8
  51. data/lib/onebox/engine/youku_onebox.rb +7 -13
  52. data/lib/onebox/engine/youtube_onebox.rb +14 -13
  53. data/lib/onebox/file_type_finder.rb +0 -1
  54. data/lib/onebox/helpers.rb +7 -24
  55. data/lib/onebox/layout.rb +2 -14
  56. data/lib/onebox/matcher.rb +10 -8
  57. data/lib/onebox/mixins/git_blob_onebox.rb +8 -8
  58. data/lib/onebox/mixins/github_body.rb +30 -0
  59. data/lib/onebox/mixins/twitch_onebox.rb +0 -1
  60. data/lib/onebox/open_graph.rb +4 -4
  61. data/lib/onebox/preview.rb +3 -4
  62. data/lib/onebox/version.rb +1 -1
  63. data/templates/_layout.mustache +6 -2
  64. data/templates/allowlistedgeneric.mustache +8 -9
  65. data/templates/amazon.mustache +5 -2
  66. data/templates/github/github_body.mustache +5 -0
  67. data/templates/githubblob.mustache +44 -34
  68. data/templates/githubcommit.mustache +2 -10
  69. data/templates/githubfolder.mustache +2 -2
  70. data/templates/githubgist.mustache +9 -6
  71. data/templates/githubissue.mustache +9 -11
  72. data/templates/githubpullrequest.mustache +6 -18
  73. data/templates/gitlabblob.mustache +11 -4
  74. data/templates/googledocs.mustache +2 -2
  75. data/templates/googledrive.mustache +2 -2
  76. data/templates/googleplayapp.mustache +2 -1
  77. data/templates/instagram.mustache +1 -1
  78. data/templates/pastebin.mustache +6 -2
  79. data/templates/pdf.mustache +6 -3
  80. data/templates/stackexchange.mustache +1 -0
  81. data/templates/twitterstatus.mustache +20 -5
  82. data/templates/wikimedia.mustache +2 -2
  83. data/templates/wikipedia.mustache +2 -2
  84. data/templates/xkcd.mustache +2 -2
  85. metadata +7 -5
@@ -18,7 +18,6 @@ module Onebox
18
18
  </a>
19
19
  HTML
20
20
  end
21
-
22
21
  end
23
22
  end
24
23
  end
@@ -8,17 +8,21 @@ module Onebox
8
8
  def self.git_regexp
9
9
  /^https?:\/\/(www\.)?github\.com.*\/blob\//
10
10
  end
11
+
11
12
  def self.onebox_name
12
13
  "githubblob"
13
14
  end
14
15
 
15
16
  include Onebox::Mixins::GitBlobOnebox
17
+
16
18
  def raw_regexp
17
19
  /github\.com\/(?<user>[^\/]+)\/(?<repo>[^\/]+)\/blob\/(?<sha1>[^\/]+)\/(?<file>[^#]+)(#(L(?<from>[^-]*)(-L(?<to>.*))?))?/mi
18
20
  end
21
+
19
22
  def raw_template(m)
20
23
  "https://raw.githubusercontent.com/#{m[:user]}/#{m[:repo]}/#{m[:sha1]}/#{m[:file]}"
21
24
  end
25
+
22
26
  def title
23
27
  Sanitize.fragment(Onebox::Helpers.uri_unencode(link).sub(/^https?\:\/\/github\.com\//, ''))
24
28
  end
@@ -1,13 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../mixins/github_body'
4
+
3
5
  module Onebox
4
6
  module Engine
5
7
  class GithubCommitOnebox
6
8
  include Engine
7
9
  include LayoutSupport
8
10
  include JSON
11
+ include Onebox::Mixins::GithubBody
9
12
 
10
- matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commit/")
13
+ matches_regexp(/^https?:\/\/(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:\/)?(?:.)*\/commit\//)
11
14
  always_https
12
15
 
13
16
  def url
@@ -17,36 +20,30 @@ module Onebox
17
20
  private
18
21
 
19
22
  def match
20
- return @match if @match
23
+ return @match if defined?(@match)
21
24
 
22
25
  @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/commit/(?<sha>[^/]+)})
23
-
24
- @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/commit/(?<sha>[^/]+)}) if @match.nil?
26
+ @match ||= @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/commit/(?<sha>[^/]+)})
25
27
 
26
28
  @match
27
29
  end
28
30
 
29
31
  def data
30
32
  result = raw.clone
31
- result['link'] = link
32
- result['title'] = result['commit']['message'].split("\n").first
33
33
 
34
- if result['commit']['message'].lines.count > 1
35
- message = result['commit']['message'].split("\n", 2).last.strip
34
+ lines = result['commit']['message'].split("\n")
35
+ result['title'] = lines.first
36
+ result['body'], result['excerpt'] = compute_body(lines[1..lines.length].join("\n"))
36
37
 
37
- message_words = message.gsub("\n\n", "\n").gsub("\n", "<br>").split(" ")
38
- max_words = 20
39
- result['message'] = message_words[0..max_words].join(" ")
40
- result['message'] += "..." if message_words.length > max_words
41
- result['message'] = result['message'].gsub("<br>", "\n")
42
- end
43
-
44
- ulink = URI(link)
45
38
  committed_at = Time.parse(result['commit']['author']['date'])
46
39
  result['committed_at'] = committed_at.strftime("%I:%M%p - %d %b %y %Z")
47
40
  result['committed_at_date'] = committed_at.strftime("%F")
48
41
  result['committed_at_time'] = committed_at.strftime("%T")
42
+
43
+ result['link'] = link
44
+ ulink = URI(link)
49
45
  result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
46
+
50
47
  result
51
48
  end
52
49
  end
@@ -7,7 +7,7 @@ module Onebox
7
7
  include StandardEmbed
8
8
  include LayoutSupport
9
9
 
10
- matches_regexp Regexp.new(/^https?:\/\/(?:www\.)?(?:(?:\w)+\.)?(github)\.com[\:\d]*(\/[^\/]+){2}/)
10
+ matches_regexp(/^https?:\/\/(?:www\.)?(?:(?:\w)+\.)?(github)\.com[\:\d]*(\/[^\/]+){2}/)
11
11
  always_https
12
12
 
13
13
  def self.priority
@@ -9,7 +9,7 @@ module Onebox
9
9
 
10
10
  MAX_FILES = 3
11
11
 
12
- matches_regexp Regexp.new("^http(?:s)?://gist\\.(?:(?:\\w)+\\.)?(github)\\.com(?:/)?")
12
+ matches_regexp(/^http(?:s)?:\/\/gist\.(?:(?:\w)+\.)?(github)\.com(?:\/)?/)
13
13
  always_https
14
14
 
15
15
  def url
@@ -76,7 +76,6 @@ module Onebox
76
76
  @lines ||= @json["content"].split("\n")
77
77
  end
78
78
  end
79
-
80
79
  end
81
80
  end
82
81
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../mixins/github_body'
4
+
3
5
  module Onebox
4
6
  module Engine
5
7
  class GithubIssueOnebox
@@ -7,7 +9,9 @@ module Onebox
7
9
  include Engine
8
10
  include LayoutSupport
9
11
  include JSON
10
- matches_regexp Regexp.new("^https?:\/\/(?:www\.)?(?:(?:\w)+\.)?github\.com\/(?<org>.+)\/(?<repo>.+)\/issues\/([[:digit:]]+)")
12
+ include Onebox::Mixins::GithubBody
13
+
14
+ matches_regexp(/^https?:\/\/(?:www\.)?(?:(?:\w)+\.)?github\.com\/(?<org>.+)\/(?<repo>.+)\/issues\/([[:digit:]]+)/)
11
15
  always_https
12
16
 
13
17
  def url
@@ -22,32 +26,26 @@ module Onebox
22
26
  end
23
27
 
24
28
  def data
25
- @raw ||= ::MultiJson.load(URI.open(url, "Accept" => "application/vnd.github.v3.text+json", read_timeout: timeout)) #custom Accept header so we can get body as text.
26
- body_text = @raw["body_text"]
27
-
28
- content_words = body_text.gsub("\n\n", "\n").gsub("\n", "<br>").split(" ") #one pass of removing double newline, then we change \n to <br> and later on we revert it back to \n this is a workaround to avoid losing newlines after we join it back.
29
- max_words = 20
30
- short_content = content_words[0..max_words].join(" ")
31
- short_content += "..." if content_words.length > max_words
32
-
33
- created_at = Time.parse(@raw['created_at'])
34
- closed_at = Time.parse(@raw['closed_at']) if @raw['closed_at']
35
-
29
+ created_at = Time.parse(raw['created_at'])
30
+ closed_at = Time.parse(raw['closed_at']) if raw['closed_at']
31
+ body, excerpt = compute_body(raw['body'])
36
32
  ulink = URI(link)
33
+
37
34
  {
38
35
  link: @url,
39
- title: @raw["title"],
40
- content: short_content.gsub("<br>", "\n"),
41
- labels: @raw["labels"],
42
- user: @raw['user'],
36
+ title: raw["title"],
37
+ body: body,
38
+ excerpt: excerpt,
39
+ labels: raw["labels"],
40
+ user: raw['user'],
43
41
  created_at: created_at.strftime("%I:%M%p - %d %b %y %Z"),
44
42
  created_at_date: created_at.strftime("%F"),
45
43
  created_at_time: created_at.strftime("%T"),
46
44
  closed_at: closed_at&.strftime("%I:%M%p - %d %b %y %Z"),
47
45
  closed_at_date: closed_at&.strftime("%F"),
48
46
  closed_at_time: closed_at&.strftime("%T"),
49
- closed_by: @raw['closed_by'],
50
- avatar: "https://avatars1.githubusercontent.com/u/#{@raw['user']['id']}?v=2&s=96",
47
+ closed_by: raw['closed_by'],
48
+ avatar: "https://avatars1.githubusercontent.com/u/#{raw['user']['id']}?v=2&s=96",
51
49
  domain: "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}",
52
50
  }
53
51
  end
@@ -1,13 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../mixins/github_body'
4
+
3
5
  module Onebox
4
6
  module Engine
5
7
  class GithubPullRequestOnebox
6
8
  include Engine
7
9
  include LayoutSupport
8
10
  include JSON
11
+ include Onebox::Mixins::GithubBody
12
+
13
+ GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
9
14
 
10
- matches_regexp Regexp.new("^https?://(?:www\\.)?(?:(?:\\w)+\\.)?(github)\\.com(?:/)?(?:.)*/pull/")
15
+ matches_regexp(/^https?:\/\/(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:\/)?(?:.)*\/pull/)
11
16
  always_https
12
17
 
13
18
  def url
@@ -20,7 +25,6 @@ module Onebox
20
25
  @match ||= @url.match(%r{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<number>[^/]+)})
21
26
  end
22
27
 
23
- GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
24
28
  def data
25
29
  result = raw.clone
26
30
  result['link'] = link
@@ -33,8 +37,7 @@ module Onebox
33
37
  ulink = URI(link)
34
38
  result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
35
39
 
36
- body = (result['body'] || '').gsub(GITHUB_COMMENT_REGEX, '')
37
- result['body'] = body.present? ? body : nil
40
+ result['body'], result['excerpt'] = compute_body(result['body'])
38
41
 
39
42
  result
40
43
  end
@@ -8,17 +8,21 @@ module Onebox
8
8
  def self.git_regexp
9
9
  /^https?:\/\/(www\.)?gitlab\.com.*\/blob\//
10
10
  end
11
+
11
12
  def self.onebox_name
12
13
  "gitlabblob"
13
14
  end
14
15
 
15
16
  include Onebox::Mixins::GitBlobOnebox
17
+
16
18
  def raw_regexp
17
19
  /gitlab\.com\/(?<user>[^\/]+)\/(?<repo>[^\/]+)\/blob\/(?<sha1>[^\/]+)\/(?<file>[^#]+)(#(L(?<from>[^-]*)(-L(?<to>.*))?))?/mi
18
20
  end
21
+
19
22
  def raw_template(m)
20
23
  "https://gitlab.com/#{m[:user]}/#{m[:repo]}/raw/#{m[:sha1]}/#{m[:file]}"
21
24
  end
25
+
22
26
  def title
23
27
  Sanitize.fragment(Onebox::Helpers.uri_unencode(link).sub(/^https?\:\/\/gitlab\.com\//, ''))
24
28
  end
@@ -5,7 +5,7 @@ module Onebox
5
5
  class GoogleCalendarOnebox
6
6
  include Engine
7
7
 
8
- matches_regexp /^(https?:)?\/\/((www|calendar)\.google\.[\w.]{2,}|goo\.gl)\/calendar\/.+$/
8
+ matches_regexp(/^(https?:)?\/\/((www|calendar)\.google\.[\w.]{2,}|goo\.gl)\/calendar\/.+$/)
9
9
  always_https
10
10
  requires_iframe_origins "https://calendar.google.com"
11
11
 
@@ -4,61 +4,43 @@ module Onebox
4
4
  module Engine
5
5
  class GoogleDocsOnebox
6
6
  include Engine
7
+ include StandardEmbed
7
8
  include LayoutSupport
8
9
 
9
- def self.supported_endpoints
10
- %w(spreadsheets document forms presentation)
11
- end
12
-
13
- def self.short_types
14
- @shorttypes ||= {
15
- spreadsheets: :sheets,
16
- document: :docs,
17
- presentation: :slides,
18
- forms: :forms,
19
- }
20
- end
10
+ SUPPORTED_ENDPOINTS = %w(spreadsheets document forms presentation)
11
+ SHORT_TYPES = {
12
+ spreadsheets: :sheets,
13
+ document: :docs,
14
+ presentation: :slides,
15
+ forms: :forms,
16
+ }
21
17
 
22
- matches_regexp /^(https?:)?\/\/(docs\.google\.com)\/(?<endpoint>(#{supported_endpoints.join('|')}))\/d\/((?<key>[\w-]*)).+$/
18
+ matches_regexp(/^(https?:)?\/\/(docs\.google\.com)\/(?<endpoint>(#{SUPPORTED_ENDPOINTS.join('|')}))\/d\/((?<key>[\w-]*)).+$/)
23
19
  always_https
24
20
 
25
- protected
21
+ private
26
22
 
27
23
  def data
28
- og_data = get_og_data
29
- result = { link: link,
30
- title: og_data[:title] || "Google #{shorttype.to_s.capitalize}",
31
- description: Onebox::Helpers.truncate(og_data[:description], 250) || "This #{shorttype.to_s.chop.capitalize} is private",
32
- type: shorttype
33
- }
34
- result
35
- end
24
+ og_data = get_opengraph
25
+ short_type = SHORT_TYPES[match[:endpoint].to_sym]
36
26
 
37
- def doc_type
38
- @doc_type ||= match[:endpoint].to_sym
39
- end
27
+ description = if Onebox::Helpers.blank?(og_data.description)
28
+ "This #{short_type.to_s.chop.capitalize} is private"
29
+ else
30
+ Onebox::Helpers.truncate(og_data.description, 250)
31
+ end
40
32
 
41
- def shorttype
42
- GoogleDocsOnebox.short_types[doc_type]
33
+ {
34
+ link: link,
35
+ title: og_data.title || "Google #{short_type.to_s.capitalize}",
36
+ description: description,
37
+ type: short_type
38
+ }
43
39
  end
44
40
 
45
41
  def match
46
42
  @match ||= @url.match(@@matcher)
47
43
  end
48
-
49
- def get_og_data
50
- response = Onebox::Helpers.fetch_response(url, redirect_limit: 10) rescue nil
51
- html = Nokogiri::HTML(response)
52
- og_data = {}
53
- html.css('meta').each do |m|
54
- if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i)
55
- m_content = m.attribute('content').to_s.strip
56
- m_property = m.attribute('property').to_s.gsub('og:', '')
57
- og_data[m_property.to_sym] = m_content
58
- end
59
- end
60
- og_data
61
- end
62
44
  end
63
45
  end
64
46
  end
@@ -7,7 +7,7 @@ module Onebox
7
7
  include StandardEmbed
8
8
  include LayoutSupport
9
9
 
10
- matches_regexp /^(https?:)?\/\/(drive\.google\.com)\/file\/d\/(?<key>[\w-]*)\/.+$/
10
+ matches_regexp(/^(https?:)?\/\/(drive\.google\.com)\/file\/d\/(?<key>[\w-]*)\/.+$/)
11
11
  always_https
12
12
 
13
13
  protected
@@ -18,12 +18,12 @@ module Onebox
18
18
  title = "#{og_data.title} (video)" if og_data.type =~ /^video[\/\.]/
19
19
  description = og_data.description || "Google Drive file."
20
20
 
21
- result = { link: link,
22
- title: title,
23
- description: Onebox::Helpers.truncate(description, 250),
24
- image: og_data.image
25
- }
26
- result
21
+ {
22
+ link: link,
23
+ title: title,
24
+ description: Onebox::Helpers.truncate(description, 250),
25
+ image: og_data.image
26
+ }
27
27
  end
28
28
  end
29
29
  end
@@ -22,7 +22,6 @@ module Onebox
22
22
  end
23
23
 
24
24
  always_https
25
-
26
25
  requires_iframe_origins("https://maps.google.com", "https://google.com")
27
26
 
28
27
  # Matches shortened Google Maps URLs
@@ -120,8 +119,6 @@ module Onebox
120
119
  @placeholder = "https://maps.googleapis.com/maps/api/streetview?size=690x400&location=#{lon},#{lat}&pano=#{panoid}&fov=#{zoom}&heading=#{heading}&pitch=#{pitch}&sensor=false"
121
120
 
122
121
  when :canonical
123
- uri = URI(@url)
124
-
125
122
  query = URI::decode_www_form(uri.query).to_h
126
123
  if !query.has_key?("ll")
127
124
  raise ArgumentError, "canonical url lacks location argument" unless query.has_key?("sll")
@@ -164,19 +161,24 @@ module Onebox
164
161
  end
165
162
 
166
163
  def follow_redirect!
167
- uri = URI(@url)
168
164
  begin
169
- http = Net::HTTP.start(uri.host, uri.port,
170
- use_ssl: uri.scheme == 'https', open_timeout: timeout, read_timeout: timeout)
171
- response = http.head(uri.path)
165
+ http = Net::HTTP.start(
166
+ uri.host,
167
+ uri.port,
168
+ use_ssl: uri.scheme == 'https',
169
+ open_timeout: timeout,
170
+ read_timeout: timeout
171
+ )
172
172
 
173
+ response = http.head(uri.path)
173
174
  raise "unexpected response code #{response.code}" unless %w(200 301 302).include?(response.code)
175
+
174
176
  @url = response.code == "200" ? uri.to_s : response["Location"]
177
+ @uri = URI(@url)
175
178
  ensure
176
179
  http.finish rescue nil
177
180
  end
178
181
  end
179
-
180
182
  end
181
183
  end
182
184
  end
@@ -11,9 +11,9 @@ module Onebox
11
11
 
12
12
  def to_html
13
13
  og = get_opengraph
14
- return video_html(og) if !og.video_secure_url.nil?
15
- return album_html(og) if !og.type.nil? && og.type == "google_photos:photo_album"
16
- return image_html(og) if !og.image.nil?
14
+ return video_html(og) if og.video_secure_url
15
+ return album_html(og) if og.type == "google_photos:photo_album"
16
+ return image_html(og) if og.image
17
17
  nil
18
18
  end
19
19
 
@@ -32,7 +32,7 @@ module Onebox
32
32
  <h3><a href="#{escaped_url}" target="_blank" rel="nofollow ugc noopener">#{og.title}</a></h3>
33
33
  <div class="aspect-image-full-size">
34
34
  <a href="#{escaped_url}" target="_blank" rel="nofollow ugc noopener">
35
- <img src="#{og.get_secure_image}" class="scale-image"/>
35
+ <img src="#{og.secure_image_url}" class="scale-image"/>
36
36
  <span class="instagram-video-icon"></span>
37
37
  </a>
38
38
  </div>
@@ -46,27 +46,27 @@ module Onebox
46
46
  album_title = og.description.nil? ? og.title : "[#{og.description}] #{og.title}"
47
47
 
48
48
  <<-HTML
49
- <div class='onebox google-photos-album'>
50
- <a href='#{escaped_url}' target='_blank' rel='noopener'>
51
- <span class='outer-box' style='width:#{og.image_width}px'>
52
- <span class='inner-box'>
53
- <span class='album-title'>#{Onebox::Helpers.truncate(album_title, 80)}</span>
54
- </span>
49
+ <div class='onebox google-photos-album'>
50
+ <a href='#{escaped_url}' target='_blank' rel='noopener'>
51
+ <span class='outer-box' style='width:#{og.image_width}px'>
52
+ <span class='inner-box'>
53
+ <span class='album-title'>#{Onebox::Helpers.truncate(album_title, 80)}</span>
55
54
  </span>
56
- <img src='#{og.get_secure_image}' #{og.title_attr} height='#{og.image_height}' width='#{og.image_width}'>
57
- </a>
58
- </div>
59
- HTML
55
+ </span>
56
+ <img src='#{og.secure_image_url}' #{og.title_attr} height='#{og.image_height}' width='#{og.image_width}'>
57
+ </a>
58
+ </div>
59
+ HTML
60
60
  end
61
61
 
62
62
  def image_html(og)
63
63
  escaped_url = ::Onebox::Helpers.normalize_url_for_output(url)
64
64
 
65
65
  <<-HTML
66
- <a href='#{escaped_url}' target='_blank' rel='noopener' class="onebox">
67
- <img src='#{og.get_secure_image}' #{og.title_attr} alt='Google Photos' height='#{og.image_height}' width='#{og.image_width}'>
68
- </a>
69
- HTML
66
+ <a href='#{escaped_url}' target='_blank' rel='noopener' class="onebox">
67
+ <img src='#{og.secure_image_url}' #{og.title_attr} alt='Google Photos' height='#{og.image_height}' width='#{og.image_width}'>
68
+ </a>
69
+ HTML
70
70
  end
71
71
  end
72
72
  end