Added a templating helper

This commit is contained in:
Slatian
2023-02-12 17:35:32 +01:00
parent b21aa5192f
commit febcb8b02e
4 changed files with 237 additions and 128 deletions

View File

@ -1,39 +1,39 @@
<!DOCTYPE html>
{% set r = data.result %}
{% set q = data.query %}
<html>
<head>
<title>Dig: {{ dig_query }}</title>
<title>Dig: {{ q.name }}</title>
</head>
<body>
<h1>Lookup for: {{ dig_query }}</h1>
{% if dig_result.a %}
<h1>Lookup for: {{ q.name }}</h1>
{% if r.a %}
<p>A (IPv4) records:</p>
<ul>
{% for address in dig_result.a%}
{% for address in r.a%}
<li><code>{{address}}</code></li>
{% endfor %}
</ul>
{% endif %}
{% if dig_result.aaaa %}
{% if r.aaaa %}
<p>AAAA (IPv6) records:</p>
<ul>
{% for address in dig_result.aaaa%}
{% for address in r.aaaa%}
<li><code>{{address}}</code></li>
{% endfor %}
</ul>
{% endif %}
{% if dig_result.mx %}
{% if r.mx %}
<p>MX (Mail Exchange) records:</p>
<ul>
{% for mx in dig_result.mx%}
{% for mx in r.mx%}
<li>{{mx.preference}} <code><a href="/dig?name={{mx.exchange}}">{{mx.exchange}}</a></code></li>
{% endfor %}
</ul>
{% endif %}
</body>
</html>

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Your IP: {{ ip }}</title>
<title>Your IP: {{ data.query.ip }}</title>
</head>
<body>
<h1>Your IP-Address is: {{ ip }}</h1>
<h1>Your IP-Address is: {{ data.query.ip }}</h1>
<p>Your requested format was: <b>{{format}}</b></p>
{% if hostname %}
<p>Hostname: <b>{{hostname}}</b></p>
<p>Hostname: <b>{{data.result.hostname}}</b></p>
{% endif %}
</body>
</html>