From 08d9de8784dfcf2668ce11afd7538c171fb96d29 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 20 Aug 2021 22:14:57 +0000 Subject: [PATCH] Rename html/ and add error message --- data/{html => g}/.gitkeep | 0 data/{html => g}/index.html.blank | 2 +- t0sig.py | 5 ++++- 3 files changed, 5 insertions(+), 2 deletions(-) rename data/{html => g}/.gitkeep (100%) rename data/{html => g}/index.html.blank (85%) diff --git a/data/html/.gitkeep b/data/g/.gitkeep similarity index 100% rename from data/html/.gitkeep rename to data/g/.gitkeep diff --git a/data/html/index.html.blank b/data/g/index.html.blank similarity index 85% rename from data/html/index.html.blank rename to data/g/index.html.blank index 7d4ed2a..92a3013 100644 --- a/data/html/index.html.blank +++ b/data/g/index.html.blank @@ -5,7 +5,7 @@ Guest Book ========== If you visited my website, please sign my guestbook! -
+ Your name: diff --git a/t0sig.py b/t0sig.py index e63bff9..628851e 100644 --- a/t0sig.py +++ b/t0sig.py @@ -40,7 +40,7 @@ async def new_message(event): entry += '\n\n{}\n\n'.format(data['message']) - with open('data/html/index.html', 'a') as f: + with open('data/g/index.html', 'a') as f: f.write(entry) await event.reply('Entry added to t0.vc/g') @@ -60,6 +60,9 @@ async def submit(request): except KeyError: raise web.HTTPBadRequest(reason='You are missing something.') + if not len(name) or not len(message): + raise web.HTTPBadRequest(reason='You are missing something.') + if len(name) > 50: raise web.HTTPBadRequest(reason='Name is too long.') if len(website) > 100: