From 99c718296a0a3891f93558a88686d81c2550096e Mon Sep 17 00:00:00 2001 From: Chris Miceli Date: Fri, 24 Dec 2021 22:32:01 -0600 Subject: [PATCH 01/45] 1119 Privacy - Query Page and Dom.storage handle localStorage being null Signed-off-by: Chris Miceli --- scripts/pi-hole/js/db_queries.js | 2 +- scripts/pi-hole/js/footer.js | 13 +++++++++---- scripts/pi-hole/js/queries.js | 2 +- scripts/pi-hole/js/settings.js | 12 ++++++++---- scripts/pi-hole/js/utils.js | 4 ++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/scripts/pi-hole/js/db_queries.js b/scripts/pi-hole/js/db_queries.js index 306b43a0..3763791e 100644 --- a/scripts/pi-hole/js/db_queries.js +++ b/scripts/pi-hole/js/db_queries.js @@ -294,7 +294,7 @@ $(function () { } $(row).addClass(blocked === true ? "blocked-row" : "allowed-row"); - if (localStorage.getItem("colorfulQueryLog_chkbox") === "true") { + if (localStorage && localStorage.getItem("colorfulQueryLog_chkbox") === "true") { $(row).addClass(blocked === true ? "text-red" : "text-green"); } diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index 763e8ae9..5e386622 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -58,7 +58,9 @@ function countDown() { } else { ena.text("Enable"); piholeChanged("enabled"); - localStorage.removeItem("countDownTarget"); + if (localStorage) { + localStorage.removeItem("countDownTarget"); + } } } @@ -148,7 +150,7 @@ function initCheckboxRadioStyle() { } // Read from local storage, initialize if needed - var chkboxStyle = localStorage.getItem("theme_icheck"); + var chkboxStyle = localStorage ? localStorage.getItem("theme_icheck") : null; if (chkboxStyle === null) { chkboxStyle = "primary"; } @@ -172,7 +174,10 @@ function initCheckboxRadioStyle() { function initCPUtemp() { function setCPUtemp(unit) { - localStorage.setItem("tempunit", tempunit); + if (localStorage) { + localStorage.setItem("tempunit", tempunit); + } + var temperature = parseFloat($("#rawtemp").text()); var displaytemp = $("#tempdisplay"); if (!isNaN(temperature)) { @@ -195,7 +200,7 @@ function initCPUtemp() { } // Read from local storage, initialize if needed - var tempunit = localStorage.getItem("tempunit"); + var tempunit = localStorage ? localStorage.getItem("tempunit") : null; if (tempunit === null) { tempunit = "C"; } diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 7507e46d..091a6f98 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -231,7 +231,7 @@ $(function () { fieldtext += ''; $(row).addClass(blocked === true ? "blocked-row" : "allowed-row"); - if (localStorage.getItem("colorfulQueryLog_chkbox") === "true") { + if (localStorage && localStorage.getItem("colorfulQueryLog_chkbox") === "true") { $(row).addClass(blocked === true ? "text-red" : "text-green"); } diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 964898c3..5f5c6430 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -334,7 +334,7 @@ $(".nav-tabs a").on("shown.bs.tab", function (e) { // Bar/Smooth chart toggle $(function () { var bargraphs = $("#bargraphs"); - var chkboxData = localStorage.getItem("barchart_chkbox"); + var chkboxData = localStorage ? localStorage.getItem("barchart_chkbox") : null; if (chkboxData !== null) { // Restore checkbox state @@ -342,7 +342,9 @@ $(function () { } else { // Initialize checkbox bargraphs.prop("checked", true); - localStorage.setItem("barchart_chkbox", true); + if (localStorage) { + localStorage.setItem("barchart_chkbox", true); + } } bargraphs.click(function () { @@ -352,7 +354,7 @@ $(function () { $(function () { var colorfulQueryLog = $("#colorfulQueryLog"); - var chkboxData = localStorage.getItem("colorfulQueryLog_chkbox"); + var chkboxData = localStorage ? localStorage.getItem("colorfulQueryLog_chkbox") : null; if (chkboxData !== null) { // Restore checkbox state @@ -360,7 +362,9 @@ $(function () { } else { // Initialize checkbox colorfulQueryLog.prop("checked", false); - localStorage.setItem("colorfulQueryLog_chkbox", false); + if (localStorage) { + localStorage.setItem("colorfulQueryLog_chkbox", false); + } } colorfulQueryLog.click(function () { diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index 7229231f..22ac3887 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -235,7 +235,7 @@ function stateSaveCallback(itemName, data) { function stateLoadCallback(itemName) { // Receive previous state from client's local storage area - var data = localStorage.getItem(itemName); + var data = localStorage ? localStorage.getItem(itemName) : null; // Return if not available if (data === null) { return null; @@ -259,7 +259,7 @@ function stateLoadCallback(itemName) { function getGraphType() { // Only return line if `barchart_chkbox` is explicitly set to false. Else return bar - return localStorage.getItem("barchart_chkbox") === "false" ? "line" : "bar"; + return localStorage && localStorage.getItem("barchart_chkbox") === "false" ? "line" : "bar"; } function addFromQueryLog(domain, list) { From 7bb82d0cff6744b029f5d81f2c4cb3bdfe18eaad Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Thu, 6 Jan 2022 19:12:26 -0300 Subject: [PATCH 02/45] Fix api.php?status ( replicate #2031 and pi-hole/pi-hole#4485) (#2052) * Replicating changes made by other PRs (#2031 and pi-hole/pi-hole#4485) Signed-off-by: rdwebdesign * Use the same messages used in #2031 Signed-off-by: rdwebdesign * Keep the old responses to avoid break things Signed-off-by: rdwebdesign * More comments less variables Signed-off-by: rdwebdesign --- api.php | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/api.php b/api.php index 34ffe655..0357ca70 100644 --- a/api.php +++ b/api.php @@ -18,28 +18,30 @@ $FTL_IP = "127.0.0.1"; $data = array(); // Common API functions -if (isset($_GET['status'])) -{ - $pistatus = pihole_execute('status web'); - if(isset($pistatus[0])) - { - $pistatus = $pistatus[0]; +if (isset($_GET['status'])) { + // Receive the return of "pihole status web" + $pistatus = pihole_execute('status web'); + + if (isset($pistatus[0])) { + $pistatus = intval($pistatus[0]); + } else { + // If no response, status="Unknown" (-2) + $pistatus = -2; } - else - { - $pistatus = null; + + switch ($pistatus) { + case -2: // Unkown + case -1: // DNS service not running" + case 0: // Offline + $data = array_merge($data, array("status" => "disabled")); + break; + + default: + // DNS service on port $returncode + $data = array_merge($data, array("status" => "enabled")); } - if ($pistatus === "1") - { - $data = array_merge($data, array("status" => "enabled")); - } - else - { - $data = array_merge($data, array("status" => "disabled")); - } -} -elseif (isset($_GET['enable']) && $auth) -{ + +} elseif (isset($_GET['enable']) && $auth) { if(isset($_GET["auth"])) { if($_GET["auth"] !== $pwhash) @@ -165,12 +167,9 @@ elseif (isset($_GET['list'])) require("api_FTL.php"); header('Content-type: application/json'); -if(isset($_GET["jsonForceObject"])) -{ - echo json_encode($data, JSON_FORCE_OBJECT); -} -else -{ - echo json_encode($data); +if(isset($_GET["jsonForceObject"])) { + echo json_encode($data, JSON_FORCE_OBJECT); +} else { + echo json_encode($data); } ?> From 33755f1775db31bc5cd5de0f8d82fa10a000bd42 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Sat, 8 Jan 2022 06:39:52 +0100 Subject: [PATCH 03/45] Rework the temp info in the status panel (#2054) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Explicit set templimit if no tempsensor output was found Signed-off-by: Christian König * Only show Temp info if tempsensor data is available Signed-off-by: Christian König * Move block to the right place Signed-off-by: Christian König --- scripts/pi-hole/php/header.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/pi-hole/php/header.php b/scripts/pi-hole/php/header.php index 175fd41f..b3d783c9 100644 --- a/scripts/pi-hole/php/header.php +++ b/scripts/pi-hole/php/header.php @@ -66,6 +66,8 @@ // Nothing can be colder than -273.15 degree Celsius (= 0 Kelvin) // This is the minimum temperature possible (AKA absolute zero) $celsius = -273.16; + // Set templimit to null if no tempsensor was found + $temperaturelimit = null; } // Get load @@ -375,18 +377,16 @@ if($auth) { ?>
$temperaturelimit) { - $tempcolor = "text-red"; - } - echo ' '; - - if ($celsius >= -273.15) { + if ($celsius >= -273.15) { + // Only show temp info if any data is available --> + $tempcolor = "text-vivid-blue"; + if (isset($temperaturelimit) && $celsius > $temperaturelimit) { + $tempcolor = "text-red"; + } + echo ' '; echo 'Temp: '; - } else { - echo "No temp sensor found"; - } - echo ''; + echo ''; + } ?> From b496dd599db791a1f00ab5284d249f86030cf21b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 8 Jan 2022 10:04:23 +0000 Subject: [PATCH 04/45] Bump autoprefixer from 10.4.1 to 10.4.2 Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.4.1 to 10.4.2. - [Release notes](https://github.com/postcss/autoprefixer/releases) - [Changelog](https://github.com/postcss/autoprefixer/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/autoprefixer/compare/10.4.1...10.4.2) --- updated-dependencies: - dependency-name: autoprefixer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 20 ++++++++++---------- package.json | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 82272b93..39166a51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -571,13 +571,13 @@ } }, "autoprefixer": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.1.tgz", - "integrity": "sha512-B3ZEG7wtzXDRCEFsan7HmR2AeNsxdJB0+sEC0Hc5/c2NbhJqPwuZm+tn233GBVw82L+6CtD6IPSfVruwKjfV3A==", + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.2.tgz", + "integrity": "sha512-9fOPpHKuDW1w/0EKfRmVnxTDt8166MAnLI3mgZ1JCnhNtYWxcJ6Ud5CO/AVOZi/AvFa8DY9RTy3h3+tFBlrrdQ==", "dev": true, "requires": { "browserslist": "^4.19.1", - "caniuse-lite": "^1.0.30001294", + "caniuse-lite": "^1.0.30001297", "fraction.js": "^4.1.2", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", @@ -598,15 +598,15 @@ } }, "caniuse-lite": { - "version": "1.0.30001294", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001294.tgz", - "integrity": "sha512-LiMlrs1nSKZ8qkNhpUf5KD0Al1KCBE3zaT7OLOwEkagXMEDij98SiOovn9wxVGQpklk9vVC/pUSqgYmkmKOS8g==", + "version": "1.0.30001298", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001298.tgz", + "integrity": "sha512-AcKqikjMLlvghZL/vfTHorlQsLDhGRalYf1+GmWCf5SCMziSGjRYQW/JEksj14NaYHIR6KIhrFAy0HV5C25UzQ==", "dev": true }, "electron-to-chromium": { - "version": "1.4.31", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.31.tgz", - "integrity": "sha512-t3XVQtk+Frkv6aTD4RRk0OqosU+VLe1dQFW83MDer78ZD6a52frgXuYOIsLYTQiH2Lm+JB2OKYcn7zrX+YGAiQ==", + "version": "1.4.38", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.38.tgz", + "integrity": "sha512-WhHt3sZazKj0KK/UpgsbGQnUUoFeAHVishzHFExMxagpZgjiGYSC9S0ZlbhCfSH2L2i+2A1yyqOIliTctMx7KQ==", "dev": true }, "node-releases": { diff --git a/package.json b/package.json index abf8effd..ac6c3477 100644 --- a/package.json +++ b/package.json @@ -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.1", + "autoprefixer": "^10.4.2", "eslint-plugin-compat": "^4.0.0", "postcss": "^8.4.5", "postcss-cli": "^9.1.0", From ab6b7ae326ac4f8ee0e3b31a3dcbf61305515224 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Sat, 8 Jan 2022 16:21:43 -0300 Subject: [PATCH 05/45] Change pihole status in api_FTL.php (#2059) Using "pihole status web" info Signed-off-by: rdwebdesign --- api.php | 23 +---------------------- api_FTL.php | 13 +++++++------ scripts/pi-hole/php/func.php | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/api.php b/api.php index 0357ca70..e7ddb692 100644 --- a/api.php +++ b/api.php @@ -19,28 +19,7 @@ $data = array(); // Common API functions if (isset($_GET['status'])) { - // Receive the return of "pihole status web" - $pistatus = pihole_execute('status web'); - - if (isset($pistatus[0])) { - $pistatus = intval($pistatus[0]); - } else { - // If no response, status="Unknown" (-2) - $pistatus = -2; - } - - switch ($pistatus) { - case -2: // Unkown - case -1: // DNS service not running" - case 0: // Offline - $data = array_merge($data, array("status" => "disabled")); - break; - - default: - // DNS service on port $returncode - $data = array_merge($data, array("status" => "enabled")); - } - + $data = array_merge($data, array("status" => piholeStatusAPI())); } elseif (isset($_GET['enable']) && $auth) { if(isset($_GET["auth"])) { diff --git a/api_FTL.php b/api_FTL.php index 13177a7e..b61bb363 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -29,21 +29,22 @@ else $data["version"] = 3; } - if (isset($_GET['summary']) || isset($_GET['summaryRaw']) || !count($_GET)) - { + if (isset($_GET['summary']) || isset($_GET['summaryRaw']) || !count($_GET)) { require_once("scripts/pi-hole/php/gravity.php"); sendRequestFTL("stats"); $return = getResponseFTL(); $stats = []; - foreach($return as $line) - { + foreach($return as $line) { $tmp = explode(" ",$line); - if(($tmp[0] === "domains_being_blocked" && !is_numeric($tmp[1])) || $tmp[0] === "status") + if($tmp[0] === "domains_being_blocked" && !is_numeric($tmp[1])) { $stats[$tmp[0]] = $tmp[1]; // Expect string response - else + } elseif ($tmp[0] === "status") { + $stats[$tmp[0]] = piholeStatusAPI(); + } else { $stats[$tmp[0]] = floatval($tmp[1]); // Expect float response + } } $stats['gravity_last_updated'] = gravity_last_update(true); $data = array_merge($data,$stats); diff --git a/scripts/pi-hole/php/func.php b/scripts/pi-hole/php/func.php index 754277b5..10ad633b 100644 --- a/scripts/pi-hole/php/func.php +++ b/scripts/pi-hole/php/func.php @@ -483,4 +483,31 @@ function getQueryTypeStr($querytype) return "TYPE".($qtype - 100); } +// Returns an integer representing pihole blocking status +function piholeStatus() +{ + // Receive the return of "pihole status web" + $pistatus = pihole_execute('status web'); + return isset($pistatus[0]) ? intval($pistatus[0]) : -2; +} + +// Returns pihole status, using only valid API responses (enabled/disabled) +function piholeStatusAPI() +{ + // Receive the return of "pihole status web" + $pistatus = piholeStatus(); + + switch ($pistatus) { + case -2: // Unkown + case -1: // DNS service not running" + case 0: // Offline + $response = "disabled"; + break; + + default: + // DNS service running on port $returncode + $response = "enabled"; + } + return $response; +} ?> From 9a5f62aba7a148cd3edaa511ec35679491acc6d0 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Sat, 8 Jan 2022 21:01:57 +0100 Subject: [PATCH 06/45] Use piholeStatus() in header.php (#2062) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use piholeStatus() in header.php Signed-off-by: Christian König * Remove check for null Signed-off-by: Christian König --- scripts/pi-hole/php/header.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/php/header.php b/scripts/pi-hole/php/header.php index b3d783c9..d8ad253b 100644 --- a/scripts/pi-hole/php/header.php +++ b/scripts/pi-hole/php/header.php @@ -9,6 +9,7 @@ require "scripts/pi-hole/php/auth.php"; require "scripts/pi-hole/php/password.php"; require_once "scripts/pi-hole/php/FTL.php"; + require_once "scripts/pi-hole/php/func.php"; require "scripts/pi-hole/php/theme.php"; $scriptname = basename($_SERVER['SCRIPT_FILENAME']); $hostname = gethostname() ? gethostname() : ""; @@ -333,19 +334,14 @@ if($auth) {

Status

Active'; } elseif ($pistatus == 0) { echo ' Offline'; } elseif ($pistatus == -1) { echo ' DNS service not running'; - } elseif ($pistatus == -2 || is_null($pistatus)) { + } elseif ($pistatus == -2) { echo ' Unknown'; } else { echo ' DNS service on port '.$pistatus.''; From f3bbcb3be7ffc757d951effa786b0025d558f18e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 9 Jan 2022 19:13:45 +0100 Subject: [PATCH 07/45] Have the triangle bounce two times instead of forever when there are warnings. Signed-off-by: DL6ER --- style/pi-hole.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/style/pi-hole.css b/style/pi-hole.css index f97a7b23..01c5757a 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -445,7 +445,7 @@ td.details-control { .icon-bounce { display: inline-block; position: relative; - animation: icon-bounce 1.5s infinite linear; + animation: icon-bounce 1.5s 2 linear; } @keyframes icon-bounce { From f0c3ecded3af4c3e7344e08fe790fb55496985b0 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Mon, 10 Jan 2022 15:23:37 -0300 Subject: [PATCH 08/45] Use formmated string for "api.php?summary" (#2067) restoring the old behavior Signed-off-by: rdwebdesign --- api_FTL.php | 15 +++++++++++++-- scripts/pi-hole/js/index.js | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api_FTL.php b/api_FTL.php index b61bb363..b58a3eda 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -39,12 +39,23 @@ else $tmp = explode(" ",$line); if($tmp[0] === "domains_being_blocked" && !is_numeric($tmp[1])) { - $stats[$tmp[0]] = $tmp[1]; // Expect string response + // Expect string response + $stats[$tmp[0]] = $tmp[1]; } elseif ($tmp[0] === "status") { + // Expect string response $stats[$tmp[0]] = piholeStatusAPI(); + } elseif (isset($_GET['summary'])) { + // "summary" expects a formmated string response + if($tmp[0] !== "ads_percentage_today") { + $stats[$tmp[0]] = number_format($tmp[1]); + } else { + $stats[$tmp[0]] = number_format($tmp[1], 1, '.', ''); + } } else { - $stats[$tmp[0]] = floatval($tmp[1]); // Expect float response + // Expect float response + $stats[$tmp[0]] = floatval($tmp[1]); } + } $stats['gravity_last_updated'] = gravity_last_update(true); $data = array_merge($data,$stats); diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index d0f5d968..fde72372 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -723,7 +723,7 @@ function updateSummaryData(runOnce) { } }; - $.getJSON("api.php?summary", function (data) { + $.getJSON("api.php?summaryRaw", function (data) { updateSessionTimer(); if ("FTLnotrunning" in data) { From de836ecc772263876b86cd1369e78e640f822d0e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 20:04:04 +0100 Subject: [PATCH 09/45] sync: master to devel (#2074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add stale workflow Signed-off-by: Christian König * Operations per run 300 Signed-off-by: Christian König Co-authored-by: Christian König Co-authored-by: Adam Warner --- .github/workflows/stale.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..86517934 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,25 @@ +name: Mark stale issues + +on: + schedule: + - cron: '0 * * * *' + workflow_dispatch: + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 30 + days-before-close: 5 + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.' + stale-issue-label: 'Submitter Attention Required' + exempt-issue-labels: 'pinned, Fixed In Next Release, Bug' + exempt-all-issue-assignees: true + operations-per-run: 300 From 1f0ed95564a7978396587245ca6c888d421dc397 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Fri, 14 Jan 2022 12:55:33 -0300 Subject: [PATCH 10/45] Remove extra space from the beginning of each line (#2079) Signed-off-by: rdwebdesign --- scripts/pi-hole/php/queryads.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/queryads.php b/scripts/pi-hole/php/queryads.php index 38d4e8d2..535dc146 100644 --- a/scripts/pi-hole/php/queryads.php +++ b/scripts/pi-hole/php/queryads.php @@ -17,7 +17,7 @@ header('Cache-Control: no-cache'); function echoEvent($datatext) { if(!isset($_GET["IE"])) - echo "data: ".implode("\ndata: ", explode("\n", $datatext))."\n\n"; + echo "data:".implode("\ndata:", explode("\n", $datatext))."\n\n"; else echo $datatext; } From 035d8f981d038525abfffd347a6c1f460888f23e Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Fri, 14 Jan 2022 18:41:41 -0300 Subject: [PATCH 11/45] Fix layout on small screens (Group Mgmt tables) (#2078) Signed-off-by: rdwebdesign --- groups-adlists.php | 2 +- groups-clients.php | 2 +- groups-domains.php | 2 +- groups.php | 2 +- scripts/pi-hole/js/groups-adlists.js | 2 +- scripts/pi-hole/js/groups-clients.js | 2 +- scripts/pi-hole/js/groups-domains.js | 2 +- scripts/pi-hole/js/groups.js | 2 +- style/pi-hole.css | 79 ++++++++++++++++++++++++++++ style/themes/lcars.css | 10 ++++ 10 files changed, 97 insertions(+), 8 deletions(-) diff --git a/groups-adlists.php b/groups-adlists.php index 1fb04179..04ec7294 100644 --- a/groups-adlists.php +++ b/groups-adlists.php @@ -67,7 +67,7 @@ Status Comment Group assignment - Action +   diff --git a/groups-clients.php b/groups-clients.php index e5620138..420ce5c8 100644 --- a/groups-clients.php +++ b/groups-clients.php @@ -73,7 +73,7 @@ Client Comment Group assignment - Action +   diff --git a/groups-domains.php b/groups-domains.php index b1aca183..25f86eee 100644 --- a/groups-domains.php +++ b/groups-domains.php @@ -126,7 +126,7 @@ Status Comment Group assignment - Action +   diff --git a/groups.php b/groups.php index 64b957a0..0cf970f7 100644 --- a/groups.php +++ b/groups.php @@ -64,7 +64,7 @@ Name Status Description - Action +   diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js index 501ec2f2..24fd2e4e 100644 --- a/scripts/pi-hole/js/groups-adlists.js +++ b/scripts/pi-hole/js/groups-adlists.js @@ -122,7 +122,7 @@ function initTable() { { data: "enabled", searchable: false }, { data: "comment" }, { data: "groups", searchable: false }, - { data: null, width: "80px", orderable: false }, + { data: null, width: "22px", orderable: false }, ], columnDefs: [ { diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js index 171a939c..016d3426 100644 --- a/scripts/pi-hole/js/groups-clients.js +++ b/scripts/pi-hole/js/groups-clients.js @@ -95,7 +95,7 @@ function initTable() { { data: "ip", type: "ip-address" }, { data: "comment" }, { data: "groups", searchable: false }, - { data: "name", width: "80px", orderable: false }, + { data: "name", width: "22px", orderable: false }, ], columnDefs: [ { diff --git a/scripts/pi-hole/js/groups-domains.js b/scripts/pi-hole/js/groups-domains.js index e70286d5..84824587 100644 --- a/scripts/pi-hole/js/groups-domains.js +++ b/scripts/pi-hole/js/groups-domains.js @@ -74,7 +74,7 @@ function initTable() { { data: "enabled", searchable: false }, { data: "comment" }, { data: "groups", searchable: false, visible: showtype === "all" }, - { data: null, width: "80px", orderable: false }, + { data: null, width: "22px", orderable: false }, ], columnDefs: [ { diff --git a/scripts/pi-hole/js/groups.js b/scripts/pi-hole/js/groups.js index 417dd9ff..25107d13 100644 --- a/scripts/pi-hole/js/groups.js +++ b/scripts/pi-hole/js/groups.js @@ -25,7 +25,7 @@ $(function () { { data: "name" }, { data: "enabled", searchable: false }, { data: "description" }, - { data: null, width: "60px", orderable: false }, + { data: null, width: "22px", orderable: false }, ], columnDefs: [ { diff --git a/style/pi-hole.css b/style/pi-hole.css index 01c5757a..f17b5d73 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -448,6 +448,85 @@ td.details-control { animation: icon-bounce 1.5s 2 linear; } +/* Fix some datatables layout on small screens */ +@media screen and (max-width: 660px), screen and (min-width: 767px) and (max-width: 960px) { + #domainsTable_wrapper .table-responsive { + border: none; + overflow: unset; + } + #domainsTable { + border: 0; + box-sizing: border-box; + } + #domainsTable thead { + display: none; + } + #domainsTable tr { + display: flex; + padding: 15px 0; + flex-wrap: wrap; + box-sizing: border-box; + align-items: end; + border: 1px solid rgba(127, 127, 127, 0.4); + margin: 10px 0; + border-radius: 6px; + } + #domainsTable td { + flex: 1 1 auto; + width: 100px; + display: block; + border: none; + box-sizing: border-box; + order: 2; + text-align: right; + padding: 4px 8px; + } + #domainsTable td:nth-child(2n) { + width: calc(100% - 120px); + } + #domainsTable td:first-child { + width: calc(100% - 40px); + order: 1; + text-align: left; + padding-bottom: 10px; + border-bottom: 1px solid rgba(127, 127, 127, 0.25); + margin-bottom: 5px; + } + #domainsTable td:last-child { + width: 40px; + order: 1; + padding-bottom: 10px; + border-bottom: 1px solid rgba(127, 127, 127, 0.25); + margin-bottom: 5px; + } + #domainsTable td:nth-child(2), + #domainsTable td:nth-child(4) { + text-align: left; + } + #domainsTable td::before { + display: block; + font-weight: bold; + font-size: smaller; + } + #domainsTable td:nth-child(2)::before { + content: "Type:"; + } + #domainsTable td:nth-child(4)::before { + content: "Comment:"; + } +} +@media screen and (min-width: 767px) { + #domainsTable select.form-control { + padding: 0 0 0 5px; + width: auto; + } +} +@media screen and (max-width: 767px) { + #domainsTable th { + white-space: normal; + } +} + @keyframes icon-bounce { 0%, 20%, diff --git a/style/themes/lcars.css b/style/themes/lcars.css index cc0564c8..6267f1b4 100644 --- a/style/themes/lcars.css +++ b/style/themes/lcars.css @@ -1670,6 +1670,16 @@ table.dataTable { } } +/*** Fix some datatables layout on small screens ***/ +@media screen and (max-width: 660px), screen and (min-width: 767px) and (max-width: 960px) { + #domainsTable td::before { + margin: 0 5px 2px; + } + #domainsTable td:nth-child(2n) { + width: calc(100% - 160px); + } +} + /*** Used by the long-term pages ***/ .daterangepicker { background-color: #345; From e1cbe8775f5e6939b2393a54fb9fcc87e1b7cb2f Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Sat, 15 Jan 2022 03:47:26 -0300 Subject: [PATCH 12/45] Improving contrast for UI tabs (#2076) * Improving nav-tabs contrast Signed-off-by: rdwebdesign * Improving nav-tabs contrast + prettier Signed-off-by: rdwebdesign --- style/themes/default-dark.css | 37 ++++++++++++++++++++------------- style/themes/default-darker.css | 12 +++++------ style/themes/default-light.css | 17 ++++++++++++++- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/style/themes/default-dark.css b/style/themes/default-dark.css index c0444ab4..5e20e1d1 100644 --- a/style/themes/default-dark.css +++ b/style/themes/default-dark.css @@ -263,24 +263,36 @@ h4 { .nav-tabs-custom .tab-content { background-color: #30383f; } -.nav-tabs-custom > .nav-tabs > li.active > a { - border-left-color: #353c42; - border-right-color: #353c42; - background-color: #272c30; - color: #bec5cb; -} -.nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type.active > a { - border-left-color: #353c42; +.nav-tabs-custom > .nav-tabs { + background: rgba(64, 72, 80, 0.666); } .nav-tabs-custom > .nav-tabs > li { + margin-right: 1px; color: #bec5cb; } +.nav-tabs-custom > .nav-tabs > li.active > a, +.nav-tabs-custom > .nav-tabs > li.active:hover > a { + border-left-color: #30383f; + border-right-color: #30383f; + background-color: #30383f; + color: #bec5cb; +} +.nav-tabs-custom > .nav-tabs > li:not(.active):hover { + border-top-color: #d2d6de; + background-color: transparent; +} .nav-tabs-custom > .nav-tabs > li > a { - color: #bec5cb; + color: #8e959b; } .nav-tabs-custom > .nav-tabs > li > a:focus { - background: #404850; + color: #3c8dbc; } +.nav-tabs-custom > .nav-tabs > li:hover > a, +.nav-tabs-custom > .nav-tabs > li.active:hover > a { + background-color: #353c42; + color: #bec5cb; +} + .list-group { color: #bec5cb; background-color: #272c30; @@ -452,11 +464,6 @@ div.dataTables_wrapper div.dataTables_length select { color: #bec5cb; border: 1px solid #3d444b; } -.nav-tabs-custom > .nav-tabs > li:hover > a, -.nav-tabs-custom > .nav-tabs > li.active:hover > a { - background-color: #353c42; - color: #bec5cb; -} .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { diff --git a/style/themes/default-darker.css b/style/themes/default-darker.css index 85eb263b..391ba064 100644 --- a/style/themes/default-darker.css +++ b/style/themes/default-darker.css @@ -3330,16 +3330,18 @@ a:focus { box-shadow: rgba(0, 0, 0, 0.1) 0 1px 1px; } .nav-tabs-custom > .nav-tabs { + background: rgb(30, 40, 44); border-bottom-color: rgb(51, 55, 57); } .nav-tabs-custom > .nav-tabs > li { border-top-color: transparent; + margin-right: 1px; } .nav-tabs-custom > .nav-tabs > li.disabled > a { color: rgb(157, 148, 136); } .nav-tabs-custom > .nav-tabs > li > a { - color: rgb(189, 183, 175); + color: rgb(140, 144, 154); } .nav-tabs-custom > .nav-tabs > li > a.text-muted { color: rgb(168, 160, 149); @@ -3352,10 +3354,8 @@ a:focus { .nav-tabs-custom > .nav-tabs > li > a:hover { color: rgb(168, 160, 149); } -.nav-tabs-custom > .nav-tabs > li:not(.active) > a:hover, -.nav-tabs-custom > .nav-tabs > li:not(.active) > a:focus, -.nav-tabs-custom > .nav-tabs > li:not(.active) > a:active { - border-color: transparent; +.nav-tabs-custom > .nav-tabs > li:not(.active):hover { + background: rgb(24, 32, 35); } .nav-tabs-custom > .nav-tabs > li.active { border-top-color: rgb(44, 103, 137); @@ -3392,7 +3392,7 @@ a:focus { } .nav-tabs-custom > .nav-tabs > li > a:focus, .nav-tabs-custom > .nav-tabs > li.active > a:focus { - color: rgb(95, 142, 170); + color: rgb(60, 140, 188); } .nav-tabs-custom.tab-primary > .nav-tabs > li.active { diff --git a/style/themes/default-light.css b/style/themes/default-light.css index 0ee69ccb..051c6b42 100644 --- a/style/themes/default-light.css +++ b/style/themes/default-light.css @@ -130,8 +130,23 @@ border-bottom-right-radius: 2px; border-bottom-left-radius: 0; } + +.nav-tabs-custom > .nav-tabs { + background: #e4e8f0; +} +.nav-tabs-custom > .nav-tabs > li { + margin-right: 1px; +} +.nav-tabs-custom > .nav-tabs > li:not(.active):hover { + background: #fff; + border-top-color: #d2d6de; +} +.nav-tabs-custom > .nav-tabs > li > a, +.nav-tabs-custom > .nav-tabs > li > a:hover { + color: #567; +} .nav-tabs-custom > .nav-tabs > li > a:focus { - color: #60a4cc; + color: #3c8dbc; } .layout-top-nav .main-header > .logo { From 63032c8f6c08de5b823368dae5cc5917affa16af Mon Sep 17 00:00:00 2001 From: rdwebdesign Date: Tue, 28 Dec 2021 19:45:55 -0300 Subject: [PATCH 13/45] Better pie chart legend New icon and function names for pie legends Minor adjustments to pie chart tooltips Signed-off-by: rdwebdesign --- scripts/pi-hole/js/index.js | 93 ++++++++++++++++++++++++++----------- style/pi-hole.css | 43 ++++++++++++++--- 2 files changed, 103 insertions(+), 33 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 47b7f08a..3ffc8d06 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -319,24 +319,71 @@ function updateQueryTypesPie() { queryTypePieChart.update(); // Don't use rotation animation for further updates queryTypePieChart.options.animation.duration = 0; + queryTypePieChart.options.legendCallback = customLegend; + // Generate legend in separate div $("#query-types-legend").html(queryTypePieChart.generateLegend()); - $("#query-types-legend > ul > li").prepend(createEyeConElement()); $("#query-types-legend > ul > li").click(function (e) { - if (isEyeCon(e.target)) { + if (iscolorBox(e.target)) { return false; } window.location.href = "queries.php?querytype=" + querytypeids[$(this).index()]; }); + $("#query-types-legend .colorBoxWrapper").click(function (e) { + hidePieSlice(e); + }); }).done(function () { // Reload graph after minute setTimeout(updateQueryTypesPie, 60000); }); } +function customLegend(chart) { + var text = []; + var data = chart.data; + var datasets = data.datasets; + var labels = data.labels; + + text.push('
    '); + + if (datasets.length > 0) { + for (var i = 0; i < datasets[0].data.length; ++i) { + var color = datasets[0].backgroundColor[i]; + + var txt = ""; + + // legend box icon + txt = + '' + + '' + + ""; + + // color block + txt += ''; + + // label + if (labels[i]) { + txt += + '' + + labels[i] + + ""; + } + + text.push("
  • " + txt + "
  • "); + } + } + + text.push("
"); + return text.join(""); +} + function hidePieSlice(event) { - toggleEyeCon(event.target); + togglecolorBox(event.target); var legendID = $(event.target).closest(".chart-legend").attr("id"); var ci = @@ -360,19 +407,19 @@ function hidePieSlice(event) { ci.update(); } -function toggleEyeCon(target) { +function togglecolorBox(target) { var parentListItem = $(target).closest("li"); - var eyeCon = $(parentListItem).find(".fa-eye, .fa-eye-slash"); + var colorBox = $(parentListItem).find(".fa-check-square, .fa-square"); - if (eyeCon) { - $(eyeCon).toggleClass("fa-eye"); - $(eyeCon).toggleClass("fa-eye-slash"); + if (colorBox) { + $(colorBox).toggleClass("fa-check-square"); + $(colorBox).toggleClass("fa-square"); } } -function isEyeCon(target) { - // See if click happened on eyeConWrapper or child SVG - if ($(target).closest(".eyeConWrapper")[0]) { +function iscolorBox(target) { + // See if click happened on colorBoxWrapper or child SVG + if ($(target).closest(".colorBoxWrapper")[0]) { return true; } @@ -468,16 +515,6 @@ function updateClientsOverTime() { }); } -function createEyeConElement() { - var eyeConWrapper = $("") - .addClass("eyeConWrapper") - .click(function (e) { - hidePieSlice(e); - }); - eyeConWrapper.append($("")); - return eyeConWrapper; -} - function updateForwardDestinationsPie() { $.getJSON("api.php?getForwardDestinations", function (data) { if ("FTLnotrunning" in data) { @@ -519,11 +556,12 @@ function updateForwardDestinationsPie() { forwardDestinationPieChart.update(); // Don't use rotation animation for further updates forwardDestinationPieChart.options.animation.duration = 0; + forwardDestinationPieChart.options.legendCallback = customLegend; + // Generate legend in separate div $("#forward-destinations-legend").html(forwardDestinationPieChart.generateLegend()); - $("#forward-destinations-legend > ul > li").prepend(createEyeConElement()); $("#forward-destinations-legend > ul > li").click(function (e) { - if (isEyeCon(e.target)) { + if (iscolorBox(e.target)) { return false; } @@ -532,6 +570,9 @@ function updateForwardDestinationsPie() { window.location.href = "queries.php?forwarddest=" + obj; } }); + $("#forward-destinations-legend .colorBoxWrapper").click(function (e) { + hidePieSlice(e); + }); }).done(function () { // Reload graph after one minute setTimeout(updateForwardDestinationsPie, 60000); @@ -798,7 +839,7 @@ function updateSummaryData(runOnce) { function doughnutTooltip(tooltipItems, data) { var dataset = data.datasets[tooltipItems.datasetIndex]; - var label = data.labels[tooltipItems.index]; + var label = " " + data.labels[tooltipItems.index]; // Compute share of total and of displayed var scale = 0, total = 0; @@ -816,9 +857,9 @@ function doughnutTooltip(tooltipItems, data) { return label + ": " + dataset.data[tooltipItems.index].toFixed(1) + "%"; return ( label + - ":
- " + + ":
• " + dataset.data[tooltipItems.index].toFixed(1) + - "% of all queries
- " + + "% of all queries
• " + ((dataset.data[tooltipItems.index] * 100) / (total - scale)).toFixed(1) + "% of shown items" ); diff --git a/style/pi-hole.css b/style/pi-hole.css index 97ddd594..828d701a 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -215,21 +215,54 @@ .chart-legend ul { list-style-type: none; + padding-left: 45px; } .chart-legend li { cursor: pointer; - word-break: break-all; + position: relative; + line-height: 1; + margin: 0 0 6px; } .chart-legend li span { display: inline-block; - width: 20px; height: 12px; +} + +.colorBoxWrapper { + font-size: 14px; +} + +.colorBoxWrapper:hover { + transform: scale(1.15); +} + +.chart-legend li .colorBoxWrapper { + position: absolute; + width: 20px; + left: -20px; + top: 0; + line-height: 1; +} + +.chart-legend li .legend-color-box { + display: none; + width: 12px; margin-right: 5px; } -.strike { +.chart-legend li .legend-label-text { + line-height: 1; + word-break: break-word; +} + +.chart-legend li .legend-label-text:hover { + text-decoration: underline; +} + +.strike, +.strike span { text-decoration: line-through !important; } @@ -442,10 +475,6 @@ td.details-control { height: 50px; } -.eyeConWrapper { - font-size: 14px; -} - #apiTokenIframe { width: 100%; border: 0; From fcc27d5c71802c99277e2b21c6b1a2c768cbf277 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 16 Jan 2022 15:33:57 +0000 Subject: [PATCH 14/45] Revert "sync: master to devel (#2074)" This reverts commit de836ecc772263876b86cd1369e78e640f822d0e. --- .github/workflows/stale.yml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 86517934..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Mark stale issues - -on: - schedule: - - cron: '0 * * * *' - workflow_dispatch: - -jobs: - stale: - - runs-on: ubuntu-latest - permissions: - issues: write - - steps: - - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-stale: 30 - days-before-close: 5 - stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.' - stale-issue-label: 'Submitter Attention Required' - exempt-issue-labels: 'pinned, Fixed In Next Release, Bug' - exempt-all-issue-assignees: true - operations-per-run: 300 From d1e90e273a052e9fccebf177d53282da92d1c075 Mon Sep 17 00:00:00 2001 From: rdwebdesign Date: Mon, 17 Jan 2022 02:06:26 -0300 Subject: [PATCH 15/45] Better file extension verification Signed-off-by: rdwebdesign --- scripts/pi-hole/php/teleporter.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/pi-hole/php/teleporter.php b/scripts/pi-hole/php/teleporter.php index d25f0509..0e9740f2 100644 --- a/scripts/pi-hole/php/teleporter.php +++ b/scripts/pi-hole/php/teleporter.php @@ -337,18 +337,15 @@ if(isset($_POST["action"])) $source = $_FILES["zip_file"]["tmp_name"]; $type = mime_content_type($source); - $name = explode(".", $filename); + // verify the file mime type $accepted_types = array('application/gzip', 'application/tar', 'application/x-compressed', 'application/x-gzip'); - $okay = false; - foreach($accepted_types as $mime_type) { - if($mime_type == $type) { - $okay = true; - break; - } - } + $mime_valid = in_array($type, $accepted_types); - $continue = strtolower($name[1]) == 'tar' && strtolower($name[2]) == 'gz' ? true : false; - if(!$continue || !$okay) { + // verify the file extension (Looking for ".tar.gz" at the end of the file name) + $ext = array_slice(explode(".", $filename), -2, 2); + $ext_valid = strtolower($ext[0]) == "tar" && strtolower($ext[1]) == "gz" ? true : false; + + if(!$ext_valid || !$mime_valid) { die("The file you are trying to upload is not a .tar.gz file (filename: ".htmlentities($filename).", type: ".htmlentities($type)."). Please try again."); } From dc598295caf51422b78ccf15788428cdf3c546e0 Mon Sep 17 00:00:00 2001 From: Alexandr Salamatov Date: Wed, 19 Jan 2022 16:07:18 -0600 Subject: [PATCH 16/45] API call to modify local DNS records Signed-off-by: Alexandr Salamatov --- api.php | 27 +++++++++++++++++++++++++++ scripts/pi-hole/php/customdns.php | 12 +++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/api.php b/api.php index e7ddb692..80be0cf8 100644 --- a/api.php +++ b/api.php @@ -141,6 +141,33 @@ elseif (isset($_GET['list'])) return; } +elseif(isset($_GET['customdns']) && $auth) +{ + if(isset($_GET["auth"])) + { + if($_GET["auth"] !== $pwhash) + die("Not authorized!"); + } + else + { + // Skip token validation if explicit auth string is given + check_csrf($_GET['token']); + } + + switch ($_GET["action"]) { + case 'get': + $_POST['action'] = 'get'; + break; + case 'add': + $_POST['action'] = 'add'; + break; + case 'delete': + $_POST['action'] = 'delete'; + break; + } + + require("scripts/pi-hole/php/customdns.php"); +} // Other API functions require("api_FTL.php"); diff --git a/scripts/pi-hole/php/customdns.php b/scripts/pi-hole/php/customdns.php index 196ca281..bfa2fd80 100644 --- a/scripts/pi-hole/php/customdns.php +++ b/scripts/pi-hole/php/customdns.php @@ -5,11 +5,13 @@ require_once('auth.php'); // Authentication checks - if (isset($_POST['token'])) { - check_cors(); - check_csrf($_POST['token']); - } else { - log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!'); + if (!isset($api)) { + if (isset($_POST['token'])) { + check_cors(); + check_csrf($_POST['token']); + } else { + log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!'); + } } From e8807fb9d2e8443d61fc2ce785d0fd9b484484c6 Mon Sep 17 00:00:00 2001 From: rdwebdesign Date: Thu, 20 Jan 2022 20:09:37 -0300 Subject: [PATCH 17/45] Fix an "overflow" on hover Change the animation range and timing Signed-off-by: rdwebdesign --- style/pi-hole.css | 35 +++++++++++++++++++-------------- style/themes/default-dark.css | 1 + style/themes/default-darker.css | 1 + style/themes/default-light.css | 1 + 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/style/pi-hole.css b/style/pi-hole.css index 25ce570f..c9acd8e9 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -475,12 +475,6 @@ td.details-control { right: 12px; } -.icon-bounce { - display: inline-block; - position: relative; - animation: icon-bounce 1.5s 2 linear; -} - /* Fix some datatables layout on small screens */ @media screen and (max-width: 660px), screen and (min-width: 767px) and (max-width: 960px) { #domainsTable_wrapper .table-responsive { @@ -560,23 +554,34 @@ td.details-control { } } +.icon-bounce { + display: inline-block; + position: relative; + animation: icon-bounce 2.4s 3 ease-in-out; + font-size: 1.6em; +} + @keyframes icon-bounce { 0%, - 20%, + 15%, 50%, - 70%, - 90%, 100% { transform: translateY(0); } + 25% { + transform: translateY(-5px); + } + 30% { + transform: translateY(4px); + } + 35% { + transform: translateY(-3px); + } 40% { - transform: translateY(-15px); + transform: translateY(2px); } - 60% { - transform: translateY(-8px); - } - 80% { - transform: translateY(-4px); + 45% { + transform: translateY(-1px); } } diff --git a/style/themes/default-dark.css b/style/themes/default-dark.css index 5e20e1d1..f84782b2 100644 --- a/style/themes/default-dark.css +++ b/style/themes/default-dark.css @@ -211,6 +211,7 @@ h4 { .main-header .navbar .nav > li > a, .main-header .navbar .nav > li > .navbar-text { color: #bec5cb; + max-height: 50px; } .main-header .navbar .nav > li > a:hover, .main-header .navbar .nav > li > a:active, diff --git a/style/themes/default-darker.css b/style/themes/default-darker.css index 391ba064..72203fd3 100644 --- a/style/themes/default-darker.css +++ b/style/themes/default-darker.css @@ -5456,6 +5456,7 @@ link-muted { .main-header .navbar .nav > li > a, .main-header .navbar .nav > li > .navbar-text { color: rgb(232, 230, 227); + max-height: 50px; } .main-header .navbar .nav > li > a:hover, .main-header .navbar .nav > li > a:active, diff --git a/style/themes/default-light.css b/style/themes/default-light.css index 051c6b42..72b37836 100644 --- a/style/themes/default-light.css +++ b/style/themes/default-light.css @@ -11,6 +11,7 @@ .main-header .navbar .nav > li > a, .main-header .navbar .nav > li > .navbar-text { color: #fff; + max-height: 50px; } .main-header .navbar .nav > li > a:hover, .main-header .navbar .nav > li > a:active, From 39f0da7eb5d77ea3b6ea3a580df4ad64de51911f Mon Sep 17 00:00:00 2001 From: Alexandr Salamatov Date: Thu, 20 Jan 2022 21:22:01 -0600 Subject: [PATCH 18/45] API call to modify local CNAME records Signed-off-by: Alexandr Salamatov --- api.php | 27 +++++++++++++++++++++++++++ scripts/pi-hole/php/customcname.php | 12 +++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/api.php b/api.php index 80be0cf8..919ff07d 100644 --- a/api.php +++ b/api.php @@ -168,6 +168,33 @@ elseif(isset($_GET['customdns']) && $auth) require("scripts/pi-hole/php/customdns.php"); } +elseif(isset($_GET['customcname']) && $auth) +{ + if(isset($_GET["auth"])) + { + if($_GET["auth"] !== $pwhash) + die("Not authorized!"); + } + else + { + // Skip token validation if explicit auth string is given + check_csrf($_GET['token']); + } + + switch ($_GET["action"]) { + case 'get': + $_POST['action'] = 'get'; + break; + case 'add': + $_POST['action'] = 'add'; + break; + case 'delete': + $_POST['action'] = 'delete'; + break; + } + + require("scripts/pi-hole/php/customcname.php"); +} // Other API functions require("api_FTL.php"); diff --git a/scripts/pi-hole/php/customcname.php b/scripts/pi-hole/php/customcname.php index 060799e2..a34a8915 100644 --- a/scripts/pi-hole/php/customcname.php +++ b/scripts/pi-hole/php/customcname.php @@ -5,11 +5,13 @@ require_once('auth.php'); // Authentication checks - if (isset($_POST['token'])) { - check_cors(); - check_csrf($_POST['token']); - } else { - log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!'); + if (!isset($api)) { + if (isset($_POST['token'])) { + check_cors(); + check_csrf($_POST['token']); + } else { + log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!'); + } } From 5137206dcc5df6fcff7c69cc9871a29ca45b2313 Mon Sep 17 00:00:00 2001 From: Alexandr Salamatov Date: Fri, 21 Jan 2022 14:28:33 -0600 Subject: [PATCH 19/45] adjust indentation Signed-off-by: Alexandr Salamatov --- api.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/api.php b/api.php index 919ff07d..b986a655 100644 --- a/api.php +++ b/api.php @@ -143,13 +143,11 @@ elseif (isset($_GET['list'])) } elseif(isset($_GET['customdns']) && $auth) { - if(isset($_GET["auth"])) - { - if($_GET["auth"] !== $pwhash) - die("Not authorized!"); - } - else - { + if (isset($_GET["auth"])) { + if ($_GET["auth"] !== $pwhash) { + die("Not authorized!"); + } + } else { // Skip token validation if explicit auth string is given check_csrf($_GET['token']); } @@ -170,13 +168,11 @@ elseif(isset($_GET['customdns']) && $auth) } elseif(isset($_GET['customcname']) && $auth) { - if(isset($_GET["auth"])) - { - if($_GET["auth"] !== $pwhash) - die("Not authorized!"); - } - else - { + if (isset($_GET["auth"])) { + if ($_GET["auth"] !== $pwhash) { + die("Not authorized!"); + } + } else { // Skip token validation if explicit auth string is given check_csrf($_GET['token']); } From e559af90f9353d4b59bb9229865a3dd2527b884f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 22 Jan 2022 01:54:27 +0000 Subject: [PATCH 20/45] Bump nanoid from 3.1.30 to 3.2.0 Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.2.0. - [Release notes](https://github.com/ai/nanoid/releases) - [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md) - [Commits](https://github.com/ai/nanoid/compare/3.1.30...3.2.0) --- updated-dependencies: - dependency-name: nanoid dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 82272b93..256daa6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2851,9 +2851,9 @@ "dev": true }, "nanoid": { - "version": "3.1.30", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", - "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", "dev": true }, "natural-compare": { From ddd48b1eb3f547d76948a25031fe1bd620f662bd Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sat, 22 Jan 2022 18:37:19 +0800 Subject: [PATCH 21/45] footer.php: Add the Docker Hub tags link to "Docker Tag" Signed-off-by: Peter Dave Hello --- scripts/pi-hole/php/footer.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php index 0d2d2485..9b351f98 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -53,10 +53,12 @@ $githubBaseUrl = "https://github.com/pi-hole"; $coreUrl = $githubBaseUrl . "/pi-hole"; + $dockerUrl = $githubBaseUrl . "/docker-pi-hole"; $ftlUrl = $githubBaseUrl . "/FTL"; $webUrl = $githubBaseUrl . "/AdminLTE"; $coreReleasesUrl = $coreUrl . "/releases"; + $dockerReleasesUrl = $dockerUrl . "/releases"; $ftlReleasesUrl = $ftlUrl . "/releases"; $webReleasesUrl = $webUrl . "/releases"; ?> @@ -78,7 +80,12 @@ diff --git a/settings.php b/settings.php index ec75d9e8..642b6958 100644 --- a/settings.php +++ b/settings.php @@ -287,7 +287,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho - DNS cache evictions: + DNS cache evictions:   @@ -457,7 +457,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho
checked>

-

hidden>Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!

+

hidden>Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!

@@ -1263,7 +1263,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho

The privacy level may be increased at any time without having to restart the DNS resolver. However, note that the DNS resolver needs to be restarted when lowering the privacy level. This restarting is automatically done when saving.

0 && $piHoleLogging){ ?> -

Warning: Pi-hole's query logging is activated. Although the dashboard will hide the requested details, all queries are still fully logged to the pihole.log file.

+

Warning: Pi-hole's query logging is activated. Although the dashboard will hide the requested details, all queries are still fully logged to the pihole.log file.

diff --git a/style/pi-hole.css b/style/pi-hole.css index 25ce570f..6ddb5e69 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -19,41 +19,58 @@ @-webkit-keyframes Pulse { from { - color: #630030; - text-shadow: 0 0 2px transparent; + opacity: 0; } 50% { - color: #e33100; - text-shadow: 0 0 5px #e33100; + opacity: 1; } to { - color: #630030; - text-shadow: 0 0 2px transparent; + opacity: 0; } } @keyframes Pulse { from { - color: #630030; - text-shadow: 0 0 2px transparent; + opacity: 0; } 50% { - color: #e33100; - text-shadow: 0 0 5px #e33100; + opacity: 1; } to { - color: #630030; - text-shadow: 0 0 2px transparent; + opacity: 0; } } .lookatme { - -webkit-animation: 2s infinite Pulse; - animation: 2s infinite Pulse; + color: #630030; + opacity: 1; + position: relative; + display: inline-block; +} + +td.lookatme { + display: table-cell; +} + +/* this pseudo element will be faded in and out in front /* +/* of the lookatme element to create an efficient animation. */ +.lookatme:after { + color: #e33100; + text-shadow: 0 0 5px #e33100; + /* in the html, the lookatme-text attribute must */ + /* contain the same text as the .lookatme element */ + content: attr(lookatme-text); + padding: inherit; + position: absolute; + inset: 0 0 0 0; + z-index: 1; + /* 20 steps / 2 seconds = 10fps */ + -webkit-animation: 2s infinite Pulse steps(20); + animation: 2s infinite Pulse steps(20); } .table-responsive { From 8fa0d8d01800f19ece64250e829b27e51640fc49 Mon Sep 17 00:00:00 2001 From: Iksas Date: Sat, 22 Jan 2022 15:23:57 +0100 Subject: [PATCH 23/45] improve efficiency of the warningPulse animation Signed-off-by: Iksas --- style/themes/lcars.css | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/style/themes/lcars.css b/style/themes/lcars.css index 6267f1b4..20e5a25d 100644 --- a/style/themes/lcars.css +++ b/style/themes/lcars.css @@ -1460,30 +1460,46 @@ table.dataTable { @-webkit-keyframes warningPulse { 0% { - border-color: rgba(255, 153, 0, 0.4); + opacity: 0; } 50% { - border-color: rgba(255, 150, 0, 1); + opacity: 1; } 100% { - border-color: rgba(255, 153, 0, 0.4); + opacity: 0; } } @keyframes warningPulse { 0% { - border-color: rgba(255, 153, 0, 0.4); + opacity: 0; } 50% { - border-color: rgba(255, 150, 0, 1); + opacity: 1; } 100% { - border-color: rgba(255, 153, 0, 0.4); + opacity: 0; } } -.box-warning { - animation: 3s infinite warningPulse; +.box.box-warning { + border-top-color: #71480a; + position: relative; +} + +.box.box-warning:after { + content: ""; + border-top: 3px solid #f89201; + border-radius: 12px; + position: absolute; + margin-top: -3px; + inset: 0 0 0 0; + z-index: -1; + animation: 3s infinite warningPulse steps(30); +} + +.box.box-warning div { + z-index: 2; } /*** MEDIA QUERIES ***/ From 867fb48902f99d10dda76c861b22e0506cdbfc6b Mon Sep 17 00:00:00 2001 From: Iksas Date: Sat, 22 Jan 2022 19:07:45 +0100 Subject: [PATCH 24/45] improve efficiency of the LCARS login screen error message Signed-off-by: Iksas --- style/pi-hole.css | 16 +++++++++---- style/themes/lcars.css | 51 +++++++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/style/pi-hole.css b/style/pi-hole.css index 6ddb5e69..caf7c247 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -45,6 +45,18 @@ } } +p#dhcpnotice[hidden] { + display: none; +} + +.lookatme #dhcpnotice { + display: block; +} + +td.lookatme { + display: table-cell; +} + .lookatme { color: #630030; opacity: 1; @@ -52,10 +64,6 @@ display: inline-block; } -td.lookatme { - display: table-cell; -} - /* this pseudo element will be faded in and out in front /* /* of the lookatme element to create an efficient animation. */ .lookatme:after { diff --git a/style/themes/lcars.css b/style/themes/lcars.css index 20e5a25d..b9cd419e 100644 --- a/style/themes/lcars.css +++ b/style/themes/lcars.css @@ -312,6 +312,13 @@ label { font-weight: bold !important; } +div .panel-title, +p.login-box-msg, +.form-group.has-error label { + position: relative; + z-index: 1; +} + .form-control::placeholder { color: #456; } @@ -329,24 +336,34 @@ label { .form-group.has-error.login-box-msg::before { content: "ACCESS DENIED"; - display: block; margin: -20px -20px 20px; padding: calc(45px + 0.7em) 0 0; position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 130px; - color: #d43; + inset: 0 0 0 0; + color: #630030; font-size: 3.825em; font-size: calc((100vw - var(--sidebar-width) - 60px) / 12); line-height: 1; - animation: 3s infinite Pulse; background: rgba(0, 0, 0, 0.88); - z-index: 0; } -.layout-boxed .form-group.has-error.login-box-msg::before { +.form-group.has-error.login-box-msg::after { + content: "ACCESS DENIED"; + margin: -20px -20px 20px; + padding: calc(45px + 0.7em) 0 0; + position: absolute; + inset: 0 0 0 0; + color: #e33100; + font-size: 3.825em; + font-size: calc((100vw - var(--sidebar-width) - 60px) / 12); + line-height: 1; + text-shadow: 0 0 5px #e33100; + animation: 3s infinite Pulse steps(30); + z-index: 1; +} + +.layout-boxed .form-group.has-error.login-box-msg::before, +.layout-boxed .form-group.has-error.login-box-msg::after { padding: calc(50% - 0.5em) 0 0; } @@ -1506,7 +1523,8 @@ table.dataTable { /*--- Media - max-width ---*/ @media (max-width: 991px) { - .form-group.has-error.login-box-msg::before { + .form-group.has-error.login-box-msg::before, + .form-group.has-error.login-box-msg::after { font-size: calc((100vw - var(--sidebar-width) - 60px) / 9); } } @@ -1597,7 +1615,8 @@ table.dataTable { .main-footer { margin-left: 0; } - .form-group.has-error.login-box-msg::before { + .form-group.has-error.login-box-msg::before, + .form-group.has-error.login-box-msg::after { font-size: calc((100vw - 60px) / 6); } } @@ -1668,18 +1687,18 @@ table.dataTable { } @media (min-width: 1320px) { - .layout-boxed .form-group.has-error.login-box-msg::before { + .layout-boxed .form-group.has-error.login-box-msg::before, + .layout-boxed .form-group.has-error.login-box-msg::after { font-size: calc((1320px - var(--sidebar-width) - 60px) / 12); } } -@media (min-width: 1920px) { - .layout-boxed .form-group.has-error.login-box-msg::before { +@media (min-width: 1960px) { + .layout-boxed .form-group.has-error.login-box-msg::before, + .layout-boxed .form-group.has-error.login-box-msg::after { font-size: calc((1920px - var(--sidebar-width) - 60px) / 12); } -} -@media (min-width: 1960px) { .layout-boxed .wrapper { box-shadow: none; max-width: 1920px; From bf82c47e980c5cec5b6d4f8d23d5dcbd1f702077 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Sun, 30 Jan 2022 10:46:47 -0300 Subject: [PATCH 25/45] Fix the wrong escaping on settings datatable (#2100) * Fix the wrong escaping on settings datatable Signed-off-by: rdwebdesign * Using utils escapeHtml function Signed-off-by: rdwebdesign * Fix prettier Signed-off-by: rdwebdesign --- scripts/pi-hole/js/settings.js | 16 +++++++++++++++- settings.php | 3 --- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 3663822f..2ace4551 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -268,9 +268,23 @@ $(function () { columnDefs: [ { bSortable: false, orderable: false, targets: -1 }, { - targets: [0, 1, 2], + targets: [0, 1], render: $.fn.dataTable.render.text(), }, + { + targets: 2, + render: function (data) { + // Show "unknown", when host is "*" + var str; + if (data === "*") { + str = "unknown"; + } else { + str = typeof data === "string" ? utils.escapeHtml(data) : data; + } + + return str; + }, + }, ], paging: true, order: [[2, "asc"]], diff --git a/settings.php b/settings.php index ec75d9e8..ba933e09 100644 --- a/settings.php +++ b/settings.php @@ -595,9 +595,6 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho } $host = htmlentities($line[3]); - if ($host == "*") { - $host = "unknown"; - } $clid = $line[4]; if ($clid == "*") { From b50fada2113a79a940c8b98f8d75d7696de8f897 Mon Sep 17 00:00:00 2001 From: rdwebdesign Date: Mon, 31 Jan 2022 15:52:20 -0300 Subject: [PATCH 26/45] Limiting MAXLOGAGE interval to 24 (just like FTL) Signed-off-by: rdwebdesign --- index.php | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/index.php b/index.php index b6d1fa85..e9e99ffe 100644 --- a/index.php +++ b/index.php @@ -1,26 +1,24 @@ - From 7734c2294962a7f097a3dbe22c3be39345fc7587 Mon Sep 17 00:00:00 2001 From: rdwebdesign Date: Mon, 31 Jan 2022 16:36:44 -0300 Subject: [PATCH 27/45] Changing the comment Signed-off-by: rdwebdesign --- index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.php b/index.php index e9e99ffe..90402817 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,5 @@ Date: Mon, 31 Jan 2022 17:49:58 -0300 Subject: [PATCH 28/45] Fixing the escaping for settings datatable This time, fixing the right spot. Signed-off-by: rdwebdesign --- scripts/pi-hole/js/settings.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 2ace4551..04bdf6e5 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -238,9 +238,23 @@ $(function () { columnDefs: [ { bSortable: false, orderable: false, targets: -1 }, { - targets: [0, 1, 2], + targets: [0, 1], render: $.fn.dataTable.render.text(), }, + { + targets: 2, + render: function (data) { + // Show "unknown", when host is "*" + var str; + if (data === "*") { + str = "unknown"; + } else { + str = typeof data === "string" ? utils.escapeHtml(data) : data; + } + + return str; + }, + }, ], paging: true, order: [[2, "asc"]], @@ -268,23 +282,9 @@ $(function () { columnDefs: [ { bSortable: false, orderable: false, targets: -1 }, { - targets: [0, 1], + targets: [0, 1, 2], render: $.fn.dataTable.render.text(), }, - { - targets: 2, - render: function (data) { - // Show "unknown", when host is "*" - var str; - if (data === "*") { - str = "unknown"; - } else { - str = typeof data === "string" ? utils.escapeHtml(data) : data; - } - - return str; - }, - }, ], paging: true, order: [[2, "asc"]], From 171bf81b113bc99db821cf314ee29e214d91abf9 Mon Sep 17 00:00:00 2001 From: rdwebdesign Date: Tue, 1 Feb 2022 16:22:24 -0300 Subject: [PATCH 29/45] Retreives maxlogage calling api_FTL.php FTL defines MAXLOGAGE value. PHP retrieves the value and converts seconds to hours Javascript calls the API to update the value. Signed-off-by: rdwebdesign --- api_FTL.php | 10 ++++++++++ index.php | 15 +++------------ scripts/pi-hole/js/index.js | 12 ++++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/api_FTL.php b/api_FTL.php index b58a3eda..b7bcf9fe 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -61,6 +61,16 @@ else $data = array_merge($data,$stats); } + if (isset($_GET["getMaxlogage"]) && $auth) { + sendRequestFTL("maxlogage"); + // Convert seconds to hours and rounds to one decimal place. + $ret = round(intval(getResponseFTL()[0]) / 3600, 1); + // Return 24h if value is 0, empty, null or non numeric. + $ret = $ret ?: 24; + + $data = array_merge($data, array("maxlogage" => $ret)); + } + if (isset($_GET['overTimeData10mins'])) { sendRequestFTL("overTime"); diff --git a/index.php b/index.php index 90402817..8adb2101 100644 --- a/index.php +++ b/index.php @@ -5,19 +5,10 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ + $indexpage = true; require "scripts/pi-hole/php/header.php"; require_once "scripts/pi-hole/php/gravity.php"; - -function getinterval() -{ - global $piholeFTLConf; - if (isset($piholeFTLConf["MAXLOGAGE"])) { - return min(round(floatval($piholeFTLConf["MAXLOGAGE"]), 1), 24); - } else { - return "24"; - } -} ?> @@ -84,7 +75,7 @@ function getinterval()
-

Total queries over last hours

+

Total queries over last 24 hours

@@ -109,7 +100,7 @@ function getinterval()
-

Client activity over last hours

+

Client activity over last 24 hours

diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 3442f342..d7cce8e2 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -862,8 +862,20 @@ function doughnutTooltip(tooltipItems, data) { ); } +var maxlogage = "24"; +function getMaxlogage() { + $.getJSON("api.php?getMaxlogage", function (data) { + if (!("FTLnotrunning" in data)) { + maxlogage = data.maxlogage; + } + }).done(function () { + $(".maxlogage-interval").html(maxlogage); + }); +} + $(function () { // Pull in data via AJAX + getMaxlogage(); updateSummaryData(); var gridColor = $(".graphs-grid").css("background-color"); From a8062b20139fab7363f880a575e40ee595c41593 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 5 Feb 2022 10:05:54 +0000 Subject: [PATCH 30/45] Bump eslint-plugin-compat from 4.0.0 to 4.0.2 Bumps [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) from 4.0.0 to 4.0.2. - [Release notes](https://github.com/amilajack/eslint-plugin-compat/releases) - [Changelog](https://github.com/amilajack/eslint-plugin-compat/blob/main/CHANGELOG.md) - [Commits](https://github.com/amilajack/eslint-plugin-compat/compare/v4.0.0...v4.0.2) --- updated-dependencies: - dependency-name: eslint-plugin-compat dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 76 ++++++++++++++++++++++------------------------- package.json | 2 +- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index 319fe525..ffffe495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -364,9 +364,9 @@ "dev": true }, "@mdn/browser-compat-data": { - "version": "3.3.14", - "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-3.3.14.tgz", - "integrity": "sha512-n2RC9d6XatVbWFdHLimzzUJxJ1KY8LdjqrW6YvGPiRmsHkhOUx74/Ct10x5Yo7bC/Jvqx7cDEW8IMPv/+vwEzA==", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-4.1.6.tgz", + "integrity": "sha512-JbtcHGODAlkOT6eDV2rCyOguW3+o34ExMD9DOki6kxzeyN3IBtZ9PI0FlbKeD77Bm5U0UG5Heo4qnNbSajXUnw==", "dev": true }, "@nodelib/fs.scandir": { @@ -568,6 +568,14 @@ "dev": true, "requires": { "@mdn/browser-compat-data": "^3.3.14" + }, + "dependencies": { + "@mdn/browser-compat-data": { + "version": "3.3.14", + "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-3.3.14.tgz", + "integrity": "sha512-n2RC9d6XatVbWFdHLimzzUJxJ1KY8LdjqrW6YvGPiRmsHkhOUx74/Ct10x5Yo7bC/Jvqx7cDEW8IMPv/+vwEzA==", + "dev": true + } } }, "autoprefixer": { @@ -649,16 +657,16 @@ } }, "browserslist": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.0.tgz", - "integrity": "sha512-g2BJ2a0nEYvEFQC208q8mVAhfNwpZ5Mu8BwgtCdZKO3qx98HChmeg448fPdUzld8aFmfLgVh7yymqV+q1lJZ5g==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001254", - "colorette": "^1.3.0", - "electron-to-chromium": "^1.3.830", + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", "escalade": "^3.1.1", - "node-releases": "^1.1.75" + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" } }, "builtin-modules": { @@ -710,9 +718,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001256", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001256.tgz", - "integrity": "sha512-QirrvMLmB4txNnxiaG/xbm6FSzv9LqOZ3Jp9VtCYb3oPIfCHpr/oGn38pFq0udwlkctvXQgPthaXqJ76DaYGnA==", + "version": "1.0.30001307", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001307.tgz", + "integrity": "sha512-+MXEMczJ4FuxJAUp0jvAl6Df0NI/OfW1RWEE61eSmzS7hw6lz4IKutbhbXendwq8BljfFuHtu26VWsg4afQ7Ng==", "dev": true }, "chalk": { @@ -809,12 +817,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", - "dev": true - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -843,9 +845,9 @@ } }, "core-js": { - "version": "3.19.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.19.1.tgz", - "integrity": "sha512-Tnc7E9iKd/b/ff7GFbhwPVzJzPztGrChB8X8GLqoYGdEOG8IpLnK1xPyo3ZoO3HsK6TodJS58VGPOxA+hLHQMg==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.21.0.tgz", + "integrity": "sha512-YUdI3fFu4TF/2WykQ2xzSiTQdldLB4KVuL9WeAy5XONZYt5Cun/fpQvctoKbCgvPhmzADeesTk/j2Rdx77AcKQ==", "dev": true }, "cosmiconfig": { @@ -957,9 +959,9 @@ } }, "electron-to-chromium": { - "version": "1.3.836", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.836.tgz", - "integrity": "sha512-Ney3pHOJBWkG/AqYjrW0hr2AUCsao+2uvq9HUlRP8OlpSdk/zOHOUJP7eu0icDvePC9DlgffuelP4TnOJmMRUg==", + "version": "1.4.65", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.65.tgz", + "integrity": "sha512-0/d8Skk8sW3FxXP0Dd6MnBlrwx7Qo9cqQec3BlIAlvKnrmS3pHsIbaroEi+nd0kZkGpQ6apMEre7xndzjlEnLw==", "dev": true }, "emoji-regex": { @@ -1383,27 +1385,19 @@ } }, "eslint-plugin-compat": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-4.0.0.tgz", - "integrity": "sha512-lg9CPq0bsGxNXcLZgxqVAYsUUELIKZPRiwnJJQOHH910zCHEiscO00Sp+w9wflKEa/OtVaYfNhI2jOViRPZtjw==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-4.0.2.tgz", + "integrity": "sha512-xqvoO54CLTVaEYGMzhu35Wzwk/As7rCvz/2dqwnFiWi0OJccEtGIn+5qq3zqIu9nboXlpdBN579fZcItC73Ycg==", "dev": true, "requires": { - "@mdn/browser-compat-data": "^3.3.14", + "@mdn/browser-compat-data": "^4.1.5", "ast-metadata-inferer": "^0.7.0", "browserslist": "^4.16.8", - "caniuse-lite": "^1.0.30001267", + "caniuse-lite": "^1.0.30001304", "core-js": "^3.16.2", "find-up": "^5.0.0", "lodash.memoize": "4.1.2", "semver": "7.3.5" - }, - "dependencies": { - "caniuse-lite": { - "version": "1.0.30001282", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001282.tgz", - "integrity": "sha512-YhF/hG6nqBEllymSIjLtR2iWDDnChvhnVJqp+vloyt2tEHFG1yBR+ac2B/rOw0qOK0m0lEXU2dv4E/sMk5P9Kg==", - "dev": true - } } }, "eslint-plugin-es": { @@ -2863,9 +2857,9 @@ "dev": true }, "node-releases": { - "version": "1.1.75", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", - "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", "dev": true }, "normalize-package-data": { diff --git a/package.json b/package.json index ac6c3477..c0a35c34 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "devDependencies": { "autoprefixer": "^10.4.2", - "eslint-plugin-compat": "^4.0.0", + "eslint-plugin-compat": "^4.0.2", "postcss": "^8.4.5", "postcss-cli": "^9.1.0", "prettier": "2.5.1", From a0ee63381f6bd01487d713e28a10a131357c5a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sat, 5 Feb 2022 16:49:31 +0100 Subject: [PATCH 31/45] Inlcude timezone info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- settings.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.php b/settings.php index ba933e09..7152ffee 100644 --- a/settings.php +++ b/settings.php @@ -240,6 +240,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho } $FTLversion = exec("/usr/bin/pihole-FTL version"); + $FTLstart = exec("date -r /proc/" . $FTLpid . " '+%a %d %b %Y %R %Z'"); ?> @@ -253,7 +254,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho - + From 9b1e2b8dab85c615a65576363447069980e2b498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sat, 5 Feb 2022 19:21:25 +0100 Subject: [PATCH 32/45] Fix indention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.php b/settings.php index 7152ffee..a5119480 100644 --- a/settings.php +++ b/settings.php @@ -240,7 +240,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "dns", "piho } $FTLversion = exec("/usr/bin/pihole-FTL version"); - $FTLstart = exec("date -r /proc/" . $FTLpid . " '+%a %d %b %Y %R %Z'"); + $FTLstart = exec("date -r /proc/" . $FTLpid . " '+%a %d %b %Y %R %Z'"); ?>
Time FTL started:
User / Group:
From bb2934e24388932a5d1b28eb4a659c5e9906eda8 Mon Sep 17 00:00:00 2001 From: Chris Miceli Date: Sat, 5 Feb 2022 22:04:14 -0600 Subject: [PATCH 33/45] 1119 Privacy - Query Page and Dom.storage implement memory storage for functionality in case of no storage Signed-off-by: Chris Miceli --- scripts/pi-hole/js/utils.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index 22ac3887..a6af435d 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -229,13 +229,20 @@ function setBsSelectDefaults() { }; } +var backupStorage = {}; function stateSaveCallback(itemName, data) { - localStorage.setItem(itemName, JSON.stringify(data)); + if (localStorage === null) { + backupStorage[itemName] = JSON.stringify(data); + } else { + localStorage.setItem(itemName, JSON.stringify(data)); + } } function stateLoadCallback(itemName) { // Receive previous state from client's local storage area - var data = localStorage ? localStorage.getItem(itemName) : null; + var data = + localStorage === null ? backupStorage[itemName] || null : localStorage.getItem(itemName); + // Return if not available if (data === null) { return null; From dde4ac7d3e7a26d29819b7ec0f2f6d26544a2b15 Mon Sep 17 00:00:00 2001 From: Chris Miceli Date: Sat, 5 Feb 2022 22:38:56 -0600 Subject: [PATCH 34/45] 1119 Privacy - Query Page and Dom.storage be explicit for undefined Signed-off-by: Chris Miceli --- scripts/pi-hole/js/utils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index a6af435d..51a9165b 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -239,9 +239,14 @@ function stateSaveCallback(itemName, data) { } function stateLoadCallback(itemName) { + var data; // Receive previous state from client's local storage area - var data = - localStorage === null ? backupStorage[itemName] || null : localStorage.getItem(itemName); + if (localStorage === null) { + var item = backupStorage[itemName]; + data = typeof item === "undefined" ? null : item; + } else { + localStorage.getItem(itemName); + } // Return if not available if (data === null) { From cb083c061c623b94e412835912f3abffa586af9d Mon Sep 17 00:00:00 2001 From: Chris Miceli Date: Sat, 5 Feb 2022 23:04:29 -0600 Subject: [PATCH 35/45] 1119 Privacy - Query Page and Dom.storage fix else Signed-off-by: Chris Miceli --- scripts/pi-hole/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index 51a9165b..b9e1a573 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -245,7 +245,7 @@ function stateLoadCallback(itemName) { var item = backupStorage[itemName]; data = typeof item === "undefined" ? null : item; } else { - localStorage.getItem(itemName); + data = localStorage.getItem(itemName); } // Return if not available From 01de8fa3a8e3ff99287984d7028bad2d9a755470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sun, 6 Feb 2022 21:47:44 +0100 Subject: [PATCH 36/45] Add navigation above all datatables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- scripts/pi-hole/js/groups-adlists.js | 3 ++- scripts/pi-hole/js/groups-clients.js | 3 ++- scripts/pi-hole/js/groups-domains.js | 3 ++- scripts/pi-hole/js/groups.js | 3 ++- scripts/pi-hole/js/messages.js | 3 ++- scripts/pi-hole/js/settings.js | 6 ++++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js index 24fd2e4e..1ff87a0d 100644 --- a/scripts/pi-hole/js/groups-adlists.js +++ b/scripts/pi-hole/js/groups-adlists.js @@ -291,7 +291,8 @@ function initTable() { $("td:eq(5)", row).html(button); }, dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js index 016d3426..a2907426 100644 --- a/scripts/pi-hole/js/groups-clients.js +++ b/scripts/pi-hole/js/groups-clients.js @@ -215,7 +215,8 @@ function initTable() { $("td:eq(3)", row).html(button); }, dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ diff --git a/scripts/pi-hole/js/groups-domains.js b/scripts/pi-hole/js/groups-domains.js index 84824587..2faa9a83 100644 --- a/scripts/pi-hole/js/groups-domains.js +++ b/scripts/pi-hole/js/groups-domains.js @@ -244,7 +244,8 @@ function initTable() { } }, dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ diff --git a/scripts/pi-hole/js/groups.js b/scripts/pi-hole/js/groups.js index 25107d13..8b7e3b63 100644 --- a/scripts/pi-hole/js/groups.js +++ b/scripts/pi-hole/js/groups.js @@ -84,7 +84,8 @@ $(function () { } }, dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js index 8575b83f..f95777f6 100644 --- a/scripts/pi-hole/js/messages.js +++ b/scripts/pi-hole/js/messages.js @@ -174,7 +174,8 @@ $(function () { $("td:eq(3)", row).html(button); }, dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 04bdf6e5..16b1cf2d 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -228,7 +228,8 @@ $(function () { if (document.getElementById("DHCPLeasesTable")) { leasetable = $("#DHCPLeasesTable").DataTable({ dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ @@ -272,7 +273,8 @@ $(function () { if (document.getElementById("DHCPStaticLeasesTable")) { staticleasetable = $("#DHCPStaticLeasesTable").DataTable({ dom: - "<'row'<'col-sm-4'l><'col-sm-8'f>>" + + "<'row'<'col-sm-12'f>>" + + "<'row'<'col-sm-4'l><'col-sm-8'p>>" + "<'row'<'col-sm-12'<'table-responsive'tr>>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", lengthMenu: [ From be31e4ea584a687a3a6929902f3d00671c6f6748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Tue, 8 Feb 2022 21:51:55 +0100 Subject: [PATCH 37/45] Get TZ info from ENV in docker or date command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- settings.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/settings.php b/settings.php index a5119480..543dd56d 100644 --- a/settings.php +++ b/settings.php @@ -19,6 +19,12 @@ if(isset($last_error) && ($last_error["type"] === E_WARNING || $last_error["type $error .= "There was a problem applying your settings.
Debugging information:
PHP error (".htmlspecialchars($last_error["type"])."): ".htmlspecialchars($last_error["message"])." in ".htmlspecialchars($last_error["file"]).":".htmlspecialchars($last_error["line"]); } +# Timezone is set in docker via ENV otherwise get it from commandline +$timezone=getenv("TZ"); +if (empty($timezone)) { + $timezone=shell_exec("date +'%Z'"); +} + ?>