fix: Set domain to lower in api requests
Some checks failed
Build Docker / Build Master (push) Failing after 12s
Build Docker / Build Bot (push) Successful in 46s

This commit is contained in:
Nathan Woodburn 2023-09-17 08:47:36 +10:00
parent d19a121005
commit c130bfed69
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 9 additions and 2 deletions

View File

@ -206,6 +206,7 @@ def list_workers():
@app.route('/site-info', methods=['GET'])
def site_status():
domain = request.args.get('domain')
domain = domain.lower()
if domain == None:
return jsonify({'error': 'Invalid domain', 'success': 'false'})
@ -236,6 +237,7 @@ def site_status():
@app.route('/info')
def site_status_human():
domain = request.args.get('domain')
domain = domain.lower()
if domain == None:
return "<h1>Invalid domain</h1>"
@ -265,6 +267,7 @@ def site_status_human():
@app.route('/tlsa', methods=['GET'])
def tlsa():
domain = request.args.get('domain')
domain = domain.lower()
if domain == None:
return jsonify({'error': 'Invalid domain', 'success': 'false'})
@ -480,6 +483,9 @@ def register_post():
if domain.startswith("http://") or domain.startswith("https://"):
return render_template('register.html', buy_licence_link=buy_licence_link, ERROR_MESSAGE="Domain should not contain http:// or https://")
# Set domain to lowercase
domain = domain.lower()
# Check if worker file exists
workers = None
try:
@ -529,6 +535,7 @@ def success():
if 'domain' not in request.args:
return redirect('/')
domain = request.args.get('domain')
domain = domain.lower()
if not site_exists(domain):
return render_template('success.html', message="Error: Domain does not exist\nPlease contact support")
@ -711,7 +718,7 @@ def addsite():
if domain.startswith("http://") or domain.startswith("https://"):
return jsonify({'error': 'Domain should not contain http:// or https://', 'success': 'false'})
domain = domain.lower()
# Check if worker file exists
workers = None
try:

View File

@ -45,7 +45,7 @@
<div class="mb-3"><input type="text" name="domain" placeholder="Domain"></div>
<div class="mb-3"><input type="text" placeholder="Licence Key" name="licence"></div>
<div class="mb-3">
<p style="color: rgb(255,0,0);">{{ERROR_MESSAGE}}</p><button class="btn btn-primary shadow d-block w-100" type="submit">Sign up</button>
<p style="color: rgb(255,0,0);">{{ERROR_MESSAGE}}</p><button class="btn btn-primary shadow d-block w-100" type="submit">Create site</button>
</div>
<p class="text-muted">Don't have a licence?<br><a href="{{buy_licence_link}}" target="_blank">Click here to buy one</a></p>
</form>