feat: Add sales count
All checks were successful
Build Docker / Build Image (push) Successful in 28s
All checks were successful
Build Docker / Build Image (push) Successful in 28s
This commit is contained in:
parent
834a9acaa3
commit
20638a1c09
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
.env
|
@ -1,2 +1,3 @@
|
||||
flask
|
||||
python-dotenv
|
||||
python-dotenv
|
||||
requests
|
17
server.py
17
server.py
@ -1,6 +1,7 @@
|
||||
from flask import Flask, make_response, redirect, request, jsonify, render_template, send_from_directory
|
||||
import os
|
||||
import dotenv
|
||||
import requests
|
||||
|
||||
app = Flask(__name__)
|
||||
dotenv.load_dotenv()
|
||||
@ -19,10 +20,22 @@ def index():
|
||||
tld = host.split('.')[-1]
|
||||
tld = tld.split(':')[0]
|
||||
if tld == 'localhost' or tld == '1':
|
||||
tld = 'example'
|
||||
tld = 'freeconcept'
|
||||
https_redirect = "<script>console.log('https.js not loaded on localhost')</script>"
|
||||
|
||||
return render_template('index.html', tld=tld, https_redirect=https_redirect)
|
||||
# Count sales
|
||||
sales = requests.get('https://reg.woodburn.au/api?action=getMyStaked', headers={'Authorization': 'Bearer ' + os.getenv('reg_auth')})
|
||||
sales = sales.json()
|
||||
if 'data' not in sales:
|
||||
return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=0)
|
||||
|
||||
tld_sales = 0
|
||||
sales = sales['data']
|
||||
for sale in sales:
|
||||
if sale['tld'] == tld:
|
||||
print(sale)
|
||||
tld_sales = sale['slds']
|
||||
return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=tld_sales)
|
||||
|
||||
# 404 catch all
|
||||
@app.errorhandler(404)
|
||||
|
@ -36,7 +36,9 @@
|
||||
</header>
|
||||
<section style="font-size: 25px;">
|
||||
<div class="text-center" id="pricing">
|
||||
<p class="text-center" style="font-weight: bold;">.{{tld}}/ domains now available for registration at Woodburn Registry.</p><span>Get yourname.{{tld}}/</span>
|
||||
<p class="text-center" style="font-weight: bold;">.{{tld}}/ domains now available for registration at Woodburn Registry.</p>
|
||||
<span>Get yourname.{{tld}}/</span>
|
||||
<p class="text-center" style="font-weight: bold;">{{sales}} .{{tld}}/ domains claimed so far</p>
|
||||
</div>
|
||||
</section>
|
||||
<footer style="font-size: 25px;background: black;color: white;margin-top: 250px;">
|
||||
|
Loading…
Reference in New Issue
Block a user