mirror of https://gitlab.com/bashrc2/epicyon
Another content filter check
parent
a896f5ad62
commit
e7239a078b
12
inbox.py
12
inbox.py
|
@ -1429,7 +1429,8 @@ def estimateNumberOfEmoji(content: str) -> int:
|
||||||
"""
|
"""
|
||||||
return int(content.count(':')/2)
|
return int(content.count(':')/2)
|
||||||
|
|
||||||
def validPostContent(messageJson: {},maxMentions: int,maxEmoji: int) -> bool:
|
def validPostContent(baseDir: str,nickname: str,domain: str, \
|
||||||
|
messageJson: {},maxMentions: int,maxEmoji: int) -> bool:
|
||||||
"""Is the content of a received post valid?
|
"""Is the content of a received post valid?
|
||||||
Check for bad html
|
Check for bad html
|
||||||
Check for hellthreads
|
Check for hellthreads
|
||||||
|
@ -1477,6 +1478,10 @@ def validPostContent(messageJson: {},maxMentions: int,maxEmoji: int) -> bool:
|
||||||
print('REJECT: '+messageJson['object']['id'])
|
print('REJECT: '+messageJson['object']['id'])
|
||||||
print('REJECT: Too many tags in post - '+messageJson['object']['tag'])
|
print('REJECT: Too many tags in post - '+messageJson['object']['tag'])
|
||||||
return False
|
return False
|
||||||
|
# check for filtered content
|
||||||
|
if not isFiltered(baseDir,nickname,domain,messageJson['object']['content']):
|
||||||
|
print('REJECT: content filtered')
|
||||||
|
return False
|
||||||
print('ACCEPT: post content is valid')
|
print('ACCEPT: post content is valid')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1854,7 +1859,8 @@ def inboxAfterCapabilities(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
else:
|
else:
|
||||||
postJsonObject=messageJson
|
postJsonObject=messageJson
|
||||||
|
|
||||||
if validPostContent(postJsonObject,maxMentions,maxEmoji):
|
nickname=handle.split('@')[0]
|
||||||
|
if validPostContent(baseDir,nickname,domain,postJsonObject,maxMentions,maxEmoji):
|
||||||
# replace YouTube links, so they get less tracking data
|
# replace YouTube links, so they get less tracking data
|
||||||
replaceYouTube(postJsonObject)
|
replaceYouTube(postJsonObject)
|
||||||
|
|
||||||
|
@ -1862,8 +1868,6 @@ def inboxAfterCapabilities(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
updateIndexList=['inbox']
|
updateIndexList=['inbox']
|
||||||
populateReplies(baseDir,httpPrefix,domain,postJsonObject,maxReplies,debug)
|
populateReplies(baseDir,httpPrefix,domain,postJsonObject,maxReplies,debug)
|
||||||
|
|
||||||
nickname=handle.split('@')[0]
|
|
||||||
|
|
||||||
# if this is a reply to a question then update the votes
|
# if this is a reply to a question then update the votes
|
||||||
questionJson=questionUpdateVotes(baseDir,nickname,domain,postJsonObject)
|
questionJson=questionUpdateVotes(baseDir,nickname,domain,postJsonObject)
|
||||||
if questionJson:
|
if questionJson:
|
||||||
|
|
Loading…
Reference in New Issue