feat: HNS Links blog
All checks were successful
Build Docker / Build Image (push) Successful in 25s

This commit is contained in:
2024-02-24 19:45:06 +11:00
parent c2b2b8ff3b
commit 2f598d30a0
7 changed files with 135 additions and 1 deletions

View File

@@ -378,19 +378,28 @@ def index():
year = datetime.datetime.now().year
hns_scripts = '<script src="https://gday.hnsau/handshake.js" domain="gday.hnsau" async></script><script src="https://gday.hnsau/https.js" async></script>'
if 'localhost' in request.host or '127.0.0.1' in request.host:
hns_scripts = ''
tld = request.host.split('.')[-1]
if tld not in tlds and 'localhost' not in tld:
return render_template('index.html',year=year, handshake_scripts=hns_scripts)
hns_scripts = '<script src="https://gday.hnsau/https.js" async></script>'
if 'localhost' in tld:
tld = tlds[0]
hns_scripts = '<script src="https://gday.hnsau/https.js" async></script>'
hns_scripts = ''
return render_template('/tlds/'+tld+'.html',year=year, handshake_scripts=hns_scripts)
@app.route('/<path:path>')
def catch_all(path):
year = datetime.datetime.now().year
hns_scripts = '<script src="https://gday.hnsau/handshake.js" domain="gday.hnsau" async></script><script src="https://gday.hnsau/https.js" async></script>'
if 'localhost' in request.host or '127.0.0.1' in request.host:
hns_scripts = ''
# If file exists, load it
if os.path.isfile('templates/' + path):
return render_template(path, year=year, handshake_scripts=hns_scripts)