feat: Add TLD detection to return TLD page
All checks were successful
Build Docker / Build Image (push) Successful in 25s
All checks were successful
Build Docker / Build Image (push) Successful in 25s
This commit is contained in:
21
server.py
21
server.py
@@ -19,6 +19,8 @@ exchange = {
|
||||
}
|
||||
|
||||
|
||||
tlds = ['australia','newzealand']
|
||||
|
||||
#Assets routes
|
||||
@app.route('/assets/<path:path>')
|
||||
def send_report(path):
|
||||
@@ -374,21 +376,32 @@ def login():
|
||||
@app.route('/')
|
||||
def index():
|
||||
year = datetime.datetime.now().year
|
||||
return render_template('index.html',year=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 not request.host in tlds and 'localhost' not in request.host:
|
||||
return render_template('index.html',year=year, handshake_scripts=hns_scripts)
|
||||
|
||||
tld = request.host.split('.')[-1]
|
||||
print(tld)
|
||||
if 'localhost' in tld:
|
||||
tld = tlds[0]
|
||||
hns_scripts = '<script src="https://gday.hnsau/https.js" async></script>'
|
||||
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 file exists, load it
|
||||
if os.path.isfile('templates/' + path):
|
||||
return render_template(path, year=year)
|
||||
return render_template(path, year=year, handshake_scripts=hns_scripts)
|
||||
|
||||
# Try with .html
|
||||
if os.path.isfile('templates/' + path + '.html'):
|
||||
return render_template(path + '.html', year=year)
|
||||
return render_template(path + '.html', year=year, handshake_scripts=hns_scripts)
|
||||
|
||||
if os.path.isfile('templates/' + path.strip('/') + '.html'):
|
||||
return render_template(path.strip('/') + '.html', year=year)
|
||||
return render_template(path.strip('/') + '.html', year=year, handshake_scripts=hns_scripts)
|
||||
|
||||
return render_template('404.html'), 404
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body><!-- partial:index.partial -->
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -92,8 +93,7 @@
|
||||
<div class="footer-copyright">
|
||||
<p>© {{year}} Handshake AU</p>
|
||||
</div>
|
||||
</footer><script src="https://gday.hnsau/handshake.js" domain="gday.hnsau"></script>
|
||||
<script src="https://gday.hnsau/https.js"></script>
|
||||
</footer>
|
||||
<script src="/assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
|
||||
<script src="/assets/js/vanilla-zoom.js"></script>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -114,8 +115,7 @@
|
||||
<div class="footer-copyright">
|
||||
<p>© {{year}} Handshake AU</p>
|
||||
</div>
|
||||
</footer><script src="https://gday.hnsau/handshake.js" domain="gday.hnsau"></script>
|
||||
<script src="https://gday.hnsau/https.js"></script>
|
||||
</footer>
|
||||
<script src="/assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
|
||||
<script src="/assets/js/vanilla-zoom.js"></script>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -33,6 +33,7 @@ Register even more Australian SLDs on HNSAU.">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -93,8 +94,7 @@
|
||||
<div class="footer-copyright">
|
||||
<p>© {{year}} Handshake AU</p>
|
||||
</div>
|
||||
</footer><script src="https://gday.hnsau/handshake.js" domain="gday.hnsau"></script>
|
||||
<script src="https://gday.hnsau/https.js"></script>
|
||||
</footer>
|
||||
<script src="/assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
|
||||
<script src="/assets/js/vanilla-zoom.js"></script>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -96,8 +97,7 @@
|
||||
<div class="footer-copyright">
|
||||
<p>© {{year}} Handshake AU</p>
|
||||
</div>
|
||||
</footer><script src="https://gday.hnsau/handshake.js" domain="gday.hnsau"></script>
|
||||
<script src="https://gday.hnsau/https.js"></script>
|
||||
</footer>
|
||||
<script src="/assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
|
||||
<script src="/assets/js/vanilla-zoom.js"></script>
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body><script src="https://gday.hnsau/handshake.js" domain="gday.hnsau"></script>
|
||||
<script src="https://gday.hnsau/https.js"></script>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg fixed-top bg-dark clean-navbar navbar-light" data-bs-theme="dark">
|
||||
<div class="container-fluid"><a class="navbar-brand logo" href="/" style="width: 50%;"><img src="/assets/img/favicon.png" style="height: 50px;margin-right: 10px;">HNSAU</a><button data-bs-toggle="collapse" class="navbar-toggler" data-bs-target="#navcol-1"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
|
||||
<div class="collapse navbar-collapse" id="navcol-1">
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -183,8 +184,7 @@
|
||||
<div class="footer-copyright">
|
||||
<p>© {{year}} Handshake AU</p>
|
||||
</div>
|
||||
</footer><script src="https://gday.hnsau/handshake.js" domain="gday.hnsau"></script>
|
||||
<script src="https://gday.hnsau/https.js"></script>
|
||||
</footer>
|
||||
<script src="/assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
|
||||
<script src="/assets/js/vanilla-zoom.js"></script>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/vanilla-zoom.min.css">
|
||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="15852010-8d3c-4553-92fc-2d6ac31098e8"></script>
|
||||
{{handshake_scripts | safe}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user