Unified · Split
| @@ -12,7 +12,7 @@ app.config = · 11 unmodified lines | ||
| 12 | 12 | sentry_dsn: '<%= App.sentry_dsn %>' |
| 13 | 13 | version: <%= Time.now.to_i %> |
| 14 | 14 | release: <%= Time.now.utc.httpdate.to_json %> |
| 15 | − mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css' | |
| 15 | + mathml_stylesheet: '/mathml.css' | |
| 16 | 16 | favicon_spritesheet: '<%= image_path('sprites/docs.png') %>' |
| 17 | 17 | service_worker_path: '/service-worker.js' |
| 18 | 18 | service_worker_enabled: <%= App.environment == :production || ENV['ENABLE_SERVICE_WORKER'] == 'true' %> |
| @@ -20,8 +20,6 @@ class App < Sinatra::Application · 19 unmodified lines | ||
| 20 | 20 | set :root, Pathname.new(File.expand_path('../..', __FILE__)) |
| 21 | 21 | set :sprockets, Sprockets::Environment.new(root) |
| 22 | 22 | |
| 23 | − set :cdn_origin, '' | |
| 24 | − | |
| 25 | 23 | set :assets_prefix, 'assets' |
| 26 | 24 | set :assets_path, File.join(public_folder, assets_prefix) |
| 27 | 25 | set :assets_manifest_path, File.join(assets_path, 'manifest.json') |
| @@ -75,9 +73,8 @@ class App < Sinatra::Application · 47 unmodified lines | ||
| 75 | 73 | |
| 76 | 74 | configure :production do |
| 77 | 75 | set :static, false |
| 78 | − set :cdn_origin, 'https://cdn.devdocs.io' | |
| 79 | − set :docs_origin, '//docs.devdocs.io' | |
| 80 | − set :csp, "default-src 'self' *; script-src 'self' 'nonce-devdocs' https://cdn.devdocs.io https://www.google-analytics.com https://secure.gaug.es https://*.jquery.com; font-src 'none'; style-src 'self' 'unsafe-inline' *; img-src 'self' * data:;" | |
| 76 | + set :docs_origin, '//documents.devdocs.io' | |
| 77 | + set :csp, "default-src 'self' *; script-src 'self' 'nonce-devdocs' https://www.google-analytics.com https://secure.gaug.es https://*.jquery.com; font-src 'none'; style-src 'self' 'unsafe-inline' *; img-src 'self' * data:;" | |
| 81 | 78 | |
| 82 | 79 | use Rack::ConditionalGet |
| 83 | 80 | use Rack::ETag |
| @@ -102,7 +99,6 @@ class App < Sinatra::Application · 18 unmodified lines | ||
| 102 | 99 | |
| 103 | 100 | Sprockets::Helpers.configure do |config| |
| 104 | 101 | config.digest = true |
| 105 | − config.asset_host = 'cdn.devdocs.io' | |
| 106 | 102 | config.manifest = Sprockets::Manifest.new(sprockets, assets_manifest_path) |
| 107 | 103 | end |
| 108 | 104 | end |
| @@ -202,7 +198,7 @@ class App < Sinatra::Application · 93 unmodified lines | ||
| 202 | 198 | |
| 203 | 199 | def service_worker_asset_urls |
| 204 | 200 | @@service_worker_asset_urls ||= [ |
| 205 | − javascript_path('application', asset_host: false), | |
| 201 | + javascript_path('application'), | |
| 206 | 202 | stylesheet_path('application'), |
| 207 | 203 | image_path('sprites/docs.png'), |
| 208 | 204 | image_path('sprites/docs@2x.png'), |
| @@ -191,27 +191,23 @@ class DocsCLI < Thor · 190 unmodified lines | ||
| 191 | 191 | puts '[S3] Begin syncing.' |
| 192 | 192 | docs.each do |doc| |
| 193 | 193 | puts "[S3] Syncing #{doc.path}..." |
| 194 | − cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-assets/#{doc.path} --delete --profile devdocs" | |
| 194 | + cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-documents/#{doc.path} --delete --profile devdocs" | |
| 195 | 195 | cmd << ' --dryrun' if options[:dryrun] |
| 196 | 196 | system(cmd) |
| 197 | 197 | end |
| 198 | 198 | puts '[S3] Done syncing.' |
| 199 | 199 | |
| 200 | − # Upload packages to dl.devdocs.io (used by the "thor docs:download" command) | |
| 201 | − puts '[MaxCDN] Begin uploading.' | |
| 202 | − Net::SFTP.start('ftp.devdocs-dl.devdocs.netdna-cdn.com', ENV['DEVDOCS_DL_USERNAME'], password: ENV['DEVDOCS_DL_PASSWORD']) do |sftp| | |
| 203 | − docs.each do |doc| | |
| 204 | − filename = "#{doc.path}.tar.gz" | |
| 205 | − print "[MaxCDN] Uploading #{filename}..." | |
| 206 | − if options[:dryrun] | |
| 207 | − print "\n" | |
| 208 | − else | |
| 209 | − sftp.upload! File.join(Docs.store_path, filename), File.join('', 'public_html', filename) | |
| 210 | − print " OK\n" | |
| 211 | − end | |
| 212 | − end | |
| 200 | + # Upload packages to downloads.devdocs.io (used by the "thor docs:download" command) | |
| 201 | + puts '[S3 bundle] Begin uploading.' | |
| 202 | + | |
| 203 | + docs.each do |doc| | |
| 204 | + filename = "#{doc.path}.tar.gz" | |
| 205 | + puts "[S3 bundle] Uploading #{filename}..." | |
| 206 | + cmd = "aws s3 cp #{File.join(Docs.store_path, filename)} s3://devdocs-downloads/#{filename} --profile devdocs" | |
| 207 | + cmd << ' --dryrun' if options[:dryrun] | |
| 208 | + system(cmd) | |
| 213 | 209 | end |
| 214 | − puts '[MaxCDN] Done uploading.' | |
| 210 | + puts '[S3 bundle] Done uploading.' | |
| 215 | 211 | end |
| 216 | 212 | |
| 217 | 213 | desc 'commit', '[private]' |
| @@ -244,7 +240,7 @@ class DocsCLI < Thor · 26 unmodified lines | ||
| 244 | 240 | FileUtils.mkpath(dir) |
| 245 | 241 | |
| 246 | 242 | ['index.json', 'meta.json'].each do |filename| |
| 247 | − json = "https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}" | |
| 243 | + json = "https://documents.devdocs.io/#{doc.path}/#{filename}?#{time}" | |
| 248 | 244 | begin |
| 249 | 245 | open(json) do |file| |
| 250 | 246 | mutex.synchronize do |
| @@ -341,7 +337,7 @@ class DocsCLI < Thor · 90 unmodified lines | ||
| 341 | 337 | |
| 342 | 338 | def download_doc(doc) |
| 343 | 339 | target_path = File.join(Docs.store_path, doc.path) |
| 344 | − open "http://dl.devdocs.io/#{doc.path}.tar.gz" do |file| | |
| 340 | + open "https://downloads.devdocs.io/#{doc.path}.tar.gz" do |file| | |
| 345 | 341 | FileUtils.mkpath(target_path) |
| 346 | 342 | file.close |
| 347 | 343 | tar = UnixUtils.gunzip(file.path) |
| @@ -4,8 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | <Description>Search API documentation</Description> |
| 5 | 5 | <Tags>devdocs</Tags> |
| 6 | 6 | <Url type="text/html" method="get" template="https://devdocs.io/#q={searchTerms}"/> |
| 7 | − <Image height="16" width="16" type="image/vnd.microsoft.icon">https://cdn.devdocs.io/favicon.ico</Image> | |
| 8 | − <Image height="64" width="64" type="image/x-icon">https://cdn.devdocs.io/images/icon-64.png</Image> | |
| 7 | + <Image height="16" width="16" type="image/vnd.microsoft.icon">https://devdocs.io/favicon.ico</Image> | |
| 8 | + <Image height="64" width="64" type="image/x-icon">https://devdocs.io/images/icon-64.png</Image> | |
| 9 | 9 | <InputEncoding>UTF-8</InputEncoding> |
| 10 | 10 | <moz:SearchForm>https://devdocs.io</moz:SearchForm> |
| 11 | 11 | <Url type="application/opensearchdescription+xml" rel="self" template="https://devdocs.io/opensearch.xml"/> |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | <meta property="og:description" content="Fast, offline, and free documentation browser for developers. Search 100+ docs in one web app including HTML, CSS, JavaScript, PHP, Ruby, Python, Go, C, C++, and many more."> |
| 10 | 10 | <meta property="og:type" content="website"> |
| 11 | 11 | <meta property="og:url" content="<%= canonical_origin %>"> |
| 12 | − <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-320.png"> | |
| 12 | + <meta property="og:image" content="/images/icon-320.png"> | |
| 13 | 13 | <meta name="apple-mobile-web-app-title" content="DevDocs"> |
| 14 | 14 | <meta name="apple-mobile-web-app-capable" content="yes"> |
| 15 | 15 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| @@ -21,22 +21,22 @@ · 5 unmodified lines | ||
| 21 | 21 | <link rel="manifest" href="/manifest.json"> |
| 22 | 22 | <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="DevDocs Search"> |
| 23 | 23 | <link rel="alternate" href="<%= canonical_origin %>/feed" title="DevDocs" type="application/atom+xml"> |
| 24 | − <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico"> | |
| 25 | − <link rel="fluid-icon" href="<%= App.cdn_origin %>/images/fluid-icon.png" title="DevDocs"> | |
| 26 | − <link rel="apple-touch-icon" sizes="72x72" href="<%= App.cdn_origin %>/images/apple-icon-72.png"> | |
| 27 | − <link rel="apple-touch-icon" sizes="76x76" href="<%= App.cdn_origin %>/images/apple-icon-76.png"> | |
| 28 | − <link rel="apple-touch-icon" sizes="114x114" href="<%= App.cdn_origin %>/images/apple-icon-114.png"> | |
| 29 | − <link rel="apple-touch-icon" sizes="120x120" href="<%= App.cdn_origin %>/images/apple-icon-120.png"> | |
| 30 | − <link rel="apple-touch-icon" sizes="144x144" href="<%= App.cdn_origin %>/images/apple-icon-144.png"> | |
| 31 | − <link rel="apple-touch-icon" sizes="152x152" href="<%= App.cdn_origin %>/images/apple-icon-152.png"> | |
| 32 | − <link rel="apple-touch-icon" sizes="160x160" href="<%= App.cdn_origin %>/images/apple-icon-160.png"> | |
| 33 | − <link rel="mask-icon" href="<%= App.cdn_origin %>/images/webkit-mask-icon.svg" color="#398df0"> | |
| 24 | + <link rel="icon" type="image/x-icon" href="/favicon.ico"> | |
| 25 | + <link rel="fluid-icon" href="/images/fluid-icon.png" title="DevDocs"> | |
| 26 | + <link rel="apple-touch-icon" sizes="72x72" href="/images/apple-icon-72.png"> | |
| 27 | + <link rel="apple-touch-icon" sizes="76x76" href="/images/apple-icon-76.png"> | |
| 28 | + <link rel="apple-touch-icon" sizes="114x114" href="/images/apple-icon-114.png"> | |
| 29 | + <link rel="apple-touch-icon" sizes="120x120" href="/images/apple-icon-120.png"> | |
| 30 | + <link rel="apple-touch-icon" sizes="144x144" href="/images/apple-icon-144.png"> | |
| 31 | + <link rel="apple-touch-icon" sizes="152x152" href="/images/apple-icon-152.png"> | |
| 32 | + <link rel="apple-touch-icon" sizes="160x160" href="/images/apple-icon-160.png"> | |
| 33 | + <link rel="mask-icon" href="/images/webkit-mask-icon.svg" color="#398df0"> | |
| 34 | 34 | <%= stylesheet_tag 'application' %> |
| 35 | 35 | </head> |
| 36 | 36 | <body> |
| 37 | 37 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> |
| 38 | 38 | <%= erb :app -%> |
| 39 | −<%= javascript_tag 'application', asset_host: false %> | |
| 39 | +<%= javascript_tag 'application' %> | |
| 40 | 40 | <%= javascript_tag 'docs' %><% unless App.production? %> |
| 41 | 41 | <%= javascript_tag 'debug' %><% end %> |
| 42 | 42 | </body> |
| @@ -6,18 +6,18 @@ · 5 unmodified lines | ||
| 6 | 6 | <% if doc_index_page? %><meta name="description" content="<%= @doc['name'] %> <%= @doc['release'] %> API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %> |
| 7 | 7 | <meta name="format-detection" content="telephone=no"> |
| 8 | 8 | <meta name="theme-color" content="#eee"> |
| 9 | − <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-320.png"> | |
| 9 | + <meta property="og:image" content="/images/icon-320.png"> | |
| 10 | 10 | <title>DevDocs<%= " — #{@doc['full_name']} documentation" if doc_index_page? %></title> |
| 11 | 11 | <link rel="canonical" href="<%= canonical_origin %><%= request.path %>"> |
| 12 | 12 | <link rel="manifest" href="/manifest.json"> |
| 13 | − <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico"> | |
| 13 | + <link rel="icon" type="image/x-icon" href="/favicon.ico"> | |
| 14 | 14 | <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs"> |
| 15 | 15 | <%= stylesheet_tag 'application' %> |
| 16 | 16 | </head> |
| 17 | 17 | <body data-doc="<%= CGI::escape_html @doc.to_json %>"> |
| 18 | 18 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> |
| 19 | 19 | <%= erb :app -%> |
| 20 | −<%= javascript_tag 'application', asset_host: false %><% unless App.production? %> | |
| 20 | +<%= javascript_tag 'application' %><% unless App.production? %> | |
| 21 | 21 | <%= javascript_tag 'debug' %><% end %> |
| 22 | 22 | </body> |
| 23 | 23 | </html> |