mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2025-07-16 14:03:28 +02:00
Working geoip lookup
This commit is contained in:
7
templates/helpers.html
Normal file
7
templates/helpers.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% macro place_dl(place, label="", iso_code_prefix="") %}
|
||||
{% if place %}
|
||||
{% if label %}<dh>{{label}}</dh>{% endif %}
|
||||
<dd>{{place.name}} {% if place.iso_code%}({% if iso_code_prefix %}{{iso_code_prefix}}-{% endif %}{{place.iso_code}}){% endif %}</dd>
|
||||
{% endif %}
|
||||
{% endmacro place_dl %}
|
||||
|
@ -1,16 +1,56 @@
|
||||
{% import "helpers.html" as helper %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Your IP: {{ data.query.ip }}</title>
|
||||
</head>
|
||||
<body>
|
||||
{% set r = data.result %}
|
||||
<h1>Your IP-Address is: {{ data.query.ip }}</h1>
|
||||
<p>Your requested format was: <b>{{format}}</b></p>
|
||||
{% if hostname %}
|
||||
<p>Hostname: <b>{{data.result.hostname}}</b></p>
|
||||
{% endif %}
|
||||
{% if data.result.asn %}
|
||||
<p>This IP is part of <b>AS{{ data.result.asn.asn }}</b>, which belongs to: <i>{{ data.result.asn.name }}</i></p>
|
||||
<section>
|
||||
<h2>Network Information</h2>
|
||||
<dl>
|
||||
{% if r.hostname %}
|
||||
<dh>Hostname</dh>
|
||||
<dd><a href="/dig?name={{r.hostname}}">{{r.hostname}}</a></dd>
|
||||
{% endif %}
|
||||
{% if r.asn %}
|
||||
<dh><abbr="Autonomous System Number">ASN</abbr></dh>
|
||||
<dd>AS{{r.asn.asn}}</dd>
|
||||
<dh>AS Name</dh>
|
||||
<dd>{{ r.asn.name }}</dd>
|
||||
</dl>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% if r.location %}
|
||||
<section>
|
||||
<h2>Geolocation</h2>
|
||||
<dl>
|
||||
{{ helper::place_dl(place=r.location.continent, label="Continent") }}
|
||||
{{ helper::place_dl(place=r.location.country, label="Country") }}
|
||||
{{ helper::place_dl(place=r.location.registered_country, label="Registred in") }}
|
||||
{{ helper::place_dl(place=r.location.represented_country, label="Represents") }}
|
||||
{% if r.location.subdivisions %}
|
||||
{% for sd in r.location.subdivisions %}
|
||||
{{ helper::place_dl(place=sd, label="Subdivision", iso_code_prefix=r.location.country.iso_code|default(value="")) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{ helper::place_dl(place=r.location.city, label="City") }}
|
||||
{% if r.location.postal_code %}
|
||||
<dh>Postal Code</dh>
|
||||
<dd>{{r.location.postal_code}}</dd>
|
||||
{% endif %}
|
||||
{% if r.location.time_zone %}
|
||||
<dh>Timezone</dh>
|
||||
<dd>{{r.location.time_zone}}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
<!--We have to put that there to comply with maxminds licensing-->
|
||||
<p><small>
|
||||
The GeopIP and ASN information is provided by the GeoLite2 database created by
|
||||
<a target="_blank" href="https://www.maxmind.com">MaxMind</a>.
|
||||
</small></p>
|
||||
</section>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user