main: Updated domain info page
This commit is contained in:
parent
73d11a0f76
commit
c8eafb6406
@ -233,6 +233,35 @@ def site_status():
|
||||
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'])
|
||||
def tlsa():
|
||||
domain = request.args.get('domain')
|
||||
@ -651,7 +680,7 @@ def addsite():
|
||||
html += "<p>Domain: " + domain + "</p>"
|
||||
html += "<p>Worker: " + worker.split(':')[0] + "</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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user