mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #469 from wojciechka/master
Support for running discourse with a prefix (i.e. as http://servername/discourse)
This commit is contained in:
@@ -18,6 +18,14 @@ module Discourse
|
||||
RailsMultisite::ConnectionManagement.current_hostname
|
||||
end
|
||||
|
||||
def self.base_uri
|
||||
if !ActionController::Base.config.relative_url_root.blank?
|
||||
return ActionController::Base.config.relative_url_root
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
def self.base_url
|
||||
protocol = "http"
|
||||
protocol = "https" if SiteSetting.use_ssl?
|
||||
@@ -27,6 +35,7 @@ module Discourse
|
||||
result = "#{protocol}://#{current_hostname}"
|
||||
end
|
||||
result << ":#{SiteSetting.port}" if SiteSetting.port.present? && SiteSetting.port.to_i > 0
|
||||
result << ActionController::Base.config.relative_url_root if !ActionController::Base.config.relative_url_root.blank?
|
||||
result
|
||||
end
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ module PrettyText
|
||||
# we need to do this to work in a multi site environment, many sites, many settings
|
||||
v8.eval("Discourse.SiteSettings = #{SiteSetting.client_settings_json};")
|
||||
v8.eval("Discourse.BaseUrl = 'http://#{RailsMultisite::ConnectionManagement.current_hostname}';")
|
||||
v8.eval("Discourse.getURL = function(url) {return '#{Discourse::base_uri}' + url};")
|
||||
v8['opts'] = opts || {}
|
||||
v8['raw'] = text
|
||||
v8.eval('opts["mentionLookup"] = function(u){return helpers.is_username_valid(u);}')
|
||||
|
||||
Reference in New Issue
Block a user