diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 67651cc0a55..e534aa50da7 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -45,17 +45,17 @@ module ApplicationHelper
end
end
- def script(*args)
+ def preload_script(script)
+ path = asset_path("#{script}.js")
+
if GlobalSetting.cdn_url &&
GlobalSetting.cdn_url.start_with?("https") &&
ENV["COMPRESS_BROTLI"] == "1" &&
request.env["HTTP_ACCEPT_ENCODING"] =~ /br/
- tags = javascript_include_tag(*args)
- tags.gsub!("#{GlobalSetting.cdn_url}/assets/", "#{GlobalSetting.cdn_url}/brotli_asset/")
- tags.html_safe
- else
- javascript_include_tag(*args)
+ path.gsub!("#{GlobalSetting.cdn_url}/assets/", "#{GlobalSetting.cdn_url}/brotli_asset/")
end
+"
+".html_safe
end
def discourse_csrf_tags
diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb
index 9e2da0a9005..05e0a95f948 100644
--- a/app/views/common/_discourse_javascript.html.erb
+++ b/app/views/common/_discourse_javascript.html.erb
@@ -65,4 +65,4 @@
})();
-<%= script 'browser-update' %>
+<%= preload_script 'browser-update' %>
diff --git a/app/views/common/_special_font_face.html.erb b/app/views/common/_special_font_face.html.erb
index 8e95e5ece86..2462461c24e 100644
--- a/app/views/common/_special_font_face.html.erb
+++ b/app/views/common/_special_font_face.html.erb
@@ -10,6 +10,7 @@
<% font_domain = "#{request.protocol}#{request.host_with_port}&2" %>
+" as="font" type="font/woff2" crossorigin />