Add captcha

This commit is contained in:
Tanner Collin 2024-01-04 06:15:12 +00:00
parent 61225ebd20
commit 2f2bc581d4

View File

@ -75,14 +75,8 @@ async def new_message(event):
await event.reply('Entry added to t0.vc/g') await event.reply('Entry added to t0.vc/g')
logging.info('Added: {}'.format(data)) logging.info('Added: {}'.format(data))
async def message_tanner(name, website, message, mid): async def message_tanner(name, website, message, captcha, mid):
if 'sex' in message or 'porn' in message: if 'tanner' not in captcha.lower():
return
if 'lasertest' in name or 'porn' in name:
return
if 'slkjfdf.net' in website:
return return
if name.replace(' ', '') in ['website', 'webpage', 'homepage']: if name.replace(' ', '') in ['website', 'webpage', 'homepage']:
@ -104,9 +98,11 @@ async def submit(request):
logging.info('{} {}'.format(mid, data)) logging.info('{} {}'.format(mid, data))
try: try:
fake_username = data.get('fake_username', '') # not used yet
name = data['name'] name = data['name']
website = data.get('website', '') website = data.get('website', '')
message = data['message'] message = data['message']
captcha = data.get('captcha', '')
except KeyError: except KeyError:
raise web.HTTPBadRequest(reason='You are missing something.') raise web.HTTPBadRequest(reason='You are missing something.')
@ -120,7 +116,7 @@ async def submit(request):
if len(message) > 1000: if len(message) > 1000:
raise web.HTTPBadRequest(reason='Message is too long.') raise web.HTTPBadRequest(reason='Message is too long.')
await message_tanner(name, website, message, mid) await message_tanner(name, website, message, captcha, mid)
messages[mid] = data messages[mid] = data