From 84d177e7b3f3ee931d897ae1f25ec1237e6876d6 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 20 Nov 2023 19:54:36 +0100 Subject: [PATCH 01/26] Also accept .tar.gz archives Signed-off-by: DL6ER --- settings-teleporter.lp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings-teleporter.lp b/settings-teleporter.lp index 2acd7372..e33e53e3 100644 --- a/settings-teleporter.lp +++ b/settings-teleporter.lp @@ -38,7 +38,7 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
- +

When importing settings from a newer version of Pi-hole, not yet existing settings will be ignored. When importing from an older version of Pi-hole, settings for newer features will be initialized with their default values.

From f8f28b6412a642a90bc435aa40feed50febbad6a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 20 Nov 2023 19:55:12 +0100 Subject: [PATCH 02/26] Remove leading slash in list of imported files Signed-off-by: DL6ER --- scripts/pi-hole/js/settings-teleporter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/settings-teleporter.js b/scripts/pi-hole/js/settings-teleporter.js index c0fc14ad..565a12f5 100644 --- a/scripts/pi-hole/js/settings-teleporter.js +++ b/scripts/pi-hole/js/settings-teleporter.js @@ -51,7 +51,7 @@ function importZIP() { $("#modal-import-success-title").text("Import successful"); var text = "

Processed files:

    "; for (var i = 0; i < data.files.length; i++) { - text += "
  • /" + utils.escapeHtml(data.files[i]) + "
  • "; + text += "
  • " + utils.escapeHtml(data.files[i]) + "
  • "; } text += "

"; From c0dd62fdbdf5812e81245e8bd1d3f656db03bae9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 20 Nov 2023 19:59:36 +0100 Subject: [PATCH 03/26] There is no API token any longer, leaking the password hash in a public place is probably safe (you should still prevent this from happening) Signed-off-by: DL6ER --- settings-teleporter.lp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings-teleporter.lp b/settings-teleporter.lp index e33e53e3..5743d37b 100644 --- a/settings-teleporter.lp +++ b/settings-teleporter.lp @@ -20,8 +20,8 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')

Export your Pi-hole's configuration

-

Warning: This archive contains sensitive information about your Pi-hole installation, e.g. the API token and the 2FA-TOTP secret (if enabled). Please be careful with this file and do not share it with anyone even if they claim to help you.

-

Warning: You are currently not using an end-to-end encryption. This means that your API token and 2FA-TOTP secret will be transmitted in plain text. We recommend to use HTTPS when exporting your configuration.

+

Warning: This archive contains sensitive information about your Pi-hole installation, e.g. your 2FA-TOTP secret (if enabled). Please be careful with this file and do not share it with anyone even if they claim to help you.

+

Warning: You are currently not using an end-to-end encryption. This means that secrets like your 2FA-TOTP secret will be transmitted in plain text. We recommend to use HTTPS when exporting your configuration.

-

Conditional forwarding

+

Conditional forwarding

@@ -87,36 +87,8 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r') in your DHCP server for this to work. You can likely find it within the DHCP settings.

Enabling Conditional Forwarding will also forward all hostnames (i.e., non-FQDNs) to the router when "Never forward non-FQDNs" is not enabled.

-
-
- - -
-
- - - - - - - - - - - - - - - -
Local network in CIDR notationIP address of your DHCP server (router)Local domain name (optional)
- - - - - -
-
-
+

The following list contains all reverse servers you want to add. The expected format is one server per line in form of <enabled>,<ip-address>[/<prefix-len>],<server>[#<port>][,<domain>]. A valid config line could look like true,192.168.0.0/24,192.168.0.1,fritz.box

+
From 05ff5647bd920e7b5b0dd7957d390def99e8d193 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 1 Dec 2023 12:49:09 +0100 Subject: [PATCH 05/26] Rearrange items on Settings -> DNS page Signed-off-by: DL6ER --- settings-dns.lp | 132 ++++++++++++++++++++++++------------------------ 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/settings-dns.lp b/settings-dns.lp index da85d16b..98395af5 100644 --- a/settings-dns.lp +++ b/settings-dns.lp @@ -57,38 +57,50 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
-
+
-

Conditional forwarding

+

DNS domain settings

+
+
+
+
+ +
+
+
Domain
+ +
+
+

The DNS domains for your Pi-hole. If no domain is specified and you are using Pi-hole's DHCP server, then any hostnames with a domain part (i.e., with a period) will be disallowed. If a domain is specified, then hostnames with a domain parts matching the domain here are allowed. In addition, when a suffix is set then hostnames without a domain part have the suffix added as an optional domain part.

+
+ + +

If set, the domain is added to simple names (without a period) in /etc/hosts in the same way as for DHCP-derived names.

+
+
+
+
+
+
+
+

Rate-limiting

-

If not configured as your DHCP server, Pi-hole typically won't be able to - determine the names of devices on your local network. As a - result, tables such as Top Clients will only show IP addresses.

-

One solution for this is to configure Pi-hole to forward these - requests to your DHCP server (most likely your router), but only for devices on your - home network. To configure this we will need to know the IP - address of your DHCP server and which addresses belong to your local network. - Exemplary input is given below as placeholder in the text boxes (if empty).

-

If your local network spans 192.168.0.1 - 192.168.0.255, then you will have to input - 192.168.0.0/24. If your local network is 192.168.47.1 - 192.168.47.255, it will - be 192.168.47.0/24 and similar. If your network is larger, the CIDR has to be - different, for instance a range of 10.8.0.1 - 10.8.255.255 results in 10.8.0.0/16, - whereas an even wider network of 10.0.0.1 - 10.255.255.255 results in 10.0.0.0/8. - Setting up IPv6 ranges is exactly similar to setting up IPv4 here and fully supported. - Feel free to reach out to us on our - Discourse forum - in case you need any assistance setting up local host name resolution for your particular system.

-

You can also specify a local domain name (like fritz.box) to ensure queries to - devices ending in your local domain name will not leave your network, however, this is optional. - The local domain name must match the domain name specified - in your DHCP server for this to work. You can likely find it within the DHCP settings.

-

Enabling Conditional Forwarding will also forward all hostnames (i.e., non-FQDNs) to the router - when "Never forward non-FQDNs" is not enabled.

-

The following list contains all reverse servers you want to add. The expected format is one server per line in form of <enabled>,<ip-address>[/<prefix-len>],<server>[#<port>][,<domain>]. A valid config line could look like true,192.168.0.0/24,192.168.0.1,fritz.box

- +

Block clients making more than queries within + seconds.

+

When a client makes too many queries in too short time, it + gets rate-limited. Rate-limited queries are answered with a + REFUSED reply and not further processed by FTL + and prevent Pi-holes getting overwhelmed by rogue clients. + It is important to note that rate-limiting is happening on a + per-client basis. Other clients can continue to use FTL while + rate-limited clients are short-circuited at the same time.

+

Rate-limiting may be disabled altogether by setting both + values to zero. See + our documentation + for further details.

@@ -136,30 +148,6 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
-
-
-

DNS domain settings

-
-
-
-
- -
-
-
Domain
- -
-
-

The DNS domains for your Pi-hole. If no domain is specified and you are using Pi-hole's DHCP server, then any hostnames with a domain part (i.e., with a period) will be disallowed. If a domain is specified, then hostnames with a domain parts matching the domain here are allowed. In addition, when a suffix is set then hostnames without a domain part have the suffix added as an optional domain part.

-
- - -

If set, the domain is added to simple names (without a period) in /etc/hosts in the same way as for DHCP-derived names.

-
-
-
-
-

Advanced DNS settings

@@ -205,26 +193,40 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
+ +
-

Rate-limiting

+

Conditional forwarding

-

Block clients making more than queries within - seconds.

-

When a client makes too many queries in too short time, it - gets rate-limited. Rate-limited queries are answered with a - REFUSED reply and not further processed by FTL - and prevent Pi-holes getting overwhelmed by rogue clients. - It is important to note that rate-limiting is happening on a - per-client basis. Other clients can continue to use FTL while - rate-limited clients are short-circuited at the same time.

-

Rate-limiting may be disabled altogether by setting both - values to zero. See - our documentation - for further details.

+

If not configured as your DHCP server, Pi-hole typically won't be able to + determine the names of devices on your local network. As a + result, tables such as Top Clients will only show IP addresses.

+

One solution for this is to configure Pi-hole to forward these + requests to your DHCP server (most likely your router), but only for devices on your + home network. To configure this we will need to know the IP + address of your DHCP server and which addresses belong to your local network. + Exemplary input is given below as placeholder in the text boxes (if empty).

+

If your local network spans 192.168.0.1 - 192.168.0.255, then you will have to input + 192.168.0.0/24. If your local network is 192.168.47.1 - 192.168.47.255, it will + be 192.168.47.0/24 and similar. If your network is larger, the CIDR has to be + different, for instance a range of 10.8.0.1 - 10.8.255.255 results in 10.8.0.0/16, + whereas an even wider network of 10.0.0.1 - 10.255.255.255 results in 10.0.0.0/8. + Setting up IPv6 ranges is exactly similar to setting up IPv4 here and fully supported. + Feel free to reach out to us on our + Discourse forum + in case you need any assistance setting up local host name resolution for your particular system.

+

You can also specify a local domain name (like fritz.box) to ensure queries to + devices ending in your local domain name will not leave your network, however, this is optional. + The local domain name must match the domain name specified + in your DHCP server for this to work. You can likely find it within the DHCP settings.

+

Enabling Conditional Forwarding will also forward all hostnames (i.e., non-FQDNs) to the router + when "Never forward non-FQDNs" is not enabled.

+

The following list contains all reverse servers you want to add. The expected format is one server per line in form of <enabled>,<ip-address>[/<prefix-len>],<server>[#<port>][,<domain>]. A valid config line could look like true,192.168.0.0/24,192.168.0.1,fritz.box

+
From 06516fb5140ff73f3eb69cda6e6c704f2014c8bd Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 1 Dec 2023 12:57:52 +0100 Subject: [PATCH 06/26] Ensure we replace all "\n" by "
" when showing descriptions Signed-off-by: DL6ER --- scripts/pi-hole/js/settings-advanced.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/settings-advanced.js b/scripts/pi-hole/js/settings-advanced.js index 5aad6bb6..e44ac256 100644 --- a/scripts/pi-hole/js/settings-advanced.js +++ b/scripts/pi-hole/js/settings-advanced.js @@ -54,7 +54,7 @@ function generateRow(topic, key, value) { : "") + "" + "

" + - utils.escapeHtml(value.description).replace("\n", "
") + + utils.escapeHtml(value.description).replaceAll("\n", "
") + "

" + "
" + '
' + From d5b51fecc074b23b265f3845079b89c4859c1e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 8 Dec 2023 21:44:03 +0100 Subject: [PATCH 07/26] Add query log handling of SPECIAL_DOMAIN 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/queries.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 8a9b1809..d1630a86 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -200,6 +200,12 @@ function parseQueryStatus(data) { buttontext = ''; break; + case "SPECIAL_DOMAIN": + colorClass = "text-red"; + icon = "fa-solid fa-ban"; + fieldtext = data.status; + buttontext = ""; + break; default: colorClass = "text-orange"; icon = "fa-solid fa-question"; From c5ab81248a4552f4248ca53fb674190fb3c7aa92 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 25 Dec 2023 05:31:56 +0100 Subject: [PATCH 08/26] Query Log: Show link to groups/lists page if applicable Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 77ceb4aa..7cf27043 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -278,15 +278,22 @@ function formatInfo(data) { var regexInfo = "", cnameInfo = ""; - if (data.regex_id !== null && data.regex_id > -1) { - var regexLink = - 'entry with ID ' + - data.regex_id + + if (data.list_id !== null && data.list_id !== -1) { + // Undo the negation of the list ID if this is an anti-/gravity match + const gravityMatch = data.list_id < -1; + const listID = gravityMatch ? -2 - data.list_id : data.list_id; + + var listLink = + '' + + (gravityMatch ? "list" : "domain") + + " ID " + + listID + ""; regexInfo = - divStart + "Query was " + queryStatus.matchText + " by " + regexLink + "
"; + divStart + "Query was " + queryStatus.matchText + " by " + listLink + "
"; } if (queryStatus.isCNAME) { From 0076e32ada1852afd4e941d6923584a1e557cb60 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 27 Dec 2023 20:38:23 +0100 Subject: [PATCH 09/26] Ensure blocking mode timer is started even when set via a third-party API call Signed-off-by: DL6ER --- scripts/pi-hole/js/footer.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index d85f6fe7..39239b5c 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -39,10 +39,16 @@ function secondsTimeSpanToHMS(s) { return h + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s); //zero padding on minutes and seconds } -function piholeChanged(blocking) { - var status = $("#status"); - var ena = $("#pihole-enable"); - var dis = $("#pihole-disable"); +function piholeChanged(blocking, timer = null) { + const status = $("#status"); + const ena = $("#pihole-enable"); + const dis = $("#pihole-disable"); + const enaT = $("#enableTimer"); + + if (timer !== null && parseFloat(timer) > 0) { + enaT.html(Date.now() + parseFloat(timer) * 1000); + setTimeout(countDown, 100); + } switch (blocking) { case "enabled": { @@ -83,7 +89,7 @@ function piholeChanged(blocking) { function countDown() { var ena = $("#enableLabel"); var enaT = $("#enableTimer"); - var target = new Date(parseInt(enaT.html(), 10)); + var target = new Date(parseInt(enaT.text(), 10)); var seconds = Math.round((target.getTime() - Date.now()) / 1000); //Stop and remove timer when user enabled early @@ -97,7 +103,7 @@ function countDown() { ena.text("Enable Blocking (" + secondsTimeSpanToHMS(seconds) + ")"); } else { ena.text("Enable Blocking"); - piholeChanged("enabled"); + piholeChanged("enabled", null); if (localStorage) { localStorage.removeItem("countDownTarget"); } @@ -116,7 +122,7 @@ function checkBlocking() { method: "GET", }) .done(function (data) { - piholeChanged(data.blocking); + piholeChanged(data.blocking, data.timer); utils.setTimer(checkBlocking, REFRESH_INTERVAL.blocking); }) .fail(function (data) { @@ -126,8 +132,7 @@ function checkBlocking() { } function piholeChange(action, duration) { - var enaT = $("#enableTimer"); - var btnStatus; + let btnStatus = null; switch (action) { case "enable": @@ -155,11 +160,7 @@ function piholeChange(action, duration) { .done(function (data) { if (data.blocking === action + "d") { btnStatus.html(""); - piholeChanged(data.blocking); - if (duration > 0) { - enaT.html(Date.now() + duration * 1000); - setTimeout(countDown, 100); - } + piholeChanged(data.blocking, data.timer); } }) .fail(function (data) { From b48652ad82b8a031ee282688353139d9eaaa1504 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 6 Jan 2024 09:28:32 +0100 Subject: [PATCH 10/26] Fix group editing Signed-off-by: DL6ER --- scripts/pi-hole/js/groups.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/pi-hole/js/groups.js b/scripts/pi-hole/js/groups.js index e1c4fcd9..4f9cb8d3 100644 --- a/scripts/pi-hole/js/groups.js +++ b/scripts/pi-hole/js/groups.js @@ -7,8 +7,7 @@ /* global utils:false, apiFailure:false, updateFtlInfo:false, processGroupResult:false, delGroupItems:false */ -var table, - idNames = {}; +var table; function handleAjaxError(xhr, textStatus) { if (textStatus === "timeout") { @@ -73,20 +72,20 @@ $(function () { "\nDatabase ID: " + data.id; $("td:eq(1)", row).html( - '' + '' ); - var nameEl = $("#name_" + data.id, row); + var nameEl = $("#name_" + dataId, row); nameEl.val(data.name); nameEl.on("change", editGroup); $("td:eq(2)", row).html( '" ); - var enabledEl = $("#enabled_" + data.id, row); + var enabledEl = $("#enabled_" + dataId, row); enabledEl.bootstrapToggle({ on: "Enabled", off: "Disabled", @@ -96,9 +95,9 @@ $(function () { }); enabledEl.on("change", editGroup); - $("td:eq(3)", row).html(''); + $("td:eq(3)", row).html(''); var comment = data.comment !== null ? data.comment : ""; - var commentEl = $("#comment_" + data.id, row); + var commentEl = $("#comment_" + dataId, row); commentEl.val(comment); commentEl.on("change", editGroup); @@ -292,7 +291,7 @@ function editGroup() { const elem = $(this).attr("id"); const tr = $(this).closest("tr"); const id = tr.attr("data-id"); - const oldName = idNames[id]; + const oldName = utils.hexDecode(id); const name = tr.find("#name_" + id).val(); const enabled = tr.find("#enabled_" + id).is(":checked"); const comment = tr.find("#comment_" + id).val(); From a53086e0c56fd15a5f7445d68f5bf834be2ad794 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 8 Jan 2024 20:33:29 +0100 Subject: [PATCH 11/26] Fix deletion of addresses with spaces in them by avoiding encoding to "application/x-www-form-urlencoded" Signed-off-by: DL6ER --- scripts/pi-hole/js/groups-common.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pi-hole/js/groups-common.js b/scripts/pi-hole/js/groups-common.js index 653b72cf..86e84524 100644 --- a/scripts/pi-hole/js/groups-common.js +++ b/scripts/pi-hole/js/groups-common.js @@ -66,6 +66,7 @@ function delGroupItems(type, ids, table) { $.ajax({ url: url, data: JSON.stringify(ids), + contentType: "application/json", method: "POST", }) .done(function () { From 07aaa443ed4f0cead2470ce4597e1302114d9f86 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Thu, 11 Jan 2024 21:07:11 +0100 Subject: [PATCH 12/26] Apply red background color to special domains in query log Co-authored-by: RD WebDesign Signed-off-by: yubiuser --- scripts/pi-hole/js/queries.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index d1630a86..d7d065c6 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -205,6 +205,7 @@ function parseQueryStatus(data) { icon = "fa-solid fa-ban"; fieldtext = data.status; buttontext = ""; + blocked = true; break; default: colorClass = "text-orange"; From 63a4a67cfec7f56bd15cb6716cc28cef65101138 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Jan 2024 10:35:35 +0000 Subject: [PATCH 13/26] Bump prettier from 3.1.1 to 3.2.1 Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.1) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index add32b2e..c8869aa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.33", "postcss-cli": "^11.0.0", - "prettier": "^3.1.1", + "prettier": "^3.2.1", "xo": "^0.56.0" } }, @@ -5861,9 +5861,9 @@ } }, "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.1.tgz", + "integrity": "sha512-qSUWshj1IobVbKc226Gw2pync27t0Kf0EdufZa9j7uBSJay1CC+B3K5lAAZoqgX3ASiKuWsk6OmzKRetXNObWg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 8596316b..0cf4216a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.33", "postcss-cli": "^11.0.0", - "prettier": "^3.1.1", + "prettier": "^3.2.1", "xo": "^0.56.0" }, "browserslist": [ From bac88f1fc27aea2b894d077db235b2c49d8d109c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 14 Jan 2024 07:30:11 +0100 Subject: [PATCH 14/26] Use replaceAll to ensure all newlines are converted to HTML line breaks Signed-off-by: DL6ER --- scripts/pi-hole/js/settings-advanced.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/settings-advanced.js b/scripts/pi-hole/js/settings-advanced.js index d56c56ea..76ed6e7e 100644 --- a/scripts/pi-hole/js/settings-advanced.js +++ b/scripts/pi-hole/js/settings-advanced.js @@ -54,7 +54,7 @@ function generateRow(topic, key, value) { : "") + "" + "

" + - utils.escapeHtml(value.description).replace("\n", "
") + + utils.escapeHtml(value.description).replaceAll("\n", "
") + "

" + "" + '
' + From a35d4f0e9d1cadd7e0c73b6fcf62083b6a1f30ef Mon Sep 17 00:00:00 2001 From: Andrej Vano Date: Wed, 17 Jan 2024 14:36:16 +0100 Subject: [PATCH 15/26] [Typo] Fix typo in checkMessages warning Signed-off-by: Andrej Vano --- 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 038ab1a4..9a6c20de 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -391,7 +391,7 @@ function checkMessages() { }) .done(function (data) { if (data.count > 0) { - var more = '\nAccess "Tools/Pi-hole diganosis" for further details.'; + var more = '\nAccess "Tools/Pi-hole diagnosis" for further details.'; var title = data.count > 1 ? "There are " + data.count + " warnings." + more From dee7c2bb67b260e7f873146d9958c7b403937535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 19 Jan 2024 22:21:37 +0100 Subject: [PATCH 16/26] Add regex hint to domain/client exclusion box MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- settings-api.lp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/settings-api.lp b/settings-api.lp index 6448ddf9..ace817d3 100644 --- a/settings-api.lp +++ b/settings-api.lp @@ -24,14 +24,19 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
-

Domains to be excluded from Top Domains / Ads Lists

- -

Domains may be described by their domain name (like example.com)

+

Domains to be excluded from Top Domain Lists and Query Log

+ +

Domains may be described by their domain name (like ^example\.com$)

-

Clients to be excluded from Top Clients List

- -

Clients may be described either by their IP addresses (IPv4 and IPv6 are supported), or hostnames (like laptop.lan).

+

Clients to be excluded from Top Client Lists and Query Log

+ +

Clients may be described either by their IP addresses (IPv4 and IPv6 are supported), or hostnames (like ^laptop\.lan$).

+
+
+
+
+

Important: Those input fields accept regex entries only. Please refer to our guide how to construct valid regex entries.

From 04ea62bf78fc3954bdf725e1a6e2273405250d7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jan 2024 10:25:35 +0000 Subject: [PATCH 17/26] Bump prettier from 3.2.1 to 3.2.4 Bumps [prettier](https://github.com/prettier/prettier) from 3.2.1 to 3.2.4. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.2.1...3.2.4) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c8869aa7..3859cac7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.33", "postcss-cli": "^11.0.0", - "prettier": "^3.2.1", + "prettier": "^3.2.4", "xo": "^0.56.0" } }, @@ -5861,9 +5861,9 @@ } }, "node_modules/prettier": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.1.tgz", - "integrity": "sha512-qSUWshj1IobVbKc226Gw2pync27t0Kf0EdufZa9j7uBSJay1CC+B3K5lAAZoqgX3ASiKuWsk6OmzKRetXNObWg==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 0cf4216a..55df74c0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.33", "postcss-cli": "^11.0.0", - "prettier": "^3.2.1", + "prettier": "^3.2.4", "xo": "^0.56.0" }, "browserslist": [ From a5e10fbbe320eeab770f46cbcb55eff2061d74c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jan 2024 10:26:04 +0000 Subject: [PATCH 18/26] Bump autoprefixer from 10.4.16 to 10.4.17 Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.4.16 to 10.4.17. - [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.16...10.4.17) --- 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 c8869aa7..245fb7ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "select2": "4.0.13" }, "devDependencies": { - "autoprefixer": "^10.4.16", + "autoprefixer": "^10.4.17", "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.33", "postcss-cli": "^11.0.0", @@ -1318,9 +1318,9 @@ } }, "node_modules/autoprefixer": { - "version": "10.4.16", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", - "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", + "version": "10.4.17", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.17.tgz", + "integrity": "sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==", "dev": true, "funding": [ { @@ -1337,9 +1337,9 @@ } ], "dependencies": { - "browserslist": "^4.21.10", - "caniuse-lite": "^1.0.30001538", - "fraction.js": "^4.3.6", + "browserslist": "^4.22.2", + "caniuse-lite": "^1.0.30001578", + "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", "postcss-value-parser": "^4.2.0" @@ -1771,9 +1771,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001572", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001572.tgz", - "integrity": "sha512-1Pbh5FLmn5y4+QhNyJE9j3/7dK44dGB83/ZMjv/qJk86TvDbjk0LosiZo0i0WB0Vx607qMX9jYrn1VLHCkN4rw==", + "version": "1.0.30001579", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001579.tgz", + "integrity": "sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 0cf4216a..0fc02ff5 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "testpr": "npm run prettier:fix && git diff --ws-error-highlight=all --color=always --exit-code && npm run xo:check" }, "devDependencies": { - "autoprefixer": "^10.4.16", + "autoprefixer": "^10.4.17", "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.33", "postcss-cli": "^11.0.0", From c480e0343d58a020bde1497189fe4eafb1c2d3f2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 26 Jan 2024 16:22:11 +0100 Subject: [PATCH 19/26] Fix interpretation of lease expiration field in case it is 0. This does not mean 1st of January 1970 but really a never expiring lease Signed-off-by: DL6ER --- scripts/pi-hole/js/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index 9a6c20de..54554538 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -152,6 +152,10 @@ function showAlert(type, icon, title, message) { } function datetime(date, html, humanReadable) { + if (date === 0 && humanReadable) { + return "Never"; + } + var format = html === false ? "Y-MM-DD HH:mm:ss z" : "Y-MM-DD []HH:mm:ss z"; var timestr = moment.unix(Math.floor(date)).format(format).trim(); return humanReadable From 64679c57cdbfcf5dd1de3d439f8b436aa7511eef Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 4 Feb 2024 11:18:10 +0100 Subject: [PATCH 20/26] Clarify what an empty netmask field does (Settings -> DHCP page) Signed-off-by: DL6ER --- settings-dhcp.lp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/settings-dhcp.lp b/settings-dhcp.lp index fd0a3b84..dedc8cf0 100644 --- a/settings-dhcp.lp +++ b/settings-dhcp.lp @@ -61,16 +61,19 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
- +
Netmask
+ autocorrect="off" value="" placeholder="automatic">
+
+

Leave the netmask field empty to have Pi-hole infer it from the configured IP address of your device. If you want to specify a netmask, you can use the format 255.255.255.0.

+
 

Enable this option to enable IPv6 support for the Pi-hole DHCP server. This will allow the Pi-hole to hand out IPv6 addresses to clients and also provide IPv6 router advertisements (RA) to clients. This option is only useful if the Pi-hole is configured with an IPv6 address.

From ab42f54367191de125bd3c5883943d3d7224a5fb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 6 Feb 2024 17:55:19 +0100 Subject: [PATCH 21/26] Show link to search page instead of to the list ID returned by the API. This is a better strategy in case a user has a certain domain on multiple lists. We intentionally don't submit on the search page to let the user decide if they want exact or partial matching Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 23 ++++++++--------------- scripts/pi-hole/js/search.js | 11 +++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 7cf27043..339b7d5b 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -276,24 +276,17 @@ function formatInfo(data) { "
"; } - var regexInfo = "", + var listInfo = "", cnameInfo = ""; if (data.list_id !== null && data.list_id !== -1) { - // Undo the negation of the list ID if this is an anti-/gravity match - const gravityMatch = data.list_id < -1; - const listID = gravityMatch ? -2 - data.list_id : data.list_id; + // Some list matched - add link to search page var listLink = - '' + - (gravityMatch ? "list" : "domain") + - " ID " + - listID + - ""; - regexInfo = - divStart + "Query was " + queryStatus.matchText + " by " + listLink + ""; + 'search lists'; + listInfo = + divStart + 'Query was ' + queryStatus.matchText + ', ' + listLink + ""; } if (queryStatus.isCNAME) { @@ -356,7 +349,7 @@ function formatInfo(data) { dnssecInfo + statusInfo + cnameInfo + - regexInfo + + listInfo + ttlInfo + replyInfo + dbInfo + diff --git a/scripts/pi-hole/js/search.js b/scripts/pi-hole/js/search.js index 26875241..3e2eca7a 100644 --- a/scripts/pi-hole/js/search.js +++ b/scripts/pi-hole/js/search.js @@ -6,6 +6,17 @@ * Please see LICENSE file for your rights under this license. */ /* global utils:false, apiFailure:false */ +var GETDict = {}; + +$(function () { + GETDict = utils.parseQueryString(); + if (GETDict.domain !== undefined) { + $("input[id^='domain']").val(GETDict.domain); + } + if (GETDict.N !== undefined) { + $("#number").val(GETDict.number); + } +}); function eventsource(partial) { const ta = $("#output"); From 5f79611e96a809f50520aa8c31cc1340e38f24d0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 6 Feb 2024 17:56:32 +0100 Subject: [PATCH 22/26] Fix search output unintentionally broken in 7d2e83cbc42f1e63d5c5b00ebd2835b640f2895a Signed-off-by: DL6ER --- style/pi-hole.css | 5 ++++- taillog.lp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/style/pi-hole.css b/style/pi-hole.css index c60ed9bc..4be5c580 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -1075,12 +1075,15 @@ table.dataTable tbody > tr > .selected { #output { position: relative; - display: grid; margin: 5px 0; min-height: 36px; padding: 4px 8px; } +#output.pre-taillog { + display: grid; +} + .loading::before { content: " "; position: absolute; diff --git a/taillog.lp b/taillog.lp index 0514ccc6..4d0aa487 100644 --- a/taillog.lp +++ b/taillog.lp @@ -25,7 +25,7 @@ mg.include('scripts/pi-hole/lua/header_authenticated.lp','r')
-

+                        

                     
From a0ddfe69a2b2d8d1b613d0da05eaae445ab3ed48 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 6 Feb 2024 18:01:03 +0100 Subject: [PATCH 23/26] Format changes Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 3 +-- scripts/pi-hole/js/search.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 339b7d5b..84da33e6 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -285,8 +285,7 @@ function formatInfo(data) { 'search lists'; - listInfo = - divStart + 'Query was ' + queryStatus.matchText + ', ' + listLink + ""; + listInfo = divStart + "Query was " + queryStatus.matchText + ", " + listLink + ""; } if (queryStatus.isCNAME) { diff --git a/scripts/pi-hole/js/search.js b/scripts/pi-hole/js/search.js index 3e2eca7a..dae432ec 100644 --- a/scripts/pi-hole/js/search.js +++ b/scripts/pi-hole/js/search.js @@ -13,6 +13,7 @@ $(function () { if (GETDict.domain !== undefined) { $("input[id^='domain']").val(GETDict.domain); } + if (GETDict.N !== undefined) { $("#number").val(GETDict.number); } From ac2ceb691f4f00f5bfc8db1b1540baddc0b66f96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 10:44:13 +0000 Subject: [PATCH 24/26] Bump postcss from 8.4.33 to 8.4.35 Bumps [postcss](https://github.com/postcss/postcss) from 8.4.33 to 8.4.35. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.4.33...8.4.35) --- updated-dependencies: - dependency-name: postcss dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 45ea007d..1f3f9e47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "devDependencies": { "autoprefixer": "^10.4.17", "eslint-plugin-compat": "^4.2.0", - "postcss": "^8.4.33", + "postcss": "^8.4.35", "postcss-cli": "^11.0.0", "prettier": "^3.2.4", "xo": "^0.56.0" @@ -5734,9 +5734,9 @@ } }, "node_modules/postcss": { - "version": "8.4.33", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", - "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 9b80a6a4..52b50fe0 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "devDependencies": { "autoprefixer": "^10.4.17", "eslint-plugin-compat": "^4.2.0", - "postcss": "^8.4.33", + "postcss": "^8.4.35", "postcss-cli": "^11.0.0", "prettier": "^3.2.4", "xo": "^0.56.0" From de5ec8f19298fa9537fb65641ec249ef5b1b3d04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 10:50:16 +0000 Subject: [PATCH 25/26] Bump actions/setup-node from 4.0.1 to 4.0.2 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.0.1 to 4.0.2. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v4.0.1...v4.0.2) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 748ef4b2..1a850543 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v4.1.1 - name: Set up Node.js - uses: actions/setup-node@v4.0.1 + uses: actions/setup-node@v4.0.2 with: node-version: "20.x" cache: npm From 285876c263c0b2e96eba8f08aac1eef14d39eeab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 11:50:46 +0000 Subject: [PATCH 26/26] Bump prettier from 3.2.4 to 3.2.5 Bumps [prettier](https://github.com/prettier/prettier) from 3.2.4 to 3.2.5. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.2.4...3.2.5) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1f3f9e47..005b1ad3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.35", "postcss-cli": "^11.0.0", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "xo": "^0.56.0" } }, @@ -5861,9 +5861,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 52b50fe0..fb4376be 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "eslint-plugin-compat": "^4.2.0", "postcss": "^8.4.35", "postcss-cli": "^11.0.0", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "xo": "^0.56.0" }, "browserslist": [