Don't allow changing 'Redirect to HTTPS' setting from non-HTTPS sites.
This commit is contained in:
parent
a732376d69
commit
4c1518c1a4
@ -166,7 +166,7 @@ Settings =
|
|||||||
# Unsupported options
|
# Unsupported options
|
||||||
if $.engine isnt 'gecko'
|
if $.engine isnt 'gecko'
|
||||||
$('div[data-name="Remember QR Size"]', section).hidden = true
|
$('div[data-name="Remember QR Size"]', section).hidden = true
|
||||||
if $.perProtocolSettings
|
if $.perProtocolSettings or location.protocol isnt 'https:'
|
||||||
$('div[data-name="Redirect to HTTPS"]', section).hidden = true
|
$('div[data-name="Redirect to HTTPS"]', section).hidden = true
|
||||||
|
|
||||||
$.get items, (items) ->
|
$.get items, (items) ->
|
||||||
|
|||||||
@ -384,6 +384,10 @@ $.oneItemSugar = (fn) ->
|
|||||||
|
|
||||||
$.syncing = {}
|
$.syncing = {}
|
||||||
|
|
||||||
|
$.securityCheck = (data) ->
|
||||||
|
if location.protocol isnt 'https:'
|
||||||
|
delete data['Redirect to HTTPS']
|
||||||
|
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
# https://developer.chrome.com/extensions/storage.html
|
# https://developer.chrome.com/extensions/storage.html
|
||||||
$.oldValue =
|
$.oldValue =
|
||||||
@ -485,6 +489,7 @@ do ->
|
|||||||
|
|
||||||
$.set = $.oneItemSugar (data, cb) ->
|
$.set = $.oneItemSugar (data, cb) ->
|
||||||
return unless $.crxWorking()
|
return unless $.crxWorking()
|
||||||
|
$.securityCheck data
|
||||||
$.extend items.local, data
|
$.extend items.local, data
|
||||||
setArea 'local', cb
|
setArea 'local', cb
|
||||||
|
|
||||||
@ -536,6 +541,7 @@ if GM?.deleteValue? and window.BroadcastChannel and not GM_addValueChangeListene
|
|||||||
cb items
|
cb items
|
||||||
|
|
||||||
$.set = $.oneItemSugar (items, cb) ->
|
$.set = $.oneItemSugar (items, cb) ->
|
||||||
|
$.securityCheck items
|
||||||
Promise.all(GM.setValue(g.NAMESPACE + key, JSON.stringify(val)) for key, val of items).then ->
|
Promise.all(GM.setValue(g.NAMESPACE + key, JSON.stringify(val)) for key, val of items).then ->
|
||||||
$.syncChannel.postMessage items
|
$.syncChannel.postMessage items
|
||||||
cb?()
|
cb?()
|
||||||
@ -655,6 +661,7 @@ else
|
|||||||
cb items
|
cb items
|
||||||
|
|
||||||
$.set = $.oneItemSugar (items, cb) ->
|
$.set = $.oneItemSugar (items, cb) ->
|
||||||
|
$.securityCheck items
|
||||||
$.queueTask ->
|
$.queueTask ->
|
||||||
for key, value of items
|
for key, value of items
|
||||||
$.setValue(g.NAMESPACE + key, JSON.stringify value)
|
$.setValue(g.NAMESPACE + key, JSON.stringify value)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user