Ask all HTTP users to switch to HTTPS

pull/775/head
Thibaut Courouble 7 years ago
parent f94dbb0a61
commit a379b6299d

@ -72,3 +72,14 @@ app.templates.androidWarning = """
<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.
</div>
"""
app.templates.httpWarning = """
<div class="_intro"><div class="_intro-message">
<h2 class="_intro-title">Hi there!</h2>
<p>DevDocs is migrating to HTTPS.
<p>Please update your bookmarks to point to <a href="https://devdocs.io">https://devdocs.io</a>.
<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.
<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.
<p>Thanks for using DevDocs, and happy coding!
</div></div>
"""

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

Loading…
Cancel
Save