|
|
@ -29,6 +29,7 @@ env = None
|
|
|
|
# store client IP in memory until classification
|
|
|
|
# store client IP in memory until classification
|
|
|
|
client_ips = {}
|
|
|
|
client_ips = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Processor(Thread):
|
|
|
|
class Processor(Thread):
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
def stop(self):
|
|
|
@ -163,12 +164,13 @@ def reply_comment_email(data):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
# safe logic: no answer or unknown answer is a go for publishing
|
|
|
|
# safe logic: no answer or unknown answer is a go for publishing
|
|
|
|
if message[:2].upper() in ('NO','SP'):
|
|
|
|
if message[:2].upper() in ('NO', 'SP'):
|
|
|
|
|
|
|
|
|
|
|
|
# put a log to help fail2ban
|
|
|
|
# put a log to help fail2ban
|
|
|
|
if message[:2].upper() == 'SP': # SPAM
|
|
|
|
if message[:2].upper() == 'SP': # SPAM
|
|
|
|
if comment_id in client_ips:
|
|
|
|
if comment_id in client_ips:
|
|
|
|
logger.info('SPAM comment from %s: %d' % (client_ips[comment_id], comment_id))
|
|
|
|
logger.info('SPAM comment from %s: %d' %
|
|
|
|
|
|
|
|
(client_ips[comment_id], comment_id))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
logger.info('cannot identify SPAM source: %d' % comment_id)
|
|
|
|
logger.info('cannot identify SPAM source: %d' % comment_id)
|
|
|
|
|
|
|
|
|
|
|
@ -210,8 +212,6 @@ def reply_comment_email(data):
|
|
|
|
notify_subscribed_readers(
|
|
|
|
notify_subscribed_readers(
|
|
|
|
comment.site.token, comment.site.url, comment.url)
|
|
|
|
comment.site.token, comment.site.url, comment.url)
|
|
|
|
|
|
|
|
|
|
|
|
# system quit
|
|
|
|
|
|
|
|
system_quit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def late_reject_comment(id):
|
|
|
|
def late_reject_comment(id):
|
|
|
|
|
|
|
|
|
|
|
@ -463,10 +463,6 @@ def get_processor():
|
|
|
|
return proc
|
|
|
|
return proc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def system_quit():
|
|
|
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def start(template_dir):
|
|
|
|
def start(template_dir):
|
|
|
|
global proc, env
|
|
|
|
global proc, env
|
|
|
|
|
|
|
|
|
|
|
|