From f9ca26abd0aa5a5b79faefc438386258a47e7975 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 19 Feb 2024 10:41:07 +1100 Subject: [PATCH] feat: Add not for sale domains --- server.py | 10 ++++++- templates/404.html | 2 +- templates/index.html | 2 +- templates/not_for_sale.html | 53 +++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 templates/not_for_sale.html diff --git a/server.py b/server.py index b7546b9..d48b414 100644 --- a/server.py +++ b/server.py @@ -7,6 +7,8 @@ import datetime app = Flask(__name__) dotenv.load_dotenv() +not_for_sale = ['australia'] + @app.route('/assets/') def send_report(path): return send_from_directory('templates/assets', path) @@ -25,6 +27,9 @@ def index(): tld = 'freeconcept' https_redirect = "" + + 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')}) @@ -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 diff --git a/templates/404.html b/templates/404.html index 660230b..701a34c 100644 --- a/templates/404.html +++ b/templates/404.html @@ -5,7 +5,7 @@ .{{tld}}/ domains - + diff --git a/templates/index.html b/templates/index.html index 8564a17..9a131d4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,7 +5,7 @@ .{{tld}}/ domains - + diff --git a/templates/not_for_sale.html b/templates/not_for_sale.html new file mode 100644 index 0000000..08349d6 --- /dev/null +++ b/templates/not_for_sale.html @@ -0,0 +1,53 @@ + + + + + + + HNSAU + + + + + + + + + + + + +
+
+
+

.{{tld}}/ domains


.{{tld}}/ domains are not available for registration yet.

+
+
+
+
+
+

If you're interested in using a subdomain of {{tld}}/ for your project, please feel free to reach out to us.
We'd be happy to help you set up a second-level domain (SLD).

+
+

If you're a student, we invite you to get in touch, as we're currently offering free SLDs for your use.

+
+
+
+ © {{year}} .{{tld}}/ + + Domains by + HNSAU/ + +
+ {{https_redirect | safe}} + + + + \ No newline at end of file