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()
|
connection.close()
|
||||||
|
|
||||||
if data == []:
|
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 ""
|
||||||
return data[0][2]
|
return data[0][2]
|
@ -24,8 +24,9 @@ def error(message):
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
host = request.host
|
host = request.host
|
||||||
if len(host.split('.')) < 2:
|
if len(host.split('.')) != 2:
|
||||||
return error('Invalid domain')
|
return error('Invalid domain')
|
||||||
|
host = host.split('.')[0]
|
||||||
|
|
||||||
# Get website data
|
# Get website data
|
||||||
data = db.get_website_data(host)
|
data = db.get_website_data(host)
|
||||||
|
Loading…
Reference in New Issue
Block a user