fix: Only search for SLD
This commit is contained in:
parent
c0193337bb
commit
923858e47f
10
sites/db.py
10
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]
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user