From a379b6299d75b6e2a94ce1fc016f75f29fd95095 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 18 Mar 2018 21:50:55 -0400 Subject: [PATCH] Ask all HTTP users to switch to HTTPS --- .../templates/pages/root_tmpl.coffee.erb | 11 +++++++++++ .../javascripts/views/content/root_page.coffee | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/templates/pages/root_tmpl.coffee.erb b/assets/javascripts/templates/pages/root_tmpl.coffee.erb index 0df510b8..f88e4a44 100644 --- a/assets/javascripts/templates/pages/root_tmpl.coffee.erb +++ b/assets/javascripts/templates/pages/root_tmpl.coffee.erb @@ -72,3 +72,14 @@ app.templates.androidWarning = """

To install DevDocs on your phone, visit devdocs.io in Chrome and select "Add to home screen" in the menu. """ + +app.templates.httpWarning = """ +

+

Hi there!

+

DevDocs is migrating to HTTPS. +

Please update your bookmarks to point to https://devdocs.io. +

When using the HTTPS version, your preferences will carry over automatically, but your offline data will be reset. Simply re-download documentation in the Offline area, and you'll be all set to use DevDocs securely offline. +

Sorry for the inconvenience. This migration is needed because browsers are removing support for certain DOM APIs that power DevDocs's offline mode over non-secure origins. +

Thanks for using DevDocs, and happy coding! +

+""" diff --git a/assets/javascripts/views/content/root_page.coffee b/assets/javascripts/views/content/root_page.coffee index c963830b..e442887a 100644 --- a/assets/javascripts/views/content/root_page.coffee +++ b/assets/javascripts/views/content/root_page.coffee @@ -9,10 +9,21 @@ class app.views.RootPage extends app.View render: -> @empty() - if app.isAndroidWebview() - @append @tmpl('androidWarning') + + tmpl = if app.isAndroidWebview() + 'androidWarning' + else if @isHidden() + 'splash' + else if app.isMobile() + 'mobileIntro' else - @append @tmpl if @isHidden() then 'splash' else if app.isMobile() then 'mobileIntro' else 'intro' + 'intro' + + # temporary + if location.host is 'devdocs.io' and location.protocol is 'http:' + tmpl = 'httpWarning' + + @append @tmpl(tmpl) return hideIntro: ->