Compare commits
2 Commits
2d68de54ac
...
784455fe1d
Author | SHA1 | Date | |
---|---|---|---|
784455fe1d | |||
7c3d101782 |
15
main.py
15
main.py
@ -22,9 +22,17 @@ def send_report(path):
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
params = request.args
|
params = request.args
|
||||||
|
if 'r' in request.cookies:
|
||||||
|
print("Referer: " + request.cookies['r'])
|
||||||
|
return render_template('index.html', hidden=request.cookies['r'],address=address)
|
||||||
|
|
||||||
|
|
||||||
if 'r' in params:
|
if 'r' in params:
|
||||||
print("Referer: " + params['r'])
|
print("Referer: " + params['r'])
|
||||||
return render_template('index.html', hidden=params['r'],address=address)
|
# Set cookie
|
||||||
|
resp = make_response(render_template('index.html', hidden=params['r'],address=address))
|
||||||
|
resp.set_cookie('r', params['r'], max_age=60*60*24)
|
||||||
|
return resp
|
||||||
|
|
||||||
return render_template('index.html',address=address)
|
return render_template('index.html',address=address)
|
||||||
|
|
||||||
@ -45,6 +53,9 @@ def submit():
|
|||||||
if hidden == '':
|
if hidden == '':
|
||||||
hidden = 'None'
|
hidden = 'None'
|
||||||
|
|
||||||
|
if 'r' in request.cookies:
|
||||||
|
hidden = request.cookies['r']
|
||||||
|
|
||||||
status = gift.gift(name, email, hidden, ip)
|
status = gift.gift(name, email, hidden, ip)
|
||||||
print(status,flush=True)
|
print(status,flush=True)
|
||||||
|
|
||||||
@ -99,7 +110,7 @@ def catch_all(path):
|
|||||||
# # Try with .html
|
# # Try with .html
|
||||||
# if os.path.isfile('templates/' + path + '.html'):
|
# if os.path.isfile('templates/' + path + '.html'):
|
||||||
# return render_template(path + '.html')
|
# return render_template(path + '.html')
|
||||||
return redirect('/')
|
return redirect('/?r='+path)
|
||||||
|
|
||||||
# 404 catch all
|
# 404 catch all
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
|
Loading…
Reference in New Issue
Block a user