From fddcb8a7f702ed9c320279216d450ecd4864fc9c Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 15 Jul 2017 03:05:26 -0700 Subject: [PATCH] Add 'Redirect to HTTPS' setting and turn it on by default. #885 --- src/config/Config.coffee | 4 ++++ src/main/Main.coffee | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/config/Config.coffee b/src/config/Config.coffee index df0d794d1..ee3acf987 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -1,6 +1,10 @@ Config = main: 'Miscellaneous': + 'Redirect to HTTPS': [ + true + 'Redirect to the HTTPS version of 4chan.' + ] 'JSON Index': [ true 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.' diff --git a/src/main/Main.coffee b/src/main/Main.coffee index bc8037d9e..206581fab 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -71,6 +71,9 @@ Main = items[key] = undefined for key of Conf items['previousversion'] = undefined ($.getSync or $.get) items, (items) -> + if (items['Redirect to HTTPS'] ? Conf['Redirect to HTTPS']) and location.protocol isnt 'https:' + location.protocol = 'https:' + return $.asap docSet, -> # Don't hide the local storage warning behind a settings panel.