Bugfixes and other small improvements

parent 56945b52
......@@ -279,13 +279,14 @@ function getCountryName(countryCode, returnSame?) {
*
* If "returnSame" is not "no" and country is not found, the query is returned
*/
twig.extendFunction("countryCode", (countryCode, returnSame?, addParenthesis?) => {
twig.extendFunction("countryCode", (countryCode: string, returnSame?: string, addParenthesis?: string) => {
returnSame = returnSame ? returnSame : "yes";
addParenthesis = addParenthesis ? addParenthesis : "no";
const result = getCountryName(countryCode, returnSame);
if(addParenthesis === "yes" && result != undefined) {
return `(${result})`;
} else if (result != undefined) {
return;
}
return result;
......
......@@ -40,17 +40,17 @@ router.get("/:zero/:one([0-9][0-9]?[0-9]?)", (req: Request, res: Response, next:
.then(x => {
const announcements = x[0];
let addresses = {};
let addresses: {} = {};
if(ipVersion === 4) {
addresses = cidr.toArray();
// addresses = cidr.toArray();
}
res.render("net/show.twig", {
cidrNotation,
ipVersion,
// addresses: addresses,
addresses,
announcements,
});
......
......@@ -20,7 +20,7 @@ router.get("/", (req: Request, res: Response, next: NextFunction) => {
if(query) {
if(isIp(query)) {
res.redirect(`/ip/${query}`);
} else if(isAsn(query)) {
} else if(isAsn(query.toUpperCase())) {
res.redirect(`/${query}`);
} else if(isCidr(query)) {
res.redirect(`/net/${query}`);
......
......@@ -20,10 +20,11 @@
<li><a href="https://api.telcodb.net/dl/tor-relay-list.json">JSON format</a></li>
</ul>
{# <p class="mb-2">The JSON version currently has the following extra features that are not available on the origin:
<p class="mb-2">The JSON version currently has the following extra features that are not available on the original/TXT version:
<ul>
<li><a href="https://en.wikipedia.org/wiki/Reverse_DNS_lookup">Reverse DNS</a> records</li>
</ul></p> #}
<li>Tor relay fingerprint</li>
{# <li><a href="https://en.wikipedia.org/wiki/Reverse_DNS_lookup">Reverse DNS</a> records</li> #}
</ul></p>
<p>The data is automatically updated to the forementioned endpoints,
see the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified"
......
......@@ -12,7 +12,7 @@
<a class="nav-link" data-toggle="tab" role="tab"
id="whois-tab" href="#whois" aria-controls="whois" aria-selected="false">Whois</a>
</li>
{% if addresses and ipVersion == 4 %}
{% if addresses|length > 0 and ipVersion == 4 %}
<li class="nav-item">
<a class="nav-link" data-toggle="tab" role="tab"
id="dns-tab" href="#dns" aria-controls="dns" aria-selected="false">DNS</a>
......@@ -52,7 +52,7 @@
<div class="tab-pane fade" id="whois" role="tabpanel" aria-labelledby="whois-tab">
<pre class="mt-2 mb-0"><code id="whoisInformation"></code></pre>
</div>
{% if addresses and ipVersion == 4 %}
{% if addresses|length > 0 and ipVersion == 4 %}
<div class="tab-pane fade" id="dns" role="tabpanel" aria-labelledby="dns-tab">
<table class="table w-auto">
<thead>
......
{% extends 'layouts/default.twig' %}
{# TODO: .container-fluid instead of .container due to large width #}
{% block body_wide %}
<h1>{{ title }}</h1>
......@@ -26,7 +25,11 @@
data-ip="{{ compressIp(relay.ip)|e }}">{{ compressIp(relay.ip)|e }}</a>
</td>
{# <td>{{ relay.reverse[0]|e }}</td> #}
<td>{{ relay.name|e }}</td>
<td>
<a href="/tor-relay/{{ relay.fingerprint|e }}">
{{ relay.name|e }}
</a>
</td>
<td>{{ relay.router_port|e }}</td>
<td>{{ relay.directory_port|e }}</td>
<td>{{ relay.flags|e }}</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment