History

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

Thibaut Courouble committed 10 years ago

Commit d6823d81 parent 0cb57d54 files · +24 −17Browse files

Unified · Split

4 files
  1. assets/javascripts/app/config.coffee.erb +1 −1
  2. lib/app.rb +7 −0
  3. views/index.erb +13 −13
  4. views/other.erb +3 −3
assets/javascripts/app/config.coffee.erb+1−1
@@ -12,4 +12,4 @@ app.config = · 11 unmodified lines
12 sentry_dsn: '<%= App.sentry_dsn %>'12 sentry_dsn: '<%= App.sentry_dsn %>'
13 version: <%= Time.now.to_i %>13 version: <%= Time.now.to_i %>
14 release: <%= Time.now.utc.httpdate.to_json %>14 release: <%= Time.now.utc.httpdate.to_json %>
15 mathml_stylesheet: 'https://cdn.devdocs.io/mathml.css'15 mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css'
lib/app.rb+7−0
@@ -17,6 +17,8 @@ class App < Sinatra::Application · 16 unmodified lines
17 set :root, Pathname.new(File.expand_path('../..', __FILE__))17 set :root, Pathname.new(File.expand_path('../..', __FILE__))
18 set :sprockets, Sprockets::Environment.new(root)18 set :sprockets, Sprockets::Environment.new(root)
19 19
20 set :cdn_origin, ''
21
20 set :assets_prefix, 'assets'22 set :assets_prefix, 'assets'
21 set :assets_path, -> { File.join(public_folder, assets_prefix) }23 set :assets_path, -> { File.join(public_folder, assets_prefix) }
22 set :assets_manifest_path, -> { File.join(assets_path, 'manifest.json') }24 set :assets_manifest_path, -> { File.join(assets_path, 'manifest.json') }
@@ -72,6 +74,7 @@ class App < Sinatra::Application · 49 unmodified lines
72 74
73 configure :production do75 configure :production do
74 set :static, false76 set :static, false
77 set :cdn_origin, 'https://cdn.devdocs.io'
75 set :docs_host, '//docs.devdocs.io'78 set :docs_host, '//docs.devdocs.io'
76 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:;"79 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:;"
77 80
@@ -106,6 +109,10 @@ class App < Sinatra::Application · 28 unmodified lines
106 include Sinatra::Cookies109 include Sinatra::Cookies
107 include Sprockets::Helpers110 include Sprockets::Helpers
108 111
112 def canonical_origin
113 "http://#{request.host_with_port}"
114 end
115
109 def browser116 def browser
110 @browser ||= Browser.new(request.user_agent)117 @browser ||= Browser.new(request.user_agent)
111 end118 end
views/index.erb+13−13
@@ -7,25 +7,25 @@ · 6 unmodified lines
7 <meta property="og:title" content="DevDocs">7 <meta property="og:title" content="DevDocs">
8 <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.">8 <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.">
9 <meta property="og:type" content="website">9 <meta property="og:type" content="website">
10 <meta property="og:url" content="http://devdocs.io">10 <meta property="og:url" content="<%= canonical_origin %>">
11 <meta property="og:image" content="https://cdn.devdocs.io/images/icon-128.png">11 <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-128.png">
12 <meta name="apple-mobile-web-app-capable" content="yes">12 <meta name="apple-mobile-web-app-capable" content="yes">
13 <meta name="apple-mobile-web-app-status-bar-style" content="black">13 <meta name="apple-mobile-web-app-status-bar-style" content="black">
14 <meta name="format-detection" content="telephone=no">14 <meta name="format-detection" content="telephone=no">
15 <meta name="robots" content="noodp">15 <meta name="robots" content="noodp">
16 <title>DevDocs API Documentation</title>16 <title>DevDocs API Documentation</title>
17 <link rel="canonical" href="http://devdocs.io">17 <link rel="canonical" href="<%= canonical_origin %>">
18 <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="DevDocs Search">18 <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="DevDocs Search">
19 <link rel="alternate" href="http://devdocs.io/feed" title="DevDocs" type="application/atom+xml">19 <link rel="alternate" href="<%= canonical_origin %>/feed" title="DevDocs" type="application/atom+xml">
20 <link rel="icon" type="image/x-icon" href="https://cdn.devdocs.io/favicon.ico">20 <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico">
21 <link rel="fluid-icon" href="https://cdn.devdocs.io/images/fluid-icon.png" title="DevDocs">21 <link rel="fluid-icon" href="<%= App.cdn_origin %>/images/fluid-icon.png" title="DevDocs">
22 <link rel="apple-touch-icon" sizes="72x72" href="https://cdn.devdocs.io/images/apple-icon-72.png">22 <link rel="apple-touch-icon" sizes="72x72" href="<%= App.cdn_origin %>/images/apple-icon-72.png">
23 <link rel="apple-touch-icon" sizes="76x76" href="https://cdn.devdocs.io/images/apple-icon-76.png">23 <link rel="apple-touch-icon" sizes="76x76" href="<%= App.cdn_origin %>/images/apple-icon-76.png">
24 <link rel="apple-touch-icon" sizes="114x114" href="https://cdn.devdocs.io/images/apple-icon-114.png">24 <link rel="apple-touch-icon" sizes="114x114" href="<%= App.cdn_origin %>/images/apple-icon-114.png">
25 <link rel="apple-touch-icon" sizes="120x120" href="https://cdn.devdocs.io/images/apple-icon-120.png">25 <link rel="apple-touch-icon" sizes="120x120" href="<%= App.cdn_origin %>/images/apple-icon-120.png">
26 <link rel="apple-touch-icon" sizes="144x144" href="https://cdn.devdocs.io/images/apple-icon-144.png">26 <link rel="apple-touch-icon" sizes="144x144" href="<%= App.cdn_origin %>/images/apple-icon-144.png">
27 <link rel="apple-touch-icon" sizes="152x152" href="https://cdn.devdocs.io/images/apple-icon-152.png">27 <link rel="apple-touch-icon" sizes="152x152" href="<%= App.cdn_origin %>/images/apple-icon-152.png">
28 <link rel="apple-touch-icon" sizes="160x160" href="https://cdn.devdocs.io/images/apple-icon-160.png">28 <link rel="apple-touch-icon" sizes="160x160" href="<%= App.cdn_origin %>/images/apple-icon-160.png">
29 <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">29 <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">
30 <%= javascript_tag 'application', asset_host: false %>30 <%= javascript_tag 'application', asset_host: false %>
31 <%= javascript_tag 'docs' %><% unless App.production? %>31 <%= javascript_tag 'docs' %><% unless App.production? %>
views/other.erb+3−3
@@ -5,10 +5,10 @@ · 4 unmodified lines
5 <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">5 <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
6 <% 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 %>6 <% 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 %>
7 <meta name="format-detection" content="telephone=no">7 <meta name="format-detection" content="telephone=no">
8 <meta property="og:image" content="https://cdn.devdocs.io/images/icon-128.png">8 <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-128.png">
9 <title>DevDocs<%= " - #{@doc['full_name']} documentation" if doc_index_page? %></title>9 <title>DevDocs<%= " - #{@doc['full_name']} documentation" if doc_index_page? %></title>
10 <link rel="canonical" href="http://devdocs.io<%= request.path %>">10 <link rel="canonical" href="<%= canonical_origin %><%= request.path %>">
11 <link rel="icon" type="image/x-icon" href="https://cdn.devdocs.io/favicon.ico">11 <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico">
12 <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs">12 <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs">
13 <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">13 <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">
14 <%= javascript_tag 'application', asset_host: false %><% unless App.production? %>14 <%= javascript_tag 'application', asset_host: false %><% unless App.production? %>