BUGFIX: re-enable CDN js debugging in a robust way

May be disabled if needed via site setting
This commit is contained in:
Sam
2014-05-19 08:46:09 +10:00
parent 5901ed6842
commit 832a730e36
6 changed files with 26 additions and 10 deletions

View File

@@ -12,14 +12,14 @@ module ApplicationHelper
include ConfigurableUrls
def script(*args)
# This crazy stuff is needed to get window.onerror working under a CDN
# NGINX change is also required and baked into sample config
# @sam: disabling this until we update our CDN configuration
#if GlobalSetting.cdn_url
# javascript_include_tag(*args, "crossorigin" => "anonymous")
#else
if SiteSetting.enable_cdn_js_debugging && GlobalSetting.cdn_url
tags = javascript_include_tag(*args, "crossorigin" => "anonymous")
tags.gsub!("/assets/", "/cdn_asset/#{Discourse.current_hostname.gsub(".","_")}/")
tags.gsub!(".js\"", ".js?origin=#{CGI.escape request.base_url}\"")
tags.html_safe
else
javascript_include_tag(*args)
#end
end
end
def discourse_csrf_tags