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

Pi-hole web v5.10 #2046

Merged
merged 32 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5eb2e23
Add link to Pi-hole docs when showing dnsmasq warnings
DL6ER Dec 23, 2021
2fb57d2
Merge pull request #2017 from pi-hole/tweak/dnsmasq_warn_docs
DL6ER Dec 23, 2021
685cfd1
implement fix by @rdwebdesign (#2018)
Iksas Dec 24, 2021
d060a3b
Update qrcode.php and use SVG to generate the code (#2022)
rdwebdesign Dec 24, 2021
6c0a62e
Adding recent changes to LCARS theme (#2019)
rdwebdesign Dec 24, 2021
605af66
Improve look of the main menu
DL6ER Dec 24, 2021
9393b2e
Merge pull request #2023 from pi-hole/fix/menu_icons
DL6ER Dec 24, 2021
12204ab
Fix errors introduced in #1990 and #2023
rdwebdesign Dec 24, 2021
cca2f78
add border to status indicators in the LCARS theme (#2024)
Iksas Dec 24, 2021
3e192ed
Merge pull request #2025 from rdwebdesign/lcars_top_navbar
DL6ER Dec 25, 2021
5a05f1b
Revert "Fix LCARS top navbar" (#2027)
rdwebdesign Dec 26, 2021
cd86957
Fix errors introduced in #1990, #2023 and #2025 (#2028)
rdwebdesign Dec 26, 2021
c0dcded
fix invisible buttons in password fields (#2020)
Iksas Dec 26, 2021
b7c0fcb
Ensure number formatting is taking place in browser-scope to use clie…
DL6ER Dec 26, 2021
96be130
Also use Intl.NumberFormat.format() for long-term pages
DL6ER Dec 26, 2021
88039ae
Merge pull request #2029 from pi-hole/tweak/localized_numbers
yubiuser Dec 26, 2021
4c8f869
Fixing PHP warnings in qrcode.php
rdwebdesign Dec 28, 2021
a6357a1
Merge pull request #2033 from rdwebdesign/fix_qrcode_warnings
yubiuser Dec 28, 2021
af4ec2b
remove text-transform property from update command
Iksas Dec 29, 2021
c4c6089
Merge pull request #2037 from Iksas/code-element-fix
rdwebdesign Dec 29, 2021
64a3675
Include FTL's DNS port in web status and give the temperature its own…
yubiuser Dec 29, 2021
1c23b78
rename IDs of query summary elements
Iksas Dec 29, 2021
b4539f1
Adjusting status panel
rdwebdesign Dec 31, 2021
8d7db95
Merge pull request #2040 from rdwebdesign/user_panel
DL6ER Dec 31, 2021
ce5d971
Merge branch 'devel' into tweak/DHCP-datatables
Moonlight63 Jan 1, 2022
9979b73
Update DataTables on DHCP page to be consistent with the rest of Pi-H…
Moonlight63 Jan 1, 2022
f850264
Fixed a typo and split DHCP page into different boxes.
Moonlight63 Jan 1, 2022
8f28794
Merge pull request #2039 from Iksas/query-log-rename
DL6ER Jan 2, 2022
f663938
Merge pull request #2045 from pi-hole/master
PromoFaux Jan 4, 2022
dbcafc3
Fix mislabeled privacy setting (#2044)
Cauchon Jan 4, 2022
4e8534a
Bump autoprefixer from 10.4.0 to 10.4.1 (#2043)
dependabot[bot] Jan 4, 2022
eadd6c5
Merge pull request #2042 from Moonlight63/tweak/DHCP-datatables
DL6ER Jan 5, 2022
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
21 changes: 2 additions & 19 deletions api_FTL.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,9 @@
$tmp = explode(" ",$line);

if(($tmp[0] === "domains_being_blocked" && !is_numeric($tmp[1])) || $tmp[0] === "status")
{
$stats[$tmp[0]] = $tmp[1];
continue;
}

if(isset($_GET['summary']))
{
if($tmp[0] !== "ads_percentage_today")
{
$stats[$tmp[0]] = number_format($tmp[1]);
}
else
{
$stats[$tmp[0]] = number_format($tmp[1], 1, '.', '');
}
}
$stats[$tmp[0]] = $tmp[1]; // Expect string response
else
{
$stats[$tmp[0]] = floatval($tmp[1]);
}
$stats[$tmp[0]] = floatval($tmp[1]); // Expect float response
}
$stats['gravity_last_updated'] = gravity_last_update(true);
$data = array_merge($data,$stats);
Expand Down
6 changes: 3 additions & 3 deletions db_queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<!-- small box -->
<div class="small-box bg-aqua no-user-select">
<div class="inner">
<h3 class="statistic" id="ads_blocked_exact">---</h3>
<h3 class="statistic" id="queries_blocked_exact">---</h3>
<p>Queries Blocked</p>
</div>
<div class="icon">
Expand All @@ -92,7 +92,7 @@
<!-- small box -->
<div class="small-box bg-aqua no-user-select">
<div class="inner">
<h3 class="statistic" id="ads_wildcard_blocked">---</h3>
<h3 class="statistic" id="queries_wildcard_blocked">---</h3>
<p>Queries Blocked (Wildcards)</p>
</div>
<div class="icon">
Expand All @@ -118,7 +118,7 @@
<!-- small box -->
<div class="small-box bg-yellow no-user-select">
<div class="inner">
<h3 class="statistic" id="ads_percentage_today">---</h3>
<h3 class="statistic" id="queries_percentage_today">---</h3>
<p>Queries Blocked</p>
</div>
<div class="icon">
Expand Down
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"testpr": "npm run prettier:fix && git diff --ws-error-highlight=all --color=always --exit-code && npm run xo"
},
"devDependencies": {
"autoprefixer": "^10.4.0",
"autoprefixer": "^10.4.1",
"eslint-plugin-compat": "^4.0.0",
"postcss": "^8.4.5",
"postcss-cli": "^9.1.0",
Expand Down
10 changes: 6 additions & 4 deletions scripts/pi-hole/js/db_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,18 @@ var reloadCallback = function () {
}
}

$("h3#dns_queries").text(statistics[0].toLocaleString());
$("h3#ads_blocked_exact").text(statistics[2].toLocaleString());
$("h3#ads_wildcard_blocked").text(statistics[3].toLocaleString());
var formatter = new Intl.NumberFormat();
$("h3#dns_queries").text(formatter.format(statistics[0]));
$("h3#queries_blocked_exact").text(formatter.format(statistics[2]));
$("h3#queries_wildcard_blocked").text(formatter.format(statistics[3]));

var percent = 0;
if (statistics[2] + statistics[3] > 0) {
percent = (100 * (statistics[2] + statistics[3])) / statistics[0];
}

$("h3#ads_percentage_today").text(parseFloat(percent).toFixed(1).toLocaleString() + " %");
var percentage = formatter.format(Math.round(percent * 10) / 10);
$("h3#queries_percentage_today").text(percentage + " %");
};

function refreshTableData() {
Expand Down
8 changes: 4 additions & 4 deletions scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,6 @@ function updateSummaryData(runOnce) {
data.ads_blocked_today = "connection";
data.ads_percentage_today = "to";
data.domains_being_blocked = "API";
// Adjust text
$("#temperature").html('<i class="fa fa-circle text-red"></i> FTL offline');
// Show spinner
$("#queries-over-time .overlay").show();
$("#forward-destinations-pie .overlay").show();
Expand All @@ -745,12 +743,12 @@ function updateSummaryData(runOnce) {
} else if (FTLoffline) {
// FTL was previously offline
FTLoffline = false;
$("#temperature").text(" ");
updateQueriesOverTime();
updateTopClientsChart();
updateTopLists();
}

var formatter = new Intl.NumberFormat();
//Element name might have a different name to the property of the API so we split it at |
[
"ads_blocked_today|queries_blocked_today",
Expand All @@ -763,7 +761,9 @@ function updateSummaryData(runOnce) {
var apiName = apiElName[0];
var elName = apiElName[1];
var $todayElement = elName ? $("span#" + elName) : $("span#" + apiName);
var textData = idx === 2 && data[apiName] !== "to" ? data[apiName] + "%" : data[apiName];
// Round to one decimal place and format locale-aware
var text = formatter.format(Math.round(data[apiName] * 10) / 10);
var textData = idx === 2 && data[apiName] !== "to" ? text + "%" : text;
if ($todayElement.text() !== textData && $todayElement.text() !== textData + "%") {
$todayElement.addClass("glow");
$todayElement.text(textData);
Expand Down
6 changes: 5 additions & 1 deletion scripts/pi-hole/js/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ function renderMessage(data, type, row) {
);

case "DNSMASQ_WARN":
return "Warning in <code>dnsmasq</code> core:<pre>" + row.message + "</pre>";
return (
"Warning in <code>dnsmasq</code> core:<pre>" +
row.message +
'</pre> Check out <a href="https://docs.pi-hole.net/ftldns/dnsmasq_warn/" target="_blank">our documentation</a> for further information.'
);

case "LOAD":
return (
Expand Down
28 changes: 18 additions & 10 deletions scripts/pi-hole/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,22 @@ var leasetable, staticleasetable;
$(function () {
if (document.getElementById("DHCPLeasesTable")) {
leasetable = $("#DHCPLeasesTable").DataTable({
dom: "<'row'<'col-sm-12'tr>><'row'<'col-sm-6'i><'col-sm-6'f>>",
dom:
"<'row'<'col-sm-4'l><'col-sm-8'f>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
[5, 10, 25, 50, 100, -1],
[5, 10, 25, 50, 100, "All"],
],
columnDefs: [
{ bSortable: false, orderable: false, targets: -1 },
{
targets: [0, 1, 2],
render: $.fn.dataTable.render.text(),
},
],
paging: false,
scrollCollapse: true,
scrollY: "200px",
scrollX: true,
paging: true,
order: [[2, "asc"]],
stateSave: true,
stateDuration: 0,
Expand All @@ -253,18 +257,22 @@ $(function () {

if (document.getElementById("DHCPStaticLeasesTable")) {
staticleasetable = $("#DHCPStaticLeasesTable").DataTable({
dom: "<'row'<'col-sm-12'tr>><'row'<'col-sm-12'i>>",
dom:
"<'row'<'col-sm-4'l><'col-sm-8'f>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
[5, 10, 25, 50, 100, -1],
[5, 10, 25, 50, 100, "All"],
],
columnDefs: [
{ bSortable: false, orderable: false, targets: -1 },
{
targets: [0, 1, 2],
render: $.fn.dataTable.render.text(),
},
],
paging: false,
scrollCollapse: true,
scrollY: "200px",
scrollX: true,
paging: true,
order: [[2, "asc"]],
stateSave: true,
stateSaveCallback: function (settings, data) {
Expand Down
51 changes: 36 additions & 15 deletions scripts/pi-hole/php/api_token.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
<html><body>
<html>
<head>
<style>
body {
background: #fff;
margin: 10px 0;
}

.qrcode {
text-align: center;
margin: 0 0 1em;
}

.qrcode svg {
max-width: 100%;
height: auto;
}

.token {
font-size: 14px;
word-break: break-word;
}
</style>
</head>
<body>
<?php
require "auth.php";
require "password.php";
check_cors();

if($auth)
{
if(strlen($pwhash) > 0)
{
if($auth) {
if(strlen($pwhash) > 0) {
echo '<div class="qrcode">';
require_once("../../vendor/qrcode.php");
$qr = QRCode::getMinimumQRCode($pwhash, QR_ERROR_CORRECT_LEVEL_Q);
$qr->printHTML("10px");
echo "<br>Raw API Token: <code>" . $pwhash . "</code>";
// The size of each block (in pixels) should be an integer
$qr->printSVG(10);
echo "</div>";
echo 'Raw API Token: <code class="token">' . $pwhash . "</code></div>";
} else {
echo "<p>No password set</p>";
}
else
{
?><p>No password set<?php
}
}
else
{
?><p>Not authorized!</p><?php
} else {
echo "<p>Not authorized!</p>";
}
?>
</body>
Expand Down
Loading