diff --git a/server.py b/server.py index ee142f1..4f5c1de 100644 --- a/server.py +++ b/server.py @@ -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('/') diff --git a/templates/index.html b/templates/index.html index 4b860b0..53bf4e3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -183,7 +183,7 @@ height="0" width="0" style="display:none;visibility:hidden">
  •    Github
  •   Stripe
  • -

    HNS:
    hs1qk4sq6mk3kcshp02xgchukv09m38czdnq5qv76w
    BTC:
    bc1qhs94zzcw64qnwq4hvk056rwxwvgrkd7tq7d4xw
    ETH:
    0x6cB4B39bEc23a921C9a20D061Bf17d4640B0d39e

    +

    HNS:
    {{HNS}}
    BTC:
    bc1qhs94zzcw64qnwq4hvk056rwxwvgrkd7tq7d4xw
    ETH:
    0x6cB4B39bEc23a921C9a20D061Bf17d4640B0d39e