shii.moe

Source for `shii.moe' website.
git clone git://git.knutsen.co/shii.moe
Log | Files | Refs

commit 523b0e8876de9cbc4bc0e3cc20a980ace2f7fa28
parent 9d7ec715d1f2c6bda0bcc51ef22aaddaab12b8a9
Author: Demonstrandum <moi@knutsen.co>
Date:   Fri, 18 Sep 2020 21:24:10 +0100

Get correct IP.

Diffstat:
Mshiimoe.py | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/shiimoe.py b/shiimoe.py @@ -40,7 +40,9 @@ def postcomment(): name = request.form.get('name') comment = request.form.get('comment') date = request.form.get('date') or datetime.strftime(now, DATE_FORMAT) - ip = request.environ.get('HTTP_X_REAL_IP') + ip = (request.environ.get('HTTP_X_REAL_IP') or + request.environ.get('REMOTE_ADDR') or + request.remote_addr) # Comment or name left empty, send error message. if not (name or "").strip() or not (comment or "").strip(): @@ -66,3 +68,6 @@ def serve_static(p): if path.exists(p + '.html'): return send_from_directory('./', p + '.html') return send_from_directory('./', p) + +if __name__ == "__main__": + app.run(debug=True)