feat: Use dynamic address in index
All checks were successful
Build Docker / Build Image (push) Successful in 29s

This commit is contained in:
Nathan Woodburn 2023-11-02 22:12:15 +11:00
parent 9dee5c24e4
commit f1febd7823
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 11 additions and 3 deletions

View File

@ -64,7 +64,6 @@ def wallet(path):
# Get from 100.66.107.77:8080 then return result
# Check for cookie
if request.cookies.get('HNS'):
print(request.cookies.get('HNS'))
return make_response(request.cookies.get('HNS'), 200, {'Content-Type': 'text/plain'})
address = requests.get('http://hip02-server:3000')
@ -85,7 +84,16 @@ def index():
# If localhost, don't load handshake
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au":
handshake_scripts = ""
return render_template('index.html', handshake_scripts=handshake_scripts)
if request.cookies.get('HNS'):
return render_template('index.html', handshake_scripts=handshake_scripts, HNS=request.cookies.get('HNS'))
address = requests.get('http://hip02-server:3000')
# Set cookie
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts, HNS=address.text), 200, {'Content-Type': 'text/html'})
# Cookie should last 1 week
resp.set_cookie('HNS', address.text, max_age=604800)
return resp
@app.route('/<path:path>')

View File

@ -183,7 +183,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<li class="list-inline-item">&nbsp;<a class="btn btn-primary btn-lg btn-default" role="button" href="https://github.com/sponsors/Nathanwoodburn" style="width: 170px;" target="_blank"><i class="fab fa-github fa-fw"></i><span class="network-name">&nbsp; Github</span></a></li>
<li class="list-inline-item">&nbsp;<a class="btn btn-primary btn-lg btn-default" role="button" href="https://donate.stripe.com/8wM6pv0VD08Xe408ww" style="width: 170px;" target="_blank"><i class="fab fa-stripe-s fa-fw"></i><span class="network-name">&nbsp;Stripe</span></a></li>
</ul>
<p>HNS:<br><code class="hns" style="color: rgb(242,90,5);">hs1qk4sq6mk3kcshp02xgchukv09m38czdnq5qv76w</code><br>BTC:<br><code class="btc" style="color: rgb(242,90,5);">bc1qhs94zzcw64qnwq4hvk056rwxwvgrkd7tq7d4xw</code><br>ETH:<br><code class="eth" style="color: rgb(242,90,5);">0x6cB4B39bEc23a921C9a20D061Bf17d4640B0d39e</code></p>
<p>HNS:<br><code class="hns" style="color: rgb(242,90,5);">{{HNS}}</code><br>BTC:<br><code class="btc" style="color: rgb(242,90,5);">bc1qhs94zzcw64qnwq4hvk056rwxwvgrkd7tq7d4xw</code><br>ETH:<br><code class="eth" style="color: rgb(242,90,5);">0x6cB4B39bEc23a921C9a20D061Bf17d4640B0d39e</code></p>
</div>
</div>
</div>