Don't allow bad siteProperties value to turn off script on 4chan.

This commit is contained in:
ccd0 2018-12-05 20:12:54 -08:00
parent c858eb585d
commit 8e3517735e
2 changed files with 8 additions and 9 deletions

View File

@ -67,10 +67,7 @@ Main =
Conf['cooldowns'] = {}
Conf['Index Sort'] = {}
Conf["Last Long Reply Thresholds #{i}"] = {} for i in [0...2]
Conf['siteProperties'] =
'4chan.org': {software: 'yotsuba'}
'4channel.org': {software: 'yotsuba'}
'4cdn.org': {software: 'yotsuba'}
Conf['siteProperties'] = {}
# XXX old key names
Conf['Except Archives from Encryption'] = false
@ -80,11 +77,7 @@ Main =
Conf['QR Shortcut'] = true
Conf['Bottom QR Link'] = true
Conf['Toggleable Thread Watcher'] = true
Conf['siteSoftware'] = """
4chan.org yotsuba
4channel.org yotsuba
4cdn.org yotsuba
"""
Conf['siteSoftware'] = ''
# Enforce JS whitelist
if /\.4chan(?:nel)?\.org$/.test(location.hostname) and !$$('script:not([src])', d).filter((s) -> /this\[/.test(s.textContent)).length

View File

@ -1,5 +1,11 @@
Site =
defaultProperties:
'4chan.org': {software: 'yotsuba'}
'4channel.org': {software: 'yotsuba'}
'4cdn.org': {software: 'yotsuba'}
init: (cb) ->
$.extend Conf['siteProperties'], Site.defaultProperties
{hostname} = location
while hostname and hostname not of Conf['siteProperties']
hostname = hostname.replace(/^[^.]*\.?/, '')