mirror of https://gitlab.com/bashrc2/epicyon
Configuration parameter for enabling cw lists
parent
a6381f5c50
commit
b91c6282c7
|
@ -876,7 +876,7 @@ def brochModeLapses(baseDir: str, lapseDays: int = 7) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def loadCWLists(baseDir: str, verbose: bool) -> {}:
|
def loadCWLists(baseDir: str, verbose: bool, listsEnabled: str) -> {}:
|
||||||
"""Load lists used for content warnings
|
"""Load lists used for content warnings
|
||||||
"""
|
"""
|
||||||
if not os.path.isdir(baseDir + '/cwlists'):
|
if not os.path.isdir(baseDir + '/cwlists'):
|
||||||
|
@ -893,6 +893,8 @@ def loadCWLists(baseDir: str, verbose: bool) -> {}:
|
||||||
continue
|
continue
|
||||||
if not listJson.get('name'):
|
if not listJson.get('name'):
|
||||||
continue
|
continue
|
||||||
|
if listJson['name'] not in listsEnabled:
|
||||||
|
continue
|
||||||
if not listJson.get('words') and not listJson.get('domains'):
|
if not listJson.get('words') and not listJson.get('domains'):
|
||||||
continue
|
continue
|
||||||
name = listJson['name']
|
name = listJson['name']
|
||||||
|
|
|
@ -17199,7 +17199,8 @@ def runDaemon(defaultReplyIntervalHours: int,
|
||||||
updateBlockedCache(baseDir, httpd.blockedCache,
|
updateBlockedCache(baseDir, httpd.blockedCache,
|
||||||
httpd.blockedCacheLastUpdated,
|
httpd.blockedCacheLastUpdated,
|
||||||
httpd.blockedCacheUpdateSecs)
|
httpd.blockedCacheUpdateSecs)
|
||||||
httpd.CWlists = loadCWLists(baseDir, True)
|
httpd.listsEnabled = getConfigParam(baseDir, "listsEnabled")
|
||||||
|
httpd.CWlists = loadCWLists(baseDir, True, httpd.listsEnabled)
|
||||||
|
|
||||||
# cache to store css files
|
# cache to store css files
|
||||||
httpd.cssCache = {}
|
httpd.cssCache = {}
|
||||||
|
|
2
tests.py
2
tests.py
|
@ -5769,7 +5769,7 @@ def _testWordsSimilarity() -> None:
|
||||||
def _testAddCWfromLists(baseDir: str) -> None:
|
def _testAddCWfromLists(baseDir: str) -> None:
|
||||||
print('testAddCWfromLists')
|
print('testAddCWfromLists')
|
||||||
translate = {}
|
translate = {}
|
||||||
CWlists = loadCWLists(baseDir, True)
|
CWlists = loadCWLists(baseDir, True, "Murdoch press")
|
||||||
assert CWlists
|
assert CWlists
|
||||||
|
|
||||||
postJsonObject = {
|
postJsonObject = {
|
||||||
|
|
Loading…
Reference in New Issue