diff --git a/gravity.php b/gravity.php
index d86be424..b73cf514 100644
--- a/gravity.php
+++ b/gravity.php
@@ -15,7 +15,7 @@
- Updating...
+ Updating...this may take a while. Please do not navigate away from or close this page.
diff --git a/groups-adlists.php b/groups-adlists.php
index 49ddb58b..1884c18d 100644
--- a/groups-adlists.php
+++ b/groups-adlists.php
@@ -37,6 +37,7 @@
diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js
index 58c64cd2..118ba9ac 100644
--- a/scripts/pi-hole/js/queries.js
+++ b/scripts/pi-hole/js/queries.js
@@ -170,7 +170,8 @@ $(document).ready(function() {
fieldtext,
buttontext,
colorClass,
- isCNAME = false;
+ isCNAME = false,
+ regexLink = false;
switch (data[4]) {
case "1":
@@ -199,15 +200,8 @@ $(document).ready(function() {
colorClass = "text-red";
fieldtext = "Blocked
(regex blacklist)";
- if (data.length > 9 && data[9] > -1) {
- fieldtext =
- "" +
- fieldtext +
- ' ';
+ if (data.length > 9 && data[9] > 0) {
+ regexLink = true;
}
buttontext =
@@ -250,6 +244,11 @@ $(document).ready(function() {
blocked = true;
colorClass = "text-red";
fieldtext = "Blocked
(regex blacklist, CNAME)";
+
+ if (data.length > 9 && data[9] > 0) {
+ regexLink = true;
+ }
+
buttontext =
'';
isCNAME = true;
@@ -273,6 +272,26 @@ $(document).ready(function() {
$("td:eq(4)", row).html(fieldtext);
$("td:eq(6)", row).html(buttontext);
+ if (regexLink) {
+ $("td:eq(4)", row).hover(
+ function() {
+ this.title = "Click to show matching regex filter";
+ this.style.color = "#72afd2";
+ },
+ function() {
+ this.style.color = "";
+ }
+ );
+ $("td:eq(4)", row).click(function() {
+ var new_tab = window.open("groups-domains.php?domainid=" + data[9], "_blank");
+ if (new_tab) {
+ new_tab.focus();
+ }
+ });
+ $("td:eq(4)", row).addClass("underline");
+ $("td:eq(4)", row).addClass("pointer");
+ }
+
// Add domain in CNAME chain causing the query to have been blocked
var domain = data[2];
var CNAME_domain = data[8];
@@ -478,10 +497,10 @@ $(document).ready(function() {
$("#all-queries tbody").on("click", "button", function() {
var data = tableApi.row($(this).parents("tr")).data();
- if (data[4] === "1" || data[4] === "4" || data[4] === "5") {
- add(data[2], "white");
- } else {
+ if (data[4] === "2" || data[4] === "3") {
add(data[2], "black");
+ } else {
+ add(data[2], "white");
}
});
diff --git a/scripts/pi-hole/php/add.php b/scripts/pi-hole/php/add.php
index 1866ebed..1eb6b8d1 100644
--- a/scripts/pi-hole/php/add.php
+++ b/scripts/pi-hole/php/add.php
@@ -21,9 +21,12 @@ $domains = preg_split('/\s+/', trim($_POST['domain']));
$comment = trim($_POST['comment']);
// Convert domain name to IDNA ASCII form for international domains
-foreach($domains as &$domain)
-{
- $domain = idn_to_ascii($domain);
+// Do this only for exact domains, not for regex filters
+if ($list === "white" || $list === "black") {
+ foreach($domains as &$domain)
+ {
+ $domain = idn_to_ascii($domain);
+ }
}
// Only check domains we add to the exact lists.
diff --git a/scripts/pi-hole/php/groups.php b/scripts/pi-hole/php/groups.php
index d5b42817..00f5268c 100644
--- a/scripts/pi-hole/php/groups.php
+++ b/scripts/pi-hole/php/groups.php
@@ -352,12 +352,14 @@ if ($_POST['action'] == 'get_groups') {
array_push($groups, $gres['group_id']);
}
$res['groups'] = $groups;
- $utf8_domain = idn_to_utf8($res['domain']);
- // Convert domain name to international form
- // if applicable
- if($res['domain'] !== $utf8_domain)
- {
- $res['domain'] = $utf8_domain.' ('.$res['domain'].')';
+ if ($res['type'] === ListType::whitelist || $res['type'] === ListType::blacklist) {
+ $utf8_domain = idn_to_utf8($res['domain']);
+ // Convert domain name to international form
+ // if applicable
+ if($res['domain'] !== $utf8_domain)
+ {
+ $res['domain'] = $utf8_domain.' ('.$res['domain'].')';
+ }
}
array_push($data, $res);
}
@@ -375,7 +377,7 @@ if ($_POST['action'] == 'get_groups') {
throw new Exception('While preparing statement: ' . $db->lastErrorMsg());
}
- $type = intval($_POST['type'][0]);
+ $type = intval($_POST['type']);
$domain = $_POST['domain'];
if(strlen($_POST['type']) === 2 && $_POST['type'][1] === 'W')
@@ -384,12 +386,12 @@ if ($_POST['action'] == 'get_groups') {
$domain = "(\\.|^)".str_replace(".","\\.",$domain)."$";
}
- if($type === ListType::whitelist || $type === ListType::blacklist)
- {
- // Convert domain name to IDNA ASCII form for international domains
- $domain = idn_to_ascii($domain);
- // If adding to the exact lists, we convert the domain lower case and check whether it is valid
- $domain = strtolower($domain);
+ if ($type === ListType::whitelist || $type === ListType::blacklist) {
+ // Convert domain name to IDNA ASCII form for international
+ // domains and convert the domain to lower case
+ $domain = strtolower(idn_to_ascii($domain));
+
+ // Check validity of domain
if(filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false)
{
throw new Exception('Domain ' . htmlentities(utf8_encode($domain)) . 'is not a valid domain.');
diff --git a/style/pi-hole.css b/style/pi-hole.css
index 827e3788..8320bdc0 100644
--- a/style/pi-hole.css
+++ b/style/pi-hole.css
@@ -253,3 +253,11 @@ code.breakall
word-break: break-all;
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
+
+.underline {
+ text-decoration: underline;
+}
+
+.pointer {
+ cursor: pointer;
+}