Make hardcoded refs to devdocs.io and cdn.devdocs.io config vars

pull/513/head
Thibaut Courouble 8 years ago
parent 0cb57d5e98
commit d6823d823a

@ -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'

@ -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

@ -7,25 +7,25 @@
<meta property="og:title" content="DevDocs">
<meta property="og:description" content="DevDocs is an API documentation browser that combines 100+ docs in a single UI with offline mode, instant search, keyboard shortcuts, and more.">
<meta property="og:type" content="website">
<meta property="og:url" content="http://devdocs.io">
<meta property="og:image" content="https://cdn.devdocs.io/images/icon-128.png">
<meta property="og:url" content="<%= canonical_origin %>">
<meta property="og:image" content="<%= App.cdn_origin %>/images/icon-128.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="robots" content="noodp">
<title>DevDocs API Documentation</title>
<link rel="canonical" href="http://devdocs.io">
<link rel="canonical" href="<%= canonical_origin %>">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="DevDocs Search">
<link rel="alternate" href="http://devdocs.io/feed" title="DevDocs" type="application/atom+xml">
<link rel="icon" type="image/x-icon" href="https://cdn.devdocs.io/favicon.ico">
<link rel="fluid-icon" href="https://cdn.devdocs.io/images/fluid-icon.png" title="DevDocs">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.devdocs.io/images/apple-icon-72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.devdocs.io/images/apple-icon-76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.devdocs.io/images/apple-icon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.devdocs.io/images/apple-icon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.devdocs.io/images/apple-icon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.devdocs.io/images/apple-icon-152.png">
<link rel="apple-touch-icon" sizes="160x160" href="https://cdn.devdocs.io/images/apple-icon-160.png">
<link rel="alternate" href="<%= canonical_origin %>/feed" title="DevDocs" type="application/atom+xml">
<link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico">
<link rel="fluid-icon" href="<%= App.cdn_origin %>/images/fluid-icon.png" title="DevDocs">
<link rel="apple-touch-icon" sizes="72x72" href="<%= App.cdn_origin %>/images/apple-icon-72.png">
<link rel="apple-touch-icon" sizes="76x76" href="<%= App.cdn_origin %>/images/apple-icon-76.png">
<link rel="apple-touch-icon" sizes="114x114" href="<%= App.cdn_origin %>/images/apple-icon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="<%= App.cdn_origin %>/images/apple-icon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="<%= App.cdn_origin %>/images/apple-icon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="<%= App.cdn_origin %>/images/apple-icon-152.png">
<link rel="apple-touch-icon" sizes="160x160" href="<%= App.cdn_origin %>/images/apple-icon-160.png">
<link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">
<%= javascript_tag 'application', asset_host: false %>
<%= javascript_tag 'docs' %><% unless App.production? %>

@ -5,10 +5,10 @@
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<% if doc_index_page? %><meta name="description" content="<%= @doc['full_name'] %> API documentation with instant search, offline mode, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %>
<meta name="format-detection" content="telephone=no">
<meta property="og:image" content="https://cdn.devdocs.io/images/icon-128.png">
<meta property="og:image" content="<%= App.cdn_origin %>/images/icon-128.png">
<title>DevDocs<%= " - #{@doc['full_name']} documentation" if doc_index_page? %></title>
<link rel="canonical" href="http://devdocs.io<%= request.path %>">
<link rel="icon" type="image/x-icon" href="https://cdn.devdocs.io/favicon.ico">
<link rel="canonical" href="<%= canonical_origin %><%= request.path %>">
<link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs">
<link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">
<%= javascript_tag 'application', asset_host: false %><% unless App.production? %>

Loading…
Cancel
Save