diff --git a/assets/javascripts/app/config.coffee.erb b/assets/javascripts/app/config.coffee.erb index 56ac3512..e54a1b73 100644 --- a/assets/javascripts/app/config.coffee.erb +++ b/assets/javascripts/app/config.coffee.erb @@ -12,4 +12,4 @@ app.config = sentry_dsn: '<%= App.sentry_dsn %>' version: <%= Time.now.to_i %> release: <%= Time.now.utc.httpdate.to_json %> - mathml_stylesheet: 'https://cdn.devdocs.io/mathml.css' + mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css' diff --git a/lib/app.rb b/lib/app.rb index d8394d6c..7b1b5c9f 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -17,6 +17,8 @@ class App < Sinatra::Application set :root, Pathname.new(File.expand_path('../..', __FILE__)) set :sprockets, Sprockets::Environment.new(root) + set :cdn_origin, '' + set :assets_prefix, 'assets' set :assets_path, -> { File.join(public_folder, assets_prefix) } set :assets_manifest_path, -> { File.join(assets_path, 'manifest.json') } @@ -72,6 +74,7 @@ class App < Sinatra::Application configure :production do set :static, false + set :cdn_origin, 'https://cdn.devdocs.io' set :docs_host, '//docs.devdocs.io' set :csp, "default-src 'self' *; script-src 'self' 'nonce-devdocs' http://cdn.devdocs.io https://cdn.devdocs.io https://www.google-analytics.com https://secure.gaug.es http://*.jquery.com https://*.jquery.com; font-src data:; style-src 'self' 'unsafe-inline' *; img-src 'self' * data:;" @@ -106,6 +109,10 @@ class App < Sinatra::Application include Sinatra::Cookies include Sprockets::Helpers + def canonical_origin + "http://#{request.host_with_port}" + end + def browser @browser ||= Browser.new(request.user_agent) end diff --git a/views/index.erb b/views/index.erb index 30fd75cb..53cdc96c 100644 --- a/views/index.erb +++ b/views/index.erb @@ -7,25 +7,25 @@ - - + +