History

Ask all HTTP users to switch to HTTPS

Thibaut Courouble committed 8 years ago

Commit a379b621 parent f94dbb02 files · +25 −3Browse files

Unified · Split

2 files
  1. assets/javascripts/templates/pages/root_tmpl.coffee.erb +11 −0
  2. assets/javascripts/views/content/root_page.coffee +14 −3
assets/javascripts/templates/pages/root_tmpl.coffee.erb+11−0
@@ -72,3 +72,14 @@ app.templates.androidWarning = """ · 71 unmodified lines
7272 <p>To install DevDocs on your phone, visit <a href="https://devdocs.io" target="_blank" rel="noopener">devdocs.io</a> in Chrome and select "Add to home screen" in the menu.
7373 </div>
7474 """
75+
76+app.templates.httpWarning = """
77+ <div class="_intro"><div class="_intro-message">
78+ <h2 class="_intro-title">Hi there!</h2>
79+ <p>DevDocs is migrating to HTTPS.
80+ <p>Please update your bookmarks to point to <a href="https://devdocs.io">https://devdocs.io</a>.
81+ <p>When using the HTTPS version, your preferences will carry over automatically, but your offline data will be reset. Simply re-download documentation in the <a href="https://devdocs.io/offline">Offline area</a>, and you'll be all set to use DevDocs securely offline.
82+ <p>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.
83+ <p>Thanks for using DevDocs, and happy coding!
84+ </div></div>
85+"""
assets/javascripts/views/content/root_page.coffee+14−3
@@ -9,10 +9,21 @@ class app.views.RootPage extends app.View · 8 unmodified lines
99
1010 render: ->
1111 @empty()
12− if app.isAndroidWebview()
13− @append @tmpl('androidWarning')
12+
13+ tmpl = if app.isAndroidWebview()
14+ 'androidWarning'
15+ else if @isHidden()
16+ 'splash'
17+ else if app.isMobile()
18+ 'mobileIntro'
1419 else
15− @append @tmpl if @isHidden() then 'splash' else if app.isMobile() then 'mobileIntro' else 'intro'
20+ 'intro'
21+
22+ # temporary
23+ if location.host is 'devdocs.io' and location.protocol is 'http:'
24+ tmpl = 'httpWarning'
25+
26+ @append @tmpl(tmpl)
1627 return
1728
1829 hideIntro: ->