Skip to content

Commit

Permalink
Improve spam handling, make keywords configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Sep 23, 2024
1 parent e242386 commit e623b2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions repology.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ STAFF_AFK = []
#
DISABLED_REPORTS = []

#
# Do not allow reports containing these strings
#
SPAM_KEYWORDS = []

#
# Default timezone to use in the web interface
# The webapp tries to replace this to user's local timezone with javascript
Expand Down
13 changes: 8 additions & 5 deletions repologyapp/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,14 @@ def project_report(name: str) -> Response:
if not need_verignore and not need_split and not need_merge and not need_vuln and not comment:
errors.append('please fill out the form')

if comment and '<a href' in comment:
errors.append('spammers not welcome, HTML not allowed')

if comment and 'า' in comment: # thai spam
errors.append('spammers not welcome, HTML not allowed')
if comment:
if '<a href' in comment:
errors.append('HTML not allowed')

for keyword in config['SPAM_KEYWORDS']:
if keyword in comment:
errors.append('spammers not welcome')
break

if need_verignore and need_split and need_merge and need_vuln and not comment:
errors.append('spammers not welcome')
Expand Down

0 comments on commit e623b2a

Please sign in to comment.