Rename docs_host → docs_origin

pull/513/head
Thibaut Courouble 8 years ago
parent d6823d823a
commit 7419d24453

@ -196,7 +196,7 @@
indexHost: -> indexHost: ->
# Can't load the index files from the host/CDN when applicationCache is # Can't load the index files from the host/CDN when applicationCache is
# enabled because it doesn't support caching URLs that use CORS. # 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...) -> onBootError: (args...) ->
@trigger 'bootError' @trigger 'bootError'

@ -1,7 +1,7 @@
app.config = app.config =
db_filename: 'db.json' db_filename: 'db.json'
default_docs: <%= App.default_docs.to_json %> default_docs: <%= App.default_docs.to_json %>
docs_host: '<%= App.docs_host %>' docs_origin: '<%= App.docs_origin %>'
env: '<%= App.environment %>' env: '<%= App.environment %>'
history_cache_size: 10 history_cache_size: 10
index_filename: 'index.json' index_filename: 'index.json'

@ -30,10 +30,10 @@ class app.models.Doc extends app.Model
"/#{@slug}#{path}" "/#{@slug}#{path}"
fileUrl: (path) -> fileUrl: (path) ->
"#{app.config.docs_host}#{@fullPath(path)}?#{@mtime}" "#{app.config.docs_origin}#{@fullPath(path)}?#{@mtime}"
dbUrl: -> dbUrl: ->
"#{app.config.docs_host}/#{@slug}/#{app.config.db_filename}?#{@mtime}" "#{app.config.docs_origin}/#{@slug}/#{app.config.db_filename}?#{@mtime}"
indexUrl: -> indexUrl: ->
"#{app.indexHost()}/#{@slug}/#{app.config.index_filename}?#{@mtime}" "#{app.indexHost()}/#{@slug}/#{app.config.index_filename}?#{@mtime}"

@ -26,7 +26,7 @@ class App < Sinatra::Application
require 'yajl/json_gem' require 'yajl/json_gem'
set :docs_prefix, 'docs' 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_path, -> { File.join(public_folder, docs_prefix) }
set :docs_manifest_path, -> { File.join(docs_path, 'docs.json') } set :docs_manifest_path, -> { File.join(docs_path, 'docs.json') }
set :default_docs, %w(css dom dom_events html http javascript) set :default_docs, %w(css dom dom_events html http javascript)
@ -75,7 +75,7 @@ class App < Sinatra::Application
configure :production do configure :production do
set :static, false set :static, false
set :cdn_origin, 'https://cdn.devdocs.io' 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:;" 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 use Rack::ConditionalGet

Loading…
Cancel
Save