main: Updated domain info page
All checks were successful
Build Docker / Build Bot (push) Successful in 27s
Build Docker / Build Master (push) Successful in 28s

This commit is contained in:
Nathan Woodburn 2023-08-25 18:13:36 +10:00
parent 73d11a0f76
commit c8eafb6406
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -233,6 +233,35 @@ def site_status():
return jsonify({'success': 'false', 'domain': domain, 'ip': publicIP, 'tlsa': 'none','error': 'No TLSA record found'}) return jsonify({'success': 'false', 'domain': domain, 'ip': publicIP, 'tlsa': 'none','error': 'No TLSA record found'})
@app.route('/info')
def site_status():
domain = request.args.get('domain')
if domain == None:
return "<h1>Invalid domain</h1>"
# Check if domain exists
if not site_exists(domain):
return "<h1>Domain does not exist</h1>"
# Get worker
worker = site_worker(domain)
if worker == None:
return "<h1>Domain does not exist</h1>"
# Get worker ip
ip = workerIP_PRIV(worker)
# Get TLSA record
resp=requests.get("http://"+ip + ":5000/tlsa?domain=" + domain,timeout=2)
json = resp.json()
publicIP = workerIP(worker)
if "tlsa" in json:
tlsa = json['tlsa']
return "<h1>Domain: " + domain + "</h1><br><p>IP: " + publicIP + "</p><br><p>TLSA: " + tlsa + "</p><br><p>Make sure to add the TLSA record to `_443._tcp." + domain + "` or `*." + domain + "`</p>"
else:
return "<h1>Domain: " + domain + "</h1><br><p>IP: " + publicIP + "</p><br><p>TLSA: none</p><br><p>No TLSA record found</p>"
@app.route('/tlsa', methods=['GET']) @app.route('/tlsa', methods=['GET'])
def tlsa(): def tlsa():
domain = request.args.get('domain') domain = request.args.get('domain')
@ -651,7 +680,7 @@ def addsite():
html += "<p>Domain: " + domain + "</p>" html += "<p>Domain: " + domain + "</p>"
html += "<p>Worker: " + worker.split(':')[0] + "</p>" html += "<p>Worker: " + worker.split(':')[0] + "</p>"
html += "<p>Worker IP: " + worker.split(':')[1].strip('\n') + "</p>" html += "<p>Worker IP: " + worker.split(':')[1].strip('\n') + "</p>"
html += "<p>Check status <a href='/site-info?domain=" + domain + "'>here</a></p>" html += "<p><a href='/info?domain=" + domain + "'>Check status</a></p>"
return html return html