feat: Add not for sale domains
All checks were successful
Build Docker / Build Image (push) Successful in 35s

This commit is contained in:
Nathan Woodburn 2024-02-19 10:41:07 +11:00
parent cdcbf44bf2
commit f9ca26abd0
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
4 changed files with 64 additions and 3 deletions

View File

@ -7,6 +7,8 @@ import datetime
app = Flask(__name__)
dotenv.load_dotenv()
not_for_sale = ['australia']
@app.route('/assets/<path:path>')
def send_report(path):
return send_from_directory('templates/assets', path)
@ -26,6 +28,9 @@ def index():
https_redirect = "<script>console.log('https.js not loaded on localhost')</script>"
if tld in not_for_sale:
return render_template('not_for_sale.html', tld=tld, https_redirect=https_redirect, year=year)
# Count sales
sales = requests.get('https://reg.woodburn.au/api?action=getMyStaked', headers={'Authorization': 'Bearer ' + os.getenv('reg_auth')})
sales = sales.json()
@ -38,12 +43,15 @@ def index():
sales = sales['data']
for sale in sales:
if sale['tld'] == tld:
print(sale)
tld_sales = sale['slds']
if tld.startswith('xn--'):
tld = tld.encode('ascii').decode('idna')
if tld_sales == 0:
not_for_sale.append(tld)
return render_template('not_for_sale.html', tld=tld, https_redirect=https_redirect, year=year)
return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=tld_sales, year=year)
# 404 catch all

View File

@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>.{{tld}}/ domains</title>
<meta name="description" content=".tas/ domains">
<meta name="description" content=".{{tld}}/ domains">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">

View File

@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>.{{tld}}/ domains</title>
<meta name="description" content=".tas/ domains">
<meta name="description" content=".{{tld}}/ domains">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en" style="color: white;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>HNSAU</title>
<meta name="description" content=".{{tld}}/ domains">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="1024x1024" href="assets/img/favicon.png">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/index.css">
</head>
<body style="background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5) 100%), url(&quot;assets/img/background.jpg&quot;) no-repeat, #000000;background-size: auto, cover, auto;color: white;">
<nav class="navbar navbar-dark navbar-expand">
<div class="container-fluid"><a class="navbar-brand" href="/" style="font-size: 30px;font-weight: bold;color: white;">.{{tld}}/</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">
<ul class="navbar-nav ms-auto" style="font-size: 20px;font-weight: bold;">
<li class="nav-item"><a class="nav-link" href="https://hns.au/contact">Contact HNSAU</a></li>
</ul>
</div>
</div>
</nav>
<header>
<div class="container">
<div style="text-align: center;">
<h1 class="display-1 text-center" style="font-weight: bold;margin: 0px;">.{{tld}}/ domains</h1><span style="font-weight: bold;font-size: 40px;"><br>.{{tld}}/ domains are not available for registration yet.<br><br></span>
</div>
</div>
</header>
<section style="font-size: 25px;">
<div class="text-center" id="pricing" style="max-width: 800px; margin: auto;">
<p class="text-center" style="font-weight: bold;">If you're interested in using a subdomain of {{tld}}/ for your project, please feel free to reach out to us.<br>We'd be happy to help you set up a second-level domain (SLD).</p>
<br>
<p class="text-center">If you're a student, we invite you to get in touch, as we're currently offering free SLDs for your use.</p>
</div>
</section>
<footer style="font-size: 25px;background: black;color: white;margin-top: 250px;">
<span>© {{year}} .{{tld}}/</span>
<span class="right-footer">
Domains by
<a href="https://hns.au" target="_blank">HNSAU/</a>
</span>
</footer>
{{https_redirect | safe}}
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>