feat: Add HIP2 Display toggle
This commit is contained in:
parent
743a8d6916
commit
3e9ff9d916
12
main.py
12
main.py
@ -137,7 +137,7 @@ def edit():
|
||||
fg_colour = ""
|
||||
text_colour = ""
|
||||
email = ""
|
||||
template = ""
|
||||
hip2_display = False
|
||||
|
||||
if 'data' in data:
|
||||
html = data['data'].encode('utf-8').decode('unicode-escape')
|
||||
@ -174,11 +174,14 @@ def edit():
|
||||
else:
|
||||
selected_template = templates[0]
|
||||
|
||||
if 'hip2_display' in data:
|
||||
hip2_display = data['hip2_display']
|
||||
|
||||
|
||||
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,email=email,location=location,avatar=avatar,
|
||||
bg_colour=bg_colour,fg_colour=fg_colour,text_colour=text_colour,templates=templates,
|
||||
selected_template=selected_template,CITY_DOMAIN=CITY_DOMAIN,domain=user['domain'])
|
||||
selected_template=selected_template,CITY_DOMAIN=CITY_DOMAIN,domain=user['domain'],hip2_display=hip2_display)
|
||||
|
||||
|
||||
@app.route('/edit', methods=['POST'])
|
||||
@ -208,6 +211,11 @@ def send_edit():
|
||||
data['email'] = request.form['email']
|
||||
data['template'] = request.form['template']
|
||||
|
||||
if 'hip2_display' in request.form:
|
||||
data['hip2_display'] = True
|
||||
else:
|
||||
data['hip2_display'] = False
|
||||
|
||||
# Convert to json
|
||||
data = json.dumps(data)
|
||||
db.update_website_data_raw(user['domain'],data)
|
||||
|
@ -41,6 +41,11 @@ def render(data,db_object):
|
||||
location = db_object['location']
|
||||
email = db_object['email']
|
||||
hns = db_object['HNS']
|
||||
|
||||
if 'hip2_display' in db_object:
|
||||
if db_object['hip2_display'] == True:
|
||||
hns = "@"+request.host
|
||||
|
||||
btc = db_object['BTC']
|
||||
eth = db_object['ETH']
|
||||
bg_colour = db_object['bg_colour']
|
||||
|
@ -45,11 +45,20 @@
|
||||
<form action="/upload" method="post" enctype="multipart/form-data"><label class="form-label" style="margin-right: 20px;">Avatar</label>
|
||||
<div style="display: inline-block;">{{avatar|safe}}</div><input class="form-control" type="file" style="display: inline-block;width: 300px;margin-right: 25px;" name="file" accept="image/*" required=""><input class="btn btn-primary" type="submit" style="margin-right: 20px;" value="Upload"><a class="btn btn-primary" role="button" href="/avatar/clear">Clear</a>
|
||||
</form>
|
||||
<form method="post"><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}}">
|
||||
<form class="text-center" method="post"><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 </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 </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 </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}}" required="" pattern="hs1[A-Za-z0-9]+"><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}}" required="" pattern="0x[A-Za-z0-9]+">
|
||||
<div style="margin-top: 10px;"><label class="form-label" style="margin-right: 25px;">Template</label><select class="form-select" id="template" name="template" style="width:auto;display:inline-block;">
|
||||
<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 </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>
|
||||
<div class="text-center">
|
||||
<div><input class="form-control" type="text" style="margin-top: 10px;display: inline-block;width: auto;" placeholder="HNS Address" name="hns" value="{{hns}}" required="" pattern="hs1[A-Za-z0-9]+"><div class="form-check form-switch form-check-inline" style="display: inline-block;margin-left: 10px;">
|
||||
<input id="formCheck-1" class="form-check-input" type="checkbox" {% if hip2_display %}checked{% endif %} name="hip2_display" />
|
||||
<label class="form-check-label" for="formCheck-1">Show as @{{domain}}.{{CITY_DOMAIN}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div><input class="form-control" type="text" style="margin-top: 10px;width: auto;display: inline-block;" name="btc" placeholder="BTC Address" value="{{btc}}"></div>
|
||||
<div><input class="form-control" type="text" style="margin-top: 10px;width: auto;display: inline-block;" placeholder="ETH Address" name="eth" value="{{eth}}" required="" pattern="0x[A-Za-z0-9]+"></div>
|
||||
</div>
|
||||
<div style="margin-top: 10px;display: inline-block;"><label class="form-label" style="margin-right: 25px;">Template</label><select class="form-select" id="template" name="template" style="width:auto;display:inline-block;">
|
||||
{% for template in templates %}
|
||||
<option value="{{ template }}" {% if template == selected_template %}selected{% endif %}>{{ template }}</option>
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user