From 923858e47f7a4bd416f795e9f8ff998cf9fea733 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 8 Nov 2023 20:49:03 +1100 Subject: [PATCH] fix: Only search for SLD --- sites/db.py | 10 ---------- sites/slds.py | 3 ++- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/sites/db.py b/sites/db.py index 8f5ffeb..4d61a99 100644 --- a/sites/db.py +++ b/sites/db.py @@ -23,15 +23,5 @@ def get_website_data(domain): connection.close() if data == []: - # Create new entry - connection = mysql.connector.connect(**dbargs) - cursor = connection.cursor() - cursor.execute(""" - INSERT INTO site (domain, data) - VALUES (%s, %s) - """, (domain, "")) - connection.commit() - cursor.close() - connection.close() return "" return data[0][2] \ No newline at end of file diff --git a/sites/slds.py b/sites/slds.py index f0213d1..6e5692a 100644 --- a/sites/slds.py +++ b/sites/slds.py @@ -24,8 +24,9 @@ def error(message): @app.route('/') def index(): host = request.host - if len(host.split('.')) < 2: + if len(host.split('.')) != 2: return error('Invalid domain') + host = host.split('.')[0] # Get website data data = db.get_website_data(host)