Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a clickable "." when there is a blank domain in the top domain lists #1244

Merged
merged 3 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/pi-hole/js/db_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>>" +
Expand Down
8 changes: 5 additions & 3 deletions scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -686,7 +686,8 @@ function updateTopLists() {
}

domain = escapeHtml(domain);
url = '<a href="queries.php?domain=' + domain + '">' + domain + "</a>";
urlText = domain === "" ? "." : domain;
DL6ER marked this conversation as resolved.
Show resolved Hide resolved
url = '<a href="queries.php?domain=' + domain + '">' + urlText + "</a>";
percentage = (data.top_queries[domain] / data.dns_queries_today) * 100;
domaintable.append(
"<tr> <td>" +
Expand Down Expand Up @@ -720,7 +721,8 @@ function updateTopLists() {
}

domain = escapeHtml(domain);
url = '<a href="queries.php?domain=' + domain + '">' + domain + "</a>";
urlText = domain === "" ? "." : domain;
DL6ER marked this conversation as resolved.
Show resolved Hide resolved
url = '<a href="queries.php?domain=' + domain + '">' + urlText + "</a>";
percentage = (data.top_ads[domain] / data.ads_blocked_today) * 100;
adtable.append(
"<tr> <td>" +
Expand Down
11 changes: 9 additions & 2 deletions scripts/pi-hole/js/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down