feat: Add home page info
This commit is contained in:
parent
5be0abeccd
commit
bbb47144f4
23
db.py
23
db.py
@ -2,6 +2,7 @@ import mysql.connector
|
|||||||
import os
|
import os
|
||||||
import dotenv
|
import dotenv
|
||||||
import json
|
import json
|
||||||
|
import random
|
||||||
|
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
|
|
||||||
@ -199,4 +200,24 @@ def update_website_wallet(domain,token,address):
|
|||||||
|
|
||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
def get_random_sites():
|
||||||
|
connection = mysql.connector.connect(**dbargs)
|
||||||
|
cursor = connection.cursor()
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT * FROM site
|
||||||
|
""")
|
||||||
|
data = cursor.fetchall()
|
||||||
|
cursor.close()
|
||||||
|
connection.close()
|
||||||
|
|
||||||
|
# Randomly pick 5
|
||||||
|
if len(data) > 5:
|
||||||
|
data = random.sample(data,5)
|
||||||
|
|
||||||
|
names = []
|
||||||
|
for site in data:
|
||||||
|
names.append(site[1])
|
||||||
|
|
||||||
|
return names
|
22
main.py
22
main.py
@ -24,6 +24,8 @@ CITY_DOMAIN = os.getenv('CITY_DOMAIN')
|
|||||||
if CITY_DOMAIN == None:
|
if CITY_DOMAIN == None:
|
||||||
CITY_DOMAIN = "exampledomainnathan1"
|
CITY_DOMAIN = "exampledomainnathan1"
|
||||||
|
|
||||||
|
random_sites = ""
|
||||||
|
|
||||||
#Assets routes
|
#Assets routes
|
||||||
@app.route('/assets/<path:path>')
|
@app.route('/assets/<path:path>')
|
||||||
def assets(path):
|
def assets(path):
|
||||||
@ -35,6 +37,15 @@ def error(message):
|
|||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
global random_sites
|
||||||
|
if random_sites == "":
|
||||||
|
random_sites_names = db.get_random_sites()
|
||||||
|
for site in random_sites_names:
|
||||||
|
random_sites += "<a href='https://" + site + "." + CITY_DOMAIN + "' target='_blank'>" + site + "." +CITY_DOMAIN+ "</a><br>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if 'token' in request.cookies:
|
if 'token' in request.cookies:
|
||||||
token = request.cookies['token']
|
token = request.cookies['token']
|
||||||
# Verify token
|
# Verify token
|
||||||
@ -44,8 +55,8 @@ def index():
|
|||||||
resp = make_response(redirect('/'))
|
resp = make_response(redirect('/'))
|
||||||
resp.set_cookie('token', '', expires=0)
|
resp.set_cookie('token', '', expires=0)
|
||||||
return resp
|
return resp
|
||||||
return render_template('index.html',account=user['email'],account_link="account",account_link_name="Account",CITY_DOMAIN=CITY_DOMAIN)
|
return render_template('index.html',account=user['email'],account_link="account",account_link_name="Account",CITY_DOMAIN=CITY_DOMAIN,random_sites=random_sites)
|
||||||
return render_template('index.html',account="Login",account_link="login",account_link_name="Login",CITY_DOMAIN=CITY_DOMAIN)
|
return render_template('index.html',account="Login",account_link="login",account_link_name="Login",CITY_DOMAIN=CITY_DOMAIN,random_sites=random_sites)
|
||||||
|
|
||||||
@app.route('/signup', methods=['POST'])
|
@app.route('/signup', methods=['POST'])
|
||||||
def signup():
|
def signup():
|
||||||
@ -229,7 +240,12 @@ def catch_all(path):
|
|||||||
def not_found(e):
|
def not_found(e):
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
|
||||||
|
def update_random_sites():
|
||||||
|
global random_sites
|
||||||
|
random_sites_names = db.get_random_sites()
|
||||||
|
random_sites = ""
|
||||||
|
for site in random_sites_names:
|
||||||
|
random_sites += "<a href='https://" + site + "." + CITY_DOMAIN + "' target='_blank'>" + site + "." +CITY_DOMAIN+ "</a><br>"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
db.check_tables()
|
db.check_tables()
|
||||||
|
@ -9,4 +9,5 @@ py3dns
|
|||||||
passlib
|
passlib
|
||||||
argon2-cffi
|
argon2-cffi
|
||||||
mysql-connector-python
|
mysql-connector-python
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
|
apscheduler
|
11
server.py
11
server.py
@ -8,8 +8,13 @@ import dotenv
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import db
|
import db
|
||||||
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
|
|
||||||
|
|
||||||
|
def update_sites_job():
|
||||||
|
print("Updating random sites", flush=True)
|
||||||
|
main.update_random_sites()
|
||||||
|
|
||||||
class GunicornApp(BaseApplication):
|
class GunicornApp(BaseApplication):
|
||||||
def __init__(self, app, options=None):
|
def __init__(self, app, options=None):
|
||||||
self.options = options or {}
|
self.options = options or {}
|
||||||
@ -26,6 +31,12 @@ class GunicornApp(BaseApplication):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
db.check_tables()
|
db.check_tables()
|
||||||
|
|
||||||
|
scheduler = BackgroundScheduler()
|
||||||
|
scheduler.add_job(update_sites_job, 'interval', minutes=15)
|
||||||
|
scheduler.start()
|
||||||
|
|
||||||
|
|
||||||
workers = os.getenv('WORKERS')
|
workers = os.getenv('WORKERS')
|
||||||
threads = os.getenv('THREADS')
|
threads = os.getenv('THREADS')
|
||||||
if workers is None:
|
if workers is None:
|
||||||
|
2
templates/assets/css/styles.min.css
vendored
2
templates/assets/css/styles.min.css
vendored
@ -1 +1 @@
|
|||||||
.bs-icon{--bs-icon-size:.75rem;display:flex;flex-shrink:0;justify-content:center;align-items:center;font-size:var(--bs-icon-size);width:calc(var(--bs-icon-size) * 2);height:calc(var(--bs-icon-size) * 2);color:var(--bs-primary)}.bs-icon-xs{--bs-icon-size:1rem;width:calc(var(--bs-icon-size) * 1.5);height:calc(var(--bs-icon-size) * 1.5)}.bs-icon-sm{--bs-icon-size:1rem}.bs-icon-md{--bs-icon-size:1.5rem}.bs-icon-lg{--bs-icon-size:2rem}.bs-icon-xl{--bs-icon-size:2.5rem}.bs-icon.bs-icon-primary{color:var(--bs-white);background:var(--bs-primary)}.bs-icon.bs-icon-primary-light{color:var(--bs-primary);background:rgba(var(--bs-primary-rgb),.2)}.bs-icon.bs-icon-semi-white{color:var(--bs-primary);background:rgba(255,255,255,.5)}.bs-icon.bs-icon-rounded{border-radius:.5rem}.bs-icon.bs-icon-circle{border-radius:50%}.right-align{right:0;margin-right:1%}.top-align{top:0;margin-top:1%}.sticky-bottom{width:100%;bottom:1%;left:0}
|
a{color:inherit}.bs-icon{--bs-icon-size:.75rem;display:flex;flex-shrink:0;justify-content:center;align-items:center;font-size:var(--bs-icon-size);width:calc(var(--bs-icon-size) * 2);height:calc(var(--bs-icon-size) * 2);color:var(--bs-primary)}.bs-icon-xs{--bs-icon-size:1rem;width:calc(var(--bs-icon-size) * 1.5);height:calc(var(--bs-icon-size) * 1.5)}.bs-icon-sm{--bs-icon-size:1rem}.bs-icon-md{--bs-icon-size:1.5rem}.bs-icon-lg{--bs-icon-size:2rem}.bs-icon-xl{--bs-icon-size:2.5rem}.bs-icon.bs-icon-primary{color:var(--bs-white);background:var(--bs-primary)}.bs-icon.bs-icon-primary-light{color:var(--bs-primary);background:rgba(var(--bs-primary-rgb),.2)}.bs-icon.bs-icon-semi-white{color:var(--bs-primary);background:rgba(255,255,255,.5)}.bs-icon.bs-icon-rounded{border-radius:.5rem}.bs-icon.bs-icon-circle{border-radius:50%}.right-align{right:0;margin-right:1%}.top-align{top:0;margin-top:1%}.sticky-bottom{width:100%;bottom:1%;left:0}
|
@ -14,7 +14,6 @@
|
|||||||
<link rel="icon" type="image/png" sizes="670x700" href="assets/img/HNS.png">
|
<link rel="icon" type="image/png" sizes="670x700" href="assets/img/HNS.png">
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||||
<link rel="stylesheet" href="assets/css/city.min.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="height: 99vh;width: 100vw;color: #1fffff;background: #000000;overflow-x: hidden;">
|
<body style="height: 99vh;width: 100vw;color: #1fffff;background: #000000;overflow-x: hidden;">
|
||||||
|
@ -32,12 +32,12 @@
|
|||||||
<section style="margin-top: 10px;">
|
<section style="margin-top: 10px;">
|
||||||
<div class="row" style="margin: 0px;">
|
<div class="row" style="margin: 0px;">
|
||||||
<div class="col" style="background: var(--bs-body-color);margin-right: 10px;border-radius: 10px;">
|
<div class="col" style="background: var(--bs-body-color);margin-right: 10px;border-radius: 10px;">
|
||||||
<h1 style="margin: 10px;">Heading</h1>
|
<h1 style="margin: 10px;">Introducing ShakeCities</h1>
|
||||||
<p style="margin: 10px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vivamus urna nisi dapibus nascetur convallis sollicitudin tempus lorem condimentum. Aptent dictumst montes id mattis molestie parturient morbi lobortis cubilia pharetra. Natoque adipiscing mollis parturient odio elit eu varius vulputate phasellus gravida. Et eget donec fringilla viverra id eu tempor ullamcorper aliquet vehicula. Et euismod magnis interdum mollis tellus lacinia at sollicitudin morbi inceptos.<br><br>Dictumst natoque imperdiet per praesent nisl morbi fermentum ultrices vivamus eu. Dictum venenatis netus orci himenaeos dictumst mattis pulvinar mattis laoreet tempor. Vulputate consequat in duis convallis mus mattis suspendisse semper netus varius. Magna placerat lectus eleifend nisi nunc laoreet lorem ipsum primis pellentesque. Fusce inceptos ante orci habitasse dui torquent dictum habitant iaculis sit. Interdum sociis eu porta inceptos parturient neque tortor lectus vivamus nunc.</p>
|
<p style="margin: 10px;">ShakeCities is a site offering free personalizable websites. This is a perfect way to start your journey into Handshake domains! Step into a new experience where Handshake domains become instant sites, and where everyone can create their own unique decentralized page.<br>Secured with HTTPS powered by DANE (DNS-based Authentication of Named Entities).<br>But that's not all – ShakeCities goes beyond, allowing you to seamlessly integrate crypto addresses into your site, providing an easy way to get paid. Simply send crypto to <code>@yourname.{{CITY_DOMAIN}}</code><br>Join us in building a decentralized, secure, and innovative internet landscape. Embrace the future with ShakeCities – where Handshake domains meet simplicity.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col" style="background: var(--bs-body-color);margin-left: 10px;border-radius: 10px;">
|
<div class="col" style="background: var(--bs-body-color);margin-left: 10px;border-radius: 10px;">
|
||||||
<h1 style="margin: 10px;">Heading</h1>
|
<h1 style="margin: 10px;">Find a site</h1>
|
||||||
<p style="margin: 10px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Conubia semper malesuada lobortis blandit ac leo leo potenti vel rutrum volutpat. Orci taciti arcu ipsum arcu rhoncus tortor aliquet id magna malesuada amet. Diam inceptos tempor gravida mattis mollis at imperdiet eros per cras sagittis.<br><br>Aliquet faucibus elit lacus elementum sed malesuada a vestibulum lacinia bibendum eleifend. Viverra mattis eleifend cum nulla nascetur parturient lectus vitae nostra a sem. Vel proin ullamcorper platea aenean vivamus volutpat lacus velit rutrum mi consequat. Ac gravida risus purus ligula mollis potenti duis ultricies eleifend tellus adipiscing.<br><br>Congue aenean lobortis fermentum lectus vel justo scelerisque id vitae mauris lacus. Gravida porta dolor tellus sem iaculis dictumst a mus in lorem ipsum. Dapibus pulvinar pretium ornare mauris duis sagittis non ullamcorper orci vestibulum venenatis. Imperdiet posuere penatibus sed senectus enim sollicitudin semper justo lorem aptent cras.</p>
|
<p style="margin: 10px;font-size: 20px;">{{random_sites|safe}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<section class="d-none d-print-block d-md-block d-lg-block d-xl-block d-xxl-block" style="background: var(--bs-body-color);text-align: center;padding-top: 10px;padding-bottom: 10px;margin-bottom: 25px;margin-top: 40px;border-radius: 10px;">
|
<section class="d-none d-print-block d-md-block d-lg-block d-xl-block d-xxl-block" style="background: var(--bs-body-color);text-align: center;padding-top: 10px;padding-bottom: 10px;margin-bottom: 25px;margin-top: 40px;border-radius: 10px;">
|
||||||
<div style="margin: 20px;">
|
<div style="margin: 20px;">
|
||||||
<h1>Contact</h1>
|
<h1>Contact</h1>
|
||||||
<div class="list-group list-group-horizontal" data-bs-theme="dark" style="margin: auto;width: 50%;"><button class="list-group-item list-group-item-action" style="width: 33%;padding: 0px;margin: 10px;"><a class="btn btn-primary" role="button" style="width: 100%;" target="_blank" href="https://discord.com">Discord</a></button><button class="list-group-item list-group-item-action" style="width: 33%;padding: 0px;margin: 10px;"><a class="btn btn-primary" role="button" style="width: 100%;" target="_blank" href="mailto:email@example.com">Email</a></button><button class="list-group-item list-group-item-action" style="width: 33%;padding: 0px;margin: 10px;"><a class="btn btn-primary" role="button" style="width: 100%;" target="_blank" href="https://twitter.com">Twitter</a></button></div>
|
<div class="list-group list-group-horizontal" data-bs-theme="dark" style="margin: auto;width: 50%;"><button class="list-group-item list-group-item-action" style="width: 33%;padding: 0px;margin: 10px;"><a class="btn btn-primary" role="button" style="width: 100%;" target="_blank" href="https://l.woodburn.au/discord">Discord</a></button><button class="list-group-item list-group-item-action" style="width: 33%;padding: 0px;margin: 10px;"><a class="btn btn-primary" role="button" style="width: 100%;" target="_blank" href="mailto:shakecities@woodburn.au">Email</a></button><button class="list-group-item list-group-item-action" style="width: 33%;padding: 0px;margin: 10px;"><a class="btn btn-primary" role="button" style="width: 100%;" target="_blank" href="https://hnschat#channel:woodburn">HNSChat</a></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin: 20px;">
|
<div style="margin: 20px;">
|
||||||
<h1>Donate</h1>
|
<h1>Donate</h1>
|
||||||
|
Loading…
Reference in New Issue
Block a user