mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
BUGFIX: re-enable CDN js debugging in a robust way
May be disabled if needed via site setting
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user