echoip-slatecave/templates/ip.html
2024-08-06 19:17:37 +02:00

97 lines
3.7 KiB
HTML

{% extends "base.html" %}
{% import "helpers.html" as helper %}
{% import "links.html" as links %}
{% block title %}{{ data.result.address }}{% endblock %}
{% block og_title %}Lookup {{ data.result.address }}{% endblock %}
{% block h1 %}Lookup <code>{{ data.result.address }}</code>{% endblock %}
{% block og_path %}/ip/{{ data.result.address }}{% endblock %}
{% block content %}
{% set r = data.result %}
<section>
<h2>Network Information</h2>
<dl>
<dt>Type of Address</dt>
<dd>{{ helper::ip_info(ip_info=r.ip_info) }}</dd>
{% if r.hostname %}
<dt>Hostname</dt>
<dd>{{ helper::dig(extra=extra, name=r.hostname) }}</dd>
{% elif r.reverse_dns_disabled_for_privacy %}
<dt>Hostname</dt>
<dd>Lookup disabled by default: {{ helper::ip(ip=r.address, extra=extra, text="enable", with_self_lookup=true)}}</dd>
{% endif %}
{% if r.asn %}
<dt><abbr="Autonomous System Number">ASN</abbr></dt>
<dd>AS{{r.asn.asn}}</dd>
<dt>AS Name</dt>
<dd>{{ r.asn.name }}</dd>
{% endif %}
</dl>
{% block other_ip_button %}{% endblock %}
</section>
{% if r.location %}
<section>
<h2>Geolocation</h2>
{% if extra.geo_attribution_html %}
<dl>
{{ helper::place_dl(place=r.location.continent, label="Continent") }}
{{ helper::place_dl(place=r.location.country, label="Country") }}
{% if r.location.country.iso_code | default(value="") != r.location.registered_country.iso_code | default(value="") %}
{{ helper::place_dl(place=r.location.registered_country, label="Registered in") }}
{% endif %}
{% if r.location.country.iso_code | default(value="") != r.location.represented_country.iso_code | default(value="")%}
{{ helper::place_dl(place=r.location.represented_country, label="Represents") }}
{% endif %}
{% 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 %}
<dt>Postal Code</dt>
<dd>{{r.location.postal_code}}</dd>
{% endif %}
{% if r.location.time_zone %}
<dt>Timezone</dt>
<dd>{{r.location.time_zone}}</dd>
{% endif %}
{% if r.location.accuracy %}
<dt>Accuracy</dt>
<dd>~{{r.location.accuracy}}km</dd>
{% endif %}
{% if r.location.coordinates %}
<dt>Coordinates</dt>
<dd><a target="_blank" href="{{ links::map_link(lat=r.location.coordinates.lat, lon=r.location.coordinates.lon)}}">lat: {{r.location.coordinates.lat}}, lon: {{r.location.coordinates.lon}}</a></dd>
{% endif %}
</dl>
<p><small>{{extra.geo_attribution_html | safe}}</small></p>
{% else %}
<p><strong style="font-size: 2em">Please configure the <code>geo_attribution_html</code> key in the template extra configuration!</strong></p>
<p>The geolocation information will then become visible.</p>
{% endif %}
</section>
{% endif %}
{% block extra_content %}{% endblock %}
<section>
<h2>Other Services</h2>
{{ links::ip_address_links(address=r.address)}}
{% if r.asn %}
{{ links::asn_links(asn=r.asn.asn, org_name=r.asn.name) }}
{% endif %}
</section>
<section>
<h2>Programmatic Lookup</h2>
<p>If you want to look up this IP-Address Information in another program that is okay as long as you are civil about it … (ratelimit)</p>
<h3>How?</h3>
<p>You can choose between the <code>html</code>, <code>text</code> and <code>json</code> format.</p>
<p>An example of an URL could be: <code>{{ extra.base_url }}/ip/1.2.3.4?format=json</code></p>
<p>To look up your IP-Address as json: <code>{{ extra.base_url }}/?format=json</code></p>
</section>
{% endblock %}