From e8b2cbe69863373e212ab434852024eec9f6c8f8 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 30 Jun 2018 14:42:52 +0200 Subject: [PATCH] Tag regex filters as "regex" to avoid the domain validation (otherwise regex lines could not get removed). Also ensure that deleting the first wildcard/regex does not hide the first exact blocking domain (this bug has been in since the very beginning of wildcard blocking) Signed-off-by: DL6ER --- scripts/pi-hole/js/list.js | 11 ++++++----- scripts/pi-hole/php/sub.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js index 99e7be05..1ac0e294 100644 --- a/scripts/pi-hole/js/list.js +++ b/scripts/pi-hole/js/list.js @@ -13,13 +13,14 @@ var listType = $("#list-type").html(); var fullName = listType === "white" ? "Whitelist" : "Blacklist"; function sub(index, entry, arg) { - var domain = $("#"+index); + var domain = $("#list #"+index); var locallistType = listType; - domain.hide("highlight"); - if(arg === "wild") + if(arg === "regex") { - locallistType = "wild"; + locallistType = "regex"; + domain = $("#list-regex #"+index); } + domain.hide("highlight"); $.ajax({ url: "scripts/pi-hole/php/sub.php", method: "post", @@ -104,7 +105,7 @@ function refresh(fade) { ""); // Handle button $("#list-regex #"+index+"").on("click", "button", function() { - sub(index, entry, "wild"); + sub(index, entry, "regex"); }); }); } diff --git a/scripts/pi-hole/php/sub.php b/scripts/pi-hole/php/sub.php index ef2bb60d..d06d6537 100644 --- a/scripts/pi-hole/php/sub.php +++ b/scripts/pi-hole/php/sub.php @@ -21,7 +21,7 @@ switch($type) { case "black": exec("sudo pihole -b -q -d ${_POST['domain']}"); break; - case "wild": + case "regex": if(($list = file_get_contents($regexfile)) === FALSE) { $err = error_get_last()["message"];