diff --git a/scripts/pi-hole/js/db_queries.js b/scripts/pi-hole/js/db_queries.js index f8c22119..0952674a 100644 --- a/scripts/pi-hole/js/db_queries.js +++ b/scripts/pi-hole/js/db_queries.js @@ -346,6 +346,14 @@ $(document).ready(function() { $(row).css("color", color); $("td:eq(4)", row).html(fieldtext); $("td:eq(5)", row).html(buttontext); + + // Substitute domain by "." if empty + var domain = data[2]; + if (domain.length === 0) { + domain = "."; + } + + $("td:eq(2)", row).text(domain); }, dom: "<'row'<'col-sm-12'f>>" + diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 5fffa248..bb24db6f 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -676,7 +676,7 @@ function updateTopLists() { .remove(); var domaintable = $("#domain-frequency").find("tbody:last"); var adtable = $("#ad-frequency").find("tbody:last"); - var url, domain, percentage; + var url, domain, percentage, urlText; for (domain in data.top_queries) { if (Object.prototype.hasOwnProperty.call(data.top_queries, domain)) { // Sanitize domain @@ -686,7 +686,8 @@ function updateTopLists() { } domain = escapeHtml(domain); - url = '' + domain + ""; + urlText = domain === "" ? "." : domain; + url = '' + urlText + ""; percentage = (data.top_queries[domain] / data.dns_queries_today) * 100; domaintable.append( " " + @@ -720,7 +721,8 @@ function updateTopLists() { } domain = escapeHtml(domain); - url = '' + domain + ""; + urlText = domain === "" ? "." : domain; + url = '' + urlText + ""; percentage = (data.top_ads[domain] / data.ads_blocked_today) * 100; adtable.append( " " + diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 7ea1a6d7..dffcd85e 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -293,11 +293,18 @@ $(document).ready(function() { $("td:eq(4)", row).addClass("pointer"); } - // Add domain in CNAME chain causing the query to have been blocked + // Substitute domain by "." if empty var domain = data[2]; - var CNAME_domain = data[8]; + if (domain.length === 0) { + domain = "."; + } + if (isCNAME) { + var CNAME_domain = data[8]; + // Add domain in CNAME chain causing the query to have been blocked $("td:eq(2)", row).text(domain + "\n(blocked " + CNAME_domain + ")"); + } else { + $("td:eq(2)", row).text(domain); } // Check for existence of sixth column and display only if not Pi-holed