Merge pull request #305 from pi-hole/fix/clienthostnames

Reverse DNS lookup improvement for Top Clients Table
This commit is contained in:
DL6ER
2016-12-28 01:39:57 +01:00
committed by GitHub
2 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -132,7 +132,7 @@
if($hostname)
{
// Generate HOST entry
$hostarray[$hostname] = $value;
$hostarray["$hostname|$key"] = $value;
}
else
{
+14 -2
View File
@@ -132,14 +132,22 @@ function escapeHtml(text) {
function updateTopClientsChart() {
$.getJSON("api.php?summaryRaw&getQuerySources", function(data) {
var clienttable = $("#client-frequency").find("tbody:last");
var domain, percentage;
var domain, percentage, domainname;
for (domain in data.top_sources) {
if ({}.hasOwnProperty.call(data.top_sources, domain)){
// Sanitize domain
domain = escapeHtml(domain);
if(domain.indexOf("|") > -1)
{
domainname = domain.substr(0, domain.indexOf("|"));
}
else
{
domainname = domain;
}
var url = "<a href=\"queries.php?client="+domain+"\">"+domain+"</a>";
var url = "<a href=\"queries.php?client="+domain+"\">"+domainname+"</a>";
percentage = data.top_sources[domain] / data.dns_queries_today * 100;
clienttable.append("<tr> <td>" + url +
"</td> <td>" + data.top_sources[domain] + "</td> <td> <div class=\"progress progress-sm\" title=\""+percentage.toFixed(1)+"%\"> <div class=\"progress-bar progress-bar-blue\" style=\"width: " +
@@ -162,6 +170,10 @@ function updateForwardDestinations() {
$.each(data, function(key , value) {
v.push(value);
c.push(colors.shift());
if(key.indexOf("|") > -1)
{
key = key.substr(0, key.indexOf("|"));
}
forwardDestinationChart.data.labels.push(key);
});
// Build a single dataset with the data to be pushed