diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index b700d611..82661d7e 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -196,7 +196,7 @@ indexHost: -> # Can't load the index files from the host/CDN when applicationCache is # enabled because it doesn't support caching URLs that use CORS. - @config[if @appCache and @settings.hasDocs() then 'index_path' else 'docs_host'] + @config[if @appCache and @settings.hasDocs() then 'index_path' else 'docs_origin'] onBootError: (args...) -> @trigger 'bootError' diff --git a/assets/javascripts/app/config.coffee.erb b/assets/javascripts/app/config.coffee.erb index e54a1b73..ec26b697 100644 --- a/assets/javascripts/app/config.coffee.erb +++ b/assets/javascripts/app/config.coffee.erb @@ -1,7 +1,7 @@ app.config = db_filename: 'db.json' default_docs: <%= App.default_docs.to_json %> - docs_host: '<%= App.docs_host %>' + docs_origin: '<%= App.docs_origin %>' env: '<%= App.environment %>' history_cache_size: 10 index_filename: 'index.json' diff --git a/assets/javascripts/models/doc.coffee b/assets/javascripts/models/doc.coffee index 642fa1ff..2d5f7e4a 100644 --- a/assets/javascripts/models/doc.coffee +++ b/assets/javascripts/models/doc.coffee @@ -30,10 +30,10 @@ class app.models.Doc extends app.Model "/#{@slug}#{path}" fileUrl: (path) -> - "#{app.config.docs_host}#{@fullPath(path)}?#{@mtime}" + "#{app.config.docs_origin}#{@fullPath(path)}?#{@mtime}" dbUrl: -> - "#{app.config.docs_host}/#{@slug}/#{app.config.db_filename}?#{@mtime}" + "#{app.config.docs_origin}/#{@slug}/#{app.config.db_filename}?#{@mtime}" indexUrl: -> "#{app.indexHost()}/#{@slug}/#{app.config.index_filename}?#{@mtime}" diff --git a/lib/app.rb b/lib/app.rb index 7b1b5c9f..52b40dbf 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -26,7 +26,7 @@ class App < Sinatra::Application require 'yajl/json_gem' set :docs_prefix, 'docs' - set :docs_host, -> { File.join('', docs_prefix) } + set :docs_origin, -> { File.join('', docs_prefix) } set :docs_path, -> { File.join(public_folder, docs_prefix) } set :docs_manifest_path, -> { File.join(docs_path, 'docs.json') } set :default_docs, %w(css dom dom_events html http javascript) @@ -75,7 +75,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 :docs_origin, '//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:;" use Rack::ConditionalGet