mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
DEV: Load SVG sprites during system spec runs (#19497)
Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
@ -498,16 +498,20 @@ module Discourse
|
|||||||
SiteSetting.force_https? ? "https" : "http"
|
SiteSetting.force_https? ? "https" : "http"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.base_url_no_prefix
|
def self.current_hostname_with_port
|
||||||
default_port = SiteSetting.force_https? ? 443 : 80
|
default_port = SiteSetting.force_https? ? 443 : 80
|
||||||
url = +"#{base_protocol}://#{current_hostname}"
|
result = +"#{current_hostname}"
|
||||||
url << ":#{SiteSetting.port}" if SiteSetting.port.to_i > 0 && SiteSetting.port.to_i != default_port
|
result << ":#{SiteSetting.port}" if SiteSetting.port.to_i > 0 && SiteSetting.port.to_i != default_port
|
||||||
|
|
||||||
if Rails.env.development? && SiteSetting.port.blank?
|
if Rails.env.development? && SiteSetting.port.blank?
|
||||||
url << ":#{ENV["UNICORN_PORT"] || 3000}"
|
result << ":#{ENV["UNICORN_PORT"] || 3000}"
|
||||||
end
|
end
|
||||||
|
|
||||||
url
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.base_url_no_prefix
|
||||||
|
"#{base_protocol}://#{current_hostname_with_port}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.base_url
|
def self.base_url
|
||||||
|
@ -18,7 +18,7 @@ module Middleware
|
|||||||
requested_hostname = env[Rack::HTTP_HOST]
|
requested_hostname = env[Rack::HTTP_HOST]
|
||||||
|
|
||||||
env[Discourse::REQUESTED_HOSTNAME] = requested_hostname
|
env[Discourse::REQUESTED_HOSTNAME] = requested_hostname
|
||||||
env[Rack::HTTP_HOST] = allowed_hostnames.find { |h| h == requested_hostname } || Discourse.current_hostname
|
env[Rack::HTTP_HOST] = allowed_hostnames.find { |h| h == requested_hostname } || Discourse.current_hostname_with_port
|
||||||
|
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,8 @@ module SystemHelpers
|
|||||||
def setup_system_test
|
def setup_system_test
|
||||||
SiteSetting.login_required = false
|
SiteSetting.login_required = false
|
||||||
SiteSetting.content_security_policy = false
|
SiteSetting.content_security_policy = false
|
||||||
SiteSetting.force_hostname = "#{Capybara.server_host}:#{Capybara.server_port}"
|
SiteSetting.force_hostname = Capybara.server_host
|
||||||
|
SiteSetting.port = Capybara.server_port
|
||||||
SiteSetting.external_system_avatars_enabled = false
|
SiteSetting.external_system_avatars_enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user