From e5ce53446c228032fc9e4aaf8efdb044cfeb031a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Wed, 7 Sep 2022 21:43:28 +0200 Subject: [PATCH 01/12] Do not apply IDNA conversion to regex domains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- scripts/pi-hole/php/groups.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/php/groups.php b/scripts/pi-hole/php/groups.php index 8ba2552d6..5a12138e5 100644 --- a/scripts/pi-hole/php/groups.php +++ b/scripts/pi-hole/php/groups.php @@ -596,14 +596,15 @@ function verify_ID_array($arr) continue; } - $input = $domain; - // Convert domain name to IDNA ASCII form for international domains - // Skip this for the root zone `.` - if ($domain != '.') { - $domain = convertUnicodeToIDNA($domain); - } if ($_POST['type'] != '2' && $_POST['type'] != '3') { - // If not adding a RegEx, we convert the domain lower case and check whether it is valid + // If not adding a RegEx.... + $input = $domain; + // Convert domain name to IDNA ASCII form for international domains + // Skip this for the root zone `.` + if ($domain != '.') { + $domain = convertUnicodeToIDNA($domain); + } + // convert the domain lower case and check whether it is valid $domain = strtolower($domain); $msg = ''; if (!validDomain($domain, $msg)) { From b75ec4530cf74eb523f75208751bc40bc689e061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Thu, 1 Sep 2022 09:03:15 +0200 Subject: [PATCH 02/12] Add interpretation for Pi-hole message type ADLIST 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 | 25 +++++++++++++++++++++++++ scripts/pi-hole/js/messages.js | 13 +++++++++++++ 2 files changed, 38 insertions(+) diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js index 452c6aedf..e8e9cb2c5 100644 --- a/scripts/pi-hole/js/groups-adlists.js +++ b/scripts/pi-hole/js/groups-adlists.js @@ -10,6 +10,7 @@ var table; var groups = []; var token = $("#token").text(); +var GETDict = {}; function getGroups() { $.post( @@ -24,6 +25,13 @@ function getGroups() { } $(function () { + window.location.search + .substr(1) + .split("&") + .forEach(function (item) { + GETDict[item.split("=")[0]] = item.split("=")[1]; + }); + $("#btnAdd").on("click", addAdlist); utils.setBsSelectDefaults(); @@ -289,6 +297,11 @@ function initTable() { var applyBtn = "#btn_apply_" + data.id; + // Highlight row (if url parameter "adlistid=" is used) + if ("adlistid" in GETDict && data.id === parseInt(GETDict.adlistid, 10)) { + $(row).find("td").addClass("highlight"); + } + var button = '