Parse SPF in TXT records

parent 4e31ba29
......@@ -56,6 +56,9 @@ twig.extendFunction("portSizeProcessor", (rawSize: string) => {
}
});
import txtParser from "./view-functions/txtParser";
twig.extendFunction("txtParser", txtParser);
/**
* Is server in production mode?
*/
......
function txtParser(record: string): string {
if(record.includes("v=spf1")) {
record = record.replace(/(include|ip4|ip6|a)\:([^\s]+)/g, '$1:<a href="/search?q=$2">$2</a>');
record = record.replace(/(redirect)\=([^\s]+)/g, '$1=<a href="/search?q=$2">$2</a>');
return record;
}
// Default
return record;
}
export default txtParser;
\ No newline at end of file
......@@ -82,7 +82,7 @@
<p>IRR Tab</p>
</div> #}
{% if pdb.netixlan_set %}
<div class="tab-pane fade pt-3" id="ix" role="tabpanel" aria-labelledby="ix-tab">
<div class="tab-pane fade pt-3 pb-2" id="ix" role="tabpanel" aria-labelledby="ix-tab">
<table class="table" id="ixTable">
<thead>
<tr>
......
......@@ -69,7 +69,7 @@
<h2>TXT records</h2>
<ul class="pl-0 list-unstyled">
{% for record in data.txt %}
<li><code>{{ record }}</code></li>
<li><code>{{ txtParser(record) }}</code></li>
{% endfor %}
</ul>
{% endif %}
......
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