FIX: include onebox default options in development environment
This commit is contained in:
parent
9c1a713c6e
commit
6a417c308f
|
@ -1,7 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Onebox.options = {
|
||||
twitter_client: TwitterApi,
|
||||
redirect_limit: 3,
|
||||
user_agent: "Discourse Forum Onebox v#{Discourse::VERSION::STRING}"
|
||||
}
|
||||
if Rails.env.development? && SiteSetting.port.to_i > 0
|
||||
Onebox.options = {
|
||||
twitter_client: TwitterApi,
|
||||
redirect_limit: 3,
|
||||
user_agent: "Discourse Forum Onebox v#{Discourse::VERSION::STRING}",
|
||||
allowed_ports: [80, 443, SiteSetting.port.to_i]
|
||||
}
|
||||
else
|
||||
Onebox.options = {
|
||||
twitter_client: TwitterApi,
|
||||
redirect_limit: 3,
|
||||
user_agent: "Discourse Forum Onebox v#{Discourse::VERSION::STRING}"
|
||||
}
|
||||
end
|
||||
|
|
|
@ -290,10 +290,6 @@ module Oneboxer
|
|||
|
||||
options[:cookie] = fd.cookie if fd.cookie
|
||||
|
||||
if Rails.env.development? && SiteSetting.port.to_i > 0
|
||||
Onebox.options = { allowed_ports: [80, 443, SiteSetting.port.to_i] }
|
||||
end
|
||||
|
||||
r = Onebox.preview(uri.to_s, options)
|
||||
|
||||
{ onebox: r.to_s, preview: r&.placeholder_html.to_s }
|
||||
|
|
Loading…
Reference in New Issue