mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
26 lines
499 B
Ruby
26 lines
499 B
Ruby
module GlobalPath
|
|
def path(p)
|
|
"#{GlobalSetting.relative_url_root}#{p}"
|
|
end
|
|
|
|
def cdn_path(p)
|
|
GlobalSetting.cdn_url.blank? ? p : "#{GlobalSetting.cdn_url}#{path(p)}"
|
|
end
|
|
|
|
def upload_cdn_path(p)
|
|
if SiteSetting.Upload.s3_cdn_url.present?
|
|
p = Discourse.store.cdn_url(p)
|
|
end
|
|
p =~ /^http/ ? p : cdn_path(p)
|
|
end
|
|
|
|
def cdn_relative_path(path)
|
|
if (cdn_url = GlobalSetting.cdn_url).present?
|
|
URI.parse(cdn_url).path + path
|
|
else
|
|
path
|
|
end
|
|
end
|
|
|
|
end
|