iptime: also support requests from localhost.

master
Michael Hope 3 years ago
parent 7750379117
commit 1c86e5c746

@ -19,7 +19,8 @@ def now():
ip = flask.request.args.get('ip')
if not ip:
ip = flask.request.remote_addr
if ip.startswith('192.168.') or ip.startswith('10.'):
if ip.startswith('192.168.') or ip.startswith('10.') or ip.startswith(
'127.0.'):
r = requests.get('https://api.ipify.org?format=json')
ip = r.json().get('ip')
loc = geolite2.lookup(ip)

Loading…
Cancel
Save