A bit of a hack to accept any webpage...
This commit is contained in:
parent
7d2135f851
commit
74b77e132d
1 changed files with 11 additions and 6 deletions
|
|
@ -18,10 +18,16 @@ class Commercial < ApplicationRecord
|
|||
resource = OEmbed::Providers.get(url, maxwidth: 560, maxheight: 315)
|
||||
{ html: resource.html.html_safe }
|
||||
rescue StandardError => exception
|
||||
{ error: exception.message }
|
||||
{ html: iframe_fallback(url) }
|
||||
# { error: exception.message }
|
||||
end
|
||||
end
|
||||
|
||||
def self.iframe_fallback(url)
|
||||
# <br><a href='#{url}' target=_blank>Open in a new tab</a>
|
||||
"<iframe src=\"#{url}\"></iframe>".html_safe
|
||||
end
|
||||
|
||||
def self.read_file(file)
|
||||
errors = {}
|
||||
errors[:no_event] = []
|
||||
|
|
@ -67,11 +73,10 @@ class Commercial < ApplicationRecord
|
|||
OEmbed::Providers::Instagram,
|
||||
speakerdeck
|
||||
)
|
||||
|
||||
OEmbed::Providers.register_fallback(
|
||||
OEmbed::ProviderDiscovery,
|
||||
OEmbed::Providers::Noembed
|
||||
)
|
||||
# OEmbed::Providers.register_fallback(
|
||||
# OEmbed::ProviderDiscovery,
|
||||
# OEmbed::Providers::Noembed
|
||||
# )
|
||||
end
|
||||
|
||||
def conference_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue