forked from indymedia/epicyon
Allow filtering without an account
parent
cc2b9735fc
commit
97a5b774d4
13
filters.py
13
filters.py
|
@ -91,6 +91,14 @@ def isFiltered(baseDir: str, nickname: str, domain: str, content: str) -> bool:
|
||||||
You can add individual words or use word1+word2 to indicate that two
|
You can add individual words or use word1+word2 to indicate that two
|
||||||
words must be present although not necessarily adjacent
|
words must be present although not necessarily adjacent
|
||||||
"""
|
"""
|
||||||
|
globalFiltersFilename = baseDir + '/accounts/filters.txt'
|
||||||
|
if os.path.isfile(globalFiltersFilename):
|
||||||
|
if content + '\n' in open(globalFiltersFilename).read():
|
||||||
|
return True
|
||||||
|
|
||||||
|
if not nickname or not domain:
|
||||||
|
return False
|
||||||
|
|
||||||
# optionally remove retweets
|
# optionally remove retweets
|
||||||
removeTwitter = baseDir + '/accounts/' + \
|
removeTwitter = baseDir + '/accounts/' + \
|
||||||
nickname + '@' + domain + '/.removeTwitter'
|
nickname + '@' + domain + '/.removeTwitter'
|
||||||
|
@ -98,11 +106,6 @@ def isFiltered(baseDir: str, nickname: str, domain: str, content: str) -> bool:
|
||||||
if isTwitterPost(content):
|
if isTwitterPost(content):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
globalFiltersFilename = baseDir + '/accounts/filters.txt'
|
|
||||||
if os.path.isfile(globalFiltersFilename):
|
|
||||||
if content + '\n' in open(globalFiltersFilename).read():
|
|
||||||
return True
|
|
||||||
|
|
||||||
accountFiltersFilename = baseDir + '/accounts/' + \
|
accountFiltersFilename = baseDir + '/accounts/' + \
|
||||||
nickname + '@' + domain + '/filters.txt'
|
nickname + '@' + domain + '/filters.txt'
|
||||||
if os.path.isfile(accountFiltersFilename):
|
if os.path.isfile(accountFiltersFilename):
|
||||||
|
|
Loading…
Reference in New Issue