feat: Add email to city and cleanup display
All checks were successful
Build Docker / Build Main Image (push) Successful in 20s
Build Docker / Build SLDs Image (push) Successful in 19s

This commit is contained in:
Nathan Woodburn 2023-11-16 12:52:12 +11:00
parent 8067c33a38
commit 935d534e24
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
7 changed files with 47 additions and 76 deletions

View File

@ -92,6 +92,9 @@ def login(email,password):
# Create a cookie # Create a cookie
token = generate_cookie() token = generate_cookie()
user['tokens'].append(token) user['tokens'].append(token)
# Get the newest 2 tokens
user['tokens'] = user['tokens'][-2:]
# Update user # Update user
db.update_tokens(user['id'], user['tokens']) db.update_tokens(user['id'], user['tokens'])
return {'success': True, 'message': 'Logged in', 'token': token} return {'success': True, 'message': 'Logged in', 'token': token}

View File

@ -138,9 +138,11 @@ def edit():
fg_colour = data['fg_colour'] fg_colour = data['fg_colour']
if 'text_colour' in data: if 'text_colour' in data:
text_colour = data['text_colour'] text_colour = data['text_colour']
if 'email' in data:
email = data['email']
return render_template('edit.html',account=user['email'],account_link="account",account_link_name="Account",data=html, return render_template('edit.html',account=user['email'],account_link="account",account_link_name="Account",data=html,
hns=hns,btc=btc,eth=eth,hnschat=hnschat,location=location,avatar=avatar, hns=hns,btc=btc,eth=eth,hnschat=hnschat,email=email,location=location,avatar=avatar,
bg_colour=bg_colour,fg_colour=fg_colour,text_colour=text_colour, bg_colour=bg_colour,fg_colour=fg_colour,text_colour=text_colour,
CITY_DOMAIN=CITY_DOMAIN,domain=user['domain']) CITY_DOMAIN=CITY_DOMAIN,domain=user['domain'])
@ -170,6 +172,7 @@ def send_edit():
data['bg_colour'] = request.form['bg_colour'] data['bg_colour'] = request.form['bg_colour']
data['fg_colour'] = request.form['fg_colour'] data['fg_colour'] = request.form['fg_colour']
data['text_colour'] = request.form['text_colour'] data['text_colour'] = request.form['text_colour']
data['email'] = request.form['email']
# Convert to json # Convert to json
data = json.dumps(data) data = json.dumps(data)

View File

@ -26,6 +26,7 @@ def render(data,db_object):
avatar = db_object['avatar'] avatar = db_object['avatar']
hnschat = db_object['hnschat'] hnschat = db_object['hnschat']
location = db_object['location'] location = db_object['location']
email = db_object['email']
hns = db_object['HNS'] hns = db_object['HNS']
btc = db_object['BTC'] btc = db_object['BTC']
eth = db_object['ETH'] eth = db_object['ETH']
@ -37,11 +38,13 @@ def render(data,db_object):
btc_icon = "assets/img/BTCW.png" btc_icon = "assets/img/BTCW.png"
eth_icon = "assets/img/ETHW.png" eth_icon = "assets/img/ETHW.png"
location_icon = "assets/img/mapw.png" location_icon = "assets/img/mapw.png"
email_icon = "assets/img/emailw.png"
else: else:
hns_icon = "assets/img/HNS.png" hns_icon = "assets/img/HNS.png"
btc_icon = "assets/img/BTC.png" btc_icon = "assets/img/BTC.png"
eth_icon = "assets/img/ETH.png" eth_icon = "assets/img/ETH.png"
location_icon = "assets/img/map.png" location_icon = "assets/img/map.png"
email_icon = "assets/img/email.png"
if hns != "": if hns != "":
hns = "<img src='" + hns_icon + "' width='20px' height='20px' style='margin-right: 5px;'>" + hns hns = "<img src='" + hns_icon + "' width='20px' height='20px' style='margin-right: 5px;'>" + hns
@ -50,9 +53,13 @@ def render(data,db_object):
if eth != "": if eth != "":
eth = "<img src='" + eth_icon + "' width='20px' height='30px' style='margin-right: 5px;'>" + eth eth = "<img src='" + eth_icon + "' width='20px' height='30px' style='margin-right: 5px;'>" + eth
if hnschat != "": if hnschat != "":
hnschat = "<img src='"+hns_icon+"' width='20px' height='20px' style='margin-right: 5px;'>" + hnschat hnschat = "<a href='https://hns.chat/#message:"+hnschat+"' target='_blank'><img src='"+hns_icon+"' width='20px' height='20px' style='margin-right: 5px;'>" + hnschat + "</a>"
if location != "": if location != "":
location = "<img src='"+location_icon+"' width='20px' height='30px' style='margin-right: 5px;'>" + location location = "<img src='"+location_icon+"' width='20px' height='30px' style='margin-right: 5px;'>" + location
if email != "":
email = "<a href='mailto:"+email+"'><img src='"+email_icon+"' width='30px' height='20px' style='margin-right: 5px;margin-left:-10px;'>" + email + "</a>"
@ -62,7 +69,7 @@ def render(data,db_object):
return render_template('city.html',html=html,bg_colour=bg_colour,text_colour=text_colour, return render_template('city.html',html=html,bg_colour=bg_colour,text_colour=text_colour,
fg_colour=fg_colour, avatar=avatar,main_domain=main_domain, fg_colour=fg_colour, avatar=avatar,main_domain=main_domain,
hnschat=hnschat,location=location, hns_icon=hns_icon, hnschat=hnschat,email=email,location=location, hns_icon=hns_icon,
hns=hns,btc=btc,eth=eth, data=html) hns=hns,btc=btc,eth=eth, data=html)

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -17,19 +17,27 @@
</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;">
<div class="d-print-block d-sm-none d-md-none d-lg-none d-xl-block d-xxl-block"> <div style="margin: 10px;">
<div class="d-xl-flex align-items-xl-center" style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-right: 2%;padding-bottom: 2%;width: 40%;display: inline-flex;height: 15em;margin-top: 1%;margin-left: 1%;"><img src="{{avatar}}" width="200vw" height="200vw" style="border-radius: 50%;"> <div class="row row-cols-1 row-cols-sm-1 row-cols-md-1 row-cols-lg-1 row-cols-xl-2 row-cols-xxl-2 justify-content-center align-items-center" style="margin: 0px;">
<div style="margin-left: 40px;"> <div class="col text-center align-self-center m-auto">
<div class="d-xl-flex align-items-xl-center" style="background: #f1ffff;padding: 10px;border-radius: 10px;"><img src="{{avatar}}" width="200vw" height="200vw" style="border-radius: 50%;">
<div class="d-none d-sm-none d-md-none d-lg-none d-xl-block d-xxl-block" style="width: 40px;"></div>
<div> <div>
<p style="font-size: 24px;"><a href="https://hns.chat/#message:{{hnschat}}" target="_blank">{{hnschat|safe}}</a></p> <div>
<p style="font-size: 24px;">{{hnschat|safe}}</p>
</div>
<div>
<p style="font-size: 24px;">{{email|safe}}</p>
</div> </div>
<div> <div>
<p style="font-size: 24px;">{{location|safe}}</p> <p style="font-size: 24px;">{{location|safe}}</p>
</div> </div>
</div> </div>
</div> </div>
<div class="d-xl-flex align-items-xl-center right-align top-align" style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-bottom: 2%;width: 50%;position: absolute;padding-right: 2%;display: inline-flex;height: 15em;"> </div>
<div style="display: inline-block;"> <div class="col text-center align-self-center m-auto">
<div class="d-xl-flex align-items-xl-center" style="background: #f1ffff;padding: 10px;border-radius: 10px;">
<div>
<div> <div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/HNS" target="_blank">{{hns|safe}}</a></p> <p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/HNS" target="_blank">{{hns|safe}}</a></p>
</div> </div>
@ -42,59 +50,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="d-print-none d-sm-none d-md-none d-lg-block d-xl-none d-xxl-none">
<div style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-right: 2%;padding-bottom: 2%;width: 40%;margin-top: 1%;margin-left: 1%;text-align: center;">
<div style="width: 20vw;height: 20vw;max-height: 200px;max-width: 200px;margin: auto;"><img src="{{avatar}}" width="100%" height="100%" style="border-radius: 50%;"></div>
<div class="text-center">
<div>
<p style="font-size: 24px;">{{hnschat|safe}}</p>
</div>
<div>
<p style="font-size: 24px;">{{location|safe}}</p>
</div> </div>
</div> </div>
</div> <div style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-right: 2%;padding-bottom: 2%;margin: 22px;">
<div class="d-xl-flex align-items-xl-center right-align top-align" style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-bottom: 2%;width: 50%;position: absolute;padding-right: 2%;display: inline-flex;height: 15em;">
<div style="display: inline-block;">
<div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/HNS" target="_blank">{{hns|safe}}</a></p>
</div>
<div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/BTC" target="_blank">{{btc|safe}}</a></p>
</div>
<div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/ETH">{{eth|safe}}</a></p>
</div>
</div>
</div>
</div>
<div class="d-none d-print-none d-sm-block d-md-block d-lg-none d-xl-none d-xxl-none">
<div class="d-xl-flex align-items-xl-center" style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-right: 2%;padding-bottom: 2%;display: inline-flex;margin: 1%;width: 98%;">
<div style="width: 20vw;height: 20vw;display: inline-block;"><img src="{{avatar}}" width="100%" height="100%" style="border-radius: 50%;"></div>
<div style="display: inline-block;margin-left: 40px;">
<div>
<p style="font-size: 24px;">{{hnschat|safe}}</p>
</div>
<div>
<p style="font-size: 24px;">{{location|safe}}</p>
</div>
</div>
</div>
<div class="d-xl-flex align-items-xl-center" style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-bottom: 2%;padding-right: 2%;display: inline-flex;margin: 1%;width: 98%;">
<div style="display: inline-block;">
<div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/HNS" target="_blank">{{hns|safe}}</a></p>
</div>
<div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/BTC" target="_blank">{{btc|safe}}</a></p>
</div>
<div>
<p style="font-size: 24px;margin-bottom: 0px;"><a href="/.well-known/wallets/ETH" target="_blank">{{eth|safe}}</a></p>
</div>
</div>
</div>
</div>
<div style="background: #f1ffff;border-radius: 10px;padding-top: 2%;padding-left: 2%;padding-right: 2%;padding-bottom: 2%;margin: 1%;margin-right: 1.6%;">
<p style="font-size: 24px;">{{data|safe}}</p> <p style="font-size: 24px;">{{data|safe}}</p>
</div> </div>
<div class="d-flex justify-content-xl-start align-items-xl-center" style="margin-right: 1%;margin-left: 1%;height: 6%;margin-top: 0.5%;"> <div class="d-flex justify-content-xl-start align-items-xl-center" style="margin-right: 1%;margin-left: 1%;height: 6%;margin-top: 0.5%;">

View File

@ -33,7 +33,7 @@
<h1 style="text-align: center;margin-bottom: 30px;">Edit your page</h1> <h1 style="text-align: center;margin-bottom: 30px;">Edit your page</h1>
</section> </section>
<section style="width: 80%;margin: auto;"> <section style="width: 80%;margin: auto;">
<form method="post"><input class="form-control" type="text" style="margin-top: 10px;" name="avatar" value="{{avatar}}" placeholder="Avatar URL"><input class="form-control" type="text" style="margin-top: 10px;" name="location" value="{{location}}" placeholder="Location"><input class="form-control" type="text" style="margin-top: 10px;" name="hnschat" placeholder="HNSChat" value="{{hnschat}}"> <form method="post"><input class="form-control" type="text" style="margin-top: 10px;" name="avatar" value="{{avatar}}" placeholder="Avatar URL"><input class="form-control" type="text" style="margin-top: 10px;" name="location" value="{{location}}" placeholder="Location"><input class="form-control" type="text" style="margin-top: 10px;" name="hnschat" placeholder="HNSChat" value="{{hnschat}}"><input class="form-control" type="text" style="margin-top: 10px;" name="email" placeholder="Public Email" value="{{email}}">
<div class="d-xl-flex justify-content-xl-center align-items-xl-center" style="margin-bottom: 10px;margin-top: 10px;"><label class="form-label" style="display: inline-block;margin-right: 15px;">Background colour&nbsp;</label><input class="form-control form-control-color" type="color" style="display: inline-block;border-radius: 50%;width: 50px;height: 50px;" name="bg_colour" value="{{bg_colour}}"></div> <div class="d-xl-flex justify-content-xl-center align-items-xl-center" style="margin-bottom: 10px;margin-top: 10px;"><label class="form-label" style="display: inline-block;margin-right: 15px;">Background colour&nbsp;</label><input class="form-control form-control-color" type="color" style="display: inline-block;border-radius: 50%;width: 50px;height: 50px;" name="bg_colour" value="{{bg_colour}}"></div>
<div class="d-xl-flex justify-content-xl-center align-items-xl-center" style="margin-bottom: 10px;margin-top: 10px;"><label class="form-label" style="display: inline-block;margin-right: 15px;">Foreground colour&nbsp;</label><input class="form-control form-control-color" type="color" style="display: inline-block;border-radius: 50%;width: 50px;height: 50px;" name="fg_colour" value="{{fg_colour}}"></div> <div class="d-xl-flex justify-content-xl-center align-items-xl-center" style="margin-bottom: 10px;margin-top: 10px;"><label class="form-label" style="display: inline-block;margin-right: 15px;">Foreground colour&nbsp;</label><input class="form-control form-control-color" type="color" style="display: inline-block;border-radius: 50%;width: 50px;height: 50px;" name="fg_colour" value="{{fg_colour}}"></div>
<div class="d-xl-flex justify-content-xl-center align-items-xl-center" style="margin-bottom: 10px;margin-top: 10px;"><label class="form-label" style="display: inline-block;margin-right: 15px;">Text colour&nbsp;</label><input class="form-control form-control-color" type="color" style="display: inline-block;border-radius: 50%;width: 50px;height: 50px;" name="text_colour" value="{{text_colour}}"></div><textarea class="form-control form-control-lg" rows="15" name="data" placeholder="HTML Content">{{data}}</textarea><input class="form-control" type="text" style="margin-top: 10px;" placeholder="HNS Address" name="hns" value="{{hns}}"><input class="form-control" type="text" style="margin-top: 10px;" name="btc" placeholder="BTC Address" value="{{btc}}"><input class="form-control" type="text" style="margin-top: 10px;" placeholder="ETH Address" name="eth" value="{{eth}}"> <div class="d-xl-flex justify-content-xl-center align-items-xl-center" style="margin-bottom: 10px;margin-top: 10px;"><label class="form-label" style="display: inline-block;margin-right: 15px;">Text colour&nbsp;</label><input class="form-control form-control-color" type="color" style="display: inline-block;border-radius: 50%;width: 50px;height: 50px;" name="text_colour" value="{{text_colour}}"></div><textarea class="form-control form-control-lg" rows="15" name="data" placeholder="HTML Content">{{data}}</textarea><input class="form-control" type="text" style="margin-top: 10px;" placeholder="HNS Address" name="hns" value="{{hns}}"><input class="form-control" type="text" style="margin-top: 10px;" name="btc" placeholder="BTC Address" value="{{btc}}"><input class="form-control" type="text" style="margin-top: 10px;" placeholder="ETH Address" name="eth" value="{{eth}}">