mirror of
https://github.com/cwinfo/yggdrasil-map
synced 2024-11-22 08:10:27 +00:00
Merge pull request #5 from interfect/no-ip
Safely omit IP if it is not available.
This commit is contained in:
commit
3478a0023c
@ -15,7 +15,7 @@
|
|||||||
<li><a href="/" {% if page == 'network' %} class="selected" {% endif %}>Network</a></li>
|
<li><a href="/" {% if page == 'network' %} class="selected" {% endif %}>Network</a></li>
|
||||||
<li><a href="/about"{% if page == 'about' %} class="selected" {% endif %}>About</a></li>
|
<li><a href="/about"{% if page == 'about' %} class="selected" {% endif %}>About</a></li>
|
||||||
<li><a href="https://github.com/zielmicha/fc00.org">Source</a></li>
|
<li><a href="https://github.com/zielmicha/fc00.org">Source</a></li>
|
||||||
<li><tt>{{ ip }}</tt></li>
|
<li><tt>{% if ip is not none %}{{ ip }}{% endif %}</tt></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -5,7 +5,10 @@ app = Flask(__name__)
|
|||||||
app.config.from_pyfile('web_config.cfg')
|
app.config.from_pyfile('web_config.cfg')
|
||||||
|
|
||||||
def get_ip():
|
def get_ip():
|
||||||
ip = request.headers['x-real-ip']
|
try:
|
||||||
|
ip = request.headers['x-real-ip']
|
||||||
|
except KeyError:
|
||||||
|
ip = None
|
||||||
if ip == '10.18.3.20':
|
if ip == '10.18.3.20':
|
||||||
ip = request.headers['x-atomshare-real-ip']
|
ip = request.headers['x-atomshare-real-ip']
|
||||||
return ip
|
return ip
|
||||||
|
Loading…
Reference in New Issue
Block a user