diff --git a/package.json b/package.json
index b276f5ea..dc66de04 100644
--- a/package.json
+++ b/package.json
@@ -19,9 +19,10 @@
"prettier:check": "prettier -l \"style/*.css\" \"style/themes/*.css\" \"scripts/pi-hole/**/*.js\"",
"prettier:fix": "prettier --write \"style/*.css\" \"style/themes/*.css\" \"scripts/pi-hole/**/*.js\"",
"xo": "xo",
- "xo:fix": "npm run xo -- --fix",
- "test": "npm run prettier:check && npm run xo",
- "testpr": "npm run prettier:fix && git diff --ws-error-highlight=all --color=always --exit-code && npm run xo"
+ "xo:check": "npm run xo -- \"style/*.css\" \"style/themes/*.css\" \"scripts/pi-hole/**\" \"*.php\"",
+ "xo:fix": "npm run xo -- --fix \"style/*.css\" \"style/themes/*.css\" \"scripts/pi-hole/**\" \"*.php\"",
+ "test": "npm run prettier:check && npm run xo:check",
+ "testpr": "npm run prettier:fix && git diff --ws-error-highlight=all --color=always --exit-code && npm run xo:check"
},
"devDependencies": {
"autoprefixer": "^10.4.13",
diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js
index dc952d34..50d582f1 100644
--- a/scripts/pi-hole/js/messages.js
+++ b/scripts/pi-hole/js/messages.js
@@ -7,7 +7,6 @@
/* global utils:false */
var table;
-var token = $("#token").text();
function renderTimestamp(data, type) {
// Display and search content
@@ -19,7 +18,7 @@ function renderTimestamp(data, type) {
return data;
}
-function htmlPass(data, type) {
+function htmlPass(data, _type) {
return data;
}
@@ -199,33 +198,28 @@ function deleteMessage() {
// Exploit prevention: Return early for non-numeric IDs
for (var id in ids) {
- if (Object.hasOwnProperty.call(ids, id) && typeof ids[id] !== "number") return;
- delMsg(ids);
+ if (Object.hasOwnProperty.call(ids, id)) {
+ if (typeof ids[id] !== "number") return;
+ delMsg(ids);
+ }
}
}
function delMsg(id) {
-
utils.disableAll();
utils.showAlert("info", "", "Deleting message...");
$.ajax({
url: "/api/info/messages/" + id,
- method: "DELETE"
+ method: "DELETE",
})
.done(function (response) {
utils.enableAll();
- console.log(response);
if (response === undefined) {
utils.showAlert("success", "far fa-trash-alt", "Successfully deleted message", "");
table.row(id).remove().draw(false).ajax.reload(null, false);
} else {
- utils.showAlert(
- "error",
- "",
- "Error while deleting message: " + id,
- response.message
- );
+ utils.showAlert("error", "", "Error while deleting message: " + id, response.message);
}
// Clear selection after deletion
@@ -237,12 +231,7 @@ function delMsg(id) {
)
.fail(function (jqXHR, exception) {
utils.enableAll();
- utils.showAlert(
- "error",
- "",
- "Error while deleting message: " + id,
- jqXHR.responseText
- );
+ utils.showAlert("error", "", "Error while deleting message: " + id, jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console
});
}
diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js
index 28769464..85f4b63f 100644
--- a/scripts/pi-hole/js/queries.js
+++ b/scripts/pi-hole/js/queries.js
@@ -16,7 +16,16 @@ var dateformat = "MMMM Do YYYY, HH:mm";
var table = null;
var cursor = null;
-var filters = ["client_ip", "client_name", "domain", "upstream", "type", "status", "reply", "dnssec"];
+var filters = [
+ "client_ip",
+ "client_name",
+ "domain",
+ "upstream",
+ "type",
+ "status",
+ "reply",
+ "dnssec",
+];
$(function () {
$("#querytime").daterangepicker(
@@ -33,21 +42,21 @@ $(function () {
Today: [moment().startOf("day"), moment().endOf("day")],
Yesterday: [
moment().subtract(1, "days").startOf("day"),
- moment().subtract(1, "days").endOf("day")
+ moment().subtract(1, "days").endOf("day"),
],
"Last 7 Days": [moment().subtract(6, "days"), moment().endOf("day")],
"Last 30 Days": [moment().subtract(29, "days"), moment().endOf("day")],
"This Month": [moment().startOf("month"), moment().endOf("month")],
"Last Month": [
moment().subtract(1, "month").startOf("month"),
- moment().subtract(1, "month").endOf("month")
+ moment().subtract(1, "month").endOf("month"),
],
"This Year": [moment().startOf("year"), moment().endOf("year")],
- "All Time": [moment(beginningOfTime), moment(endOfTime)]
+ "All Time": [moment(beginningOfTime), moment(endOfTime)],
},
opens: "center",
showDropdowns: true,
- autoUpdateInput: true
+ autoUpdateInput: true,
},
function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000;
@@ -79,28 +88,28 @@ function parseQueryStatus(data) {
switch (data.status) {
case "GRAVITY":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked (gravity)";
buttontext =
'';
break;
case "FORWARDED":
colorClass = "text-green";
- icon = "fa-solid fa-check";
+ icon = "fa-solid fa-upload";
fieldtext = "Forwarded to " + data.upstream;
buttontext =
'';
break;
case "CACHE":
colorClass = "text-green";
- icon = "fa-solid fa-check";
+ icon = "fa-regular fa-database";
fieldtext = "Cached";
buttontext =
'';
break;
case "REGEX":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(regex)";
regexLink = data.regex > 0;
buttontext =
@@ -108,32 +117,32 @@ function parseQueryStatus(data) {
break;
case "DENYLIST":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(exact)";
buttontext =
'';
break;
case "EXTERNAL_BLOCKED_IP":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(external, IP)";
buttontext = "";
break;
case "EXTERNAL_BLOCKED_NULL":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(external, NULL)";
buttontext = "";
break;
case "EXTERNAL_BLOCKED_NXRA":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(external, NXRA)";
buttontext = "";
break;
case "GRAVITY_CNAME":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked (gravity, CNAME)";
buttontext =
'';
@@ -141,7 +150,7 @@ function parseQueryStatus(data) {
break;
case "REGEX_CNAME":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(regex diened, CNAME)";
regexLink = data.regex > 0;
buttontext =
@@ -150,7 +159,7 @@ function parseQueryStatus(data) {
break;
case "DENYLIST_CNAME":
colorClass = "text-red";
- icon = "fa-solid fa-hand";
+ icon = "fa-solid fa-ban";
fieldtext = "Blocked
(exact diened, CNAME)";
buttontext =
'';
@@ -158,19 +167,19 @@ function parseQueryStatus(data) {
break;
case "RETRIED":
colorClass = "text-green";
- icon = "fa-solid fa-check";
+ icon = "fa-solid fa-redo"; // fa-repeat
fieldtext = "Retried";
buttontext = "";
break;
case "RETRIED_DNSSEC":
colorClass = "text-green";
- icon = "fa-solid fa-check";
+ icon = "fa-solid fa-redo"; // fa-repeat
fieldtext = "Retried
(ignored)";
buttontext = "";
break;
case "IN_PROGRESS":
colorClass = "text-green";
- icon = "fa-solid fa-check";
+ icon = "fa-solid fa-redo";
fieldtext = "OK
(already forwarded)";
buttontext =
'';
@@ -188,7 +197,7 @@ function parseQueryStatus(data) {
colorClass: colorClass,
icon: icon,
isCNAME: isCNAME,
- regexLink: regexLink
+ regexLink: regexLink,
};
}
@@ -209,7 +218,6 @@ function formatInfo(data) {
case "ABANDONED":
dnssecClass = "text-red";
break;
- case "UNKNOWN":
default:
// No DNSSEC or UNKNOWN
dnssecStatus = "N/A";
@@ -218,13 +226,17 @@ function formatInfo(data) {
// Parse Query Status
var queryStatus = parseQueryStatus(data);
+ var divStart = '
| Query received on: | ' +
- moment.unix(data.time).format("Y-MM-DD [ ]HH:mm:ss.SSS z") + - statusInfo + + ' ' +
+ divStart +
+ "Query received on: " +
+ moment.unix(data.time).format("Y-MM-DD HH:mm:ss.SSS z") +
+ " " +
clientInfo +
+ dnssecInfo +
+ statusInfo +
cnameInfo +
regexInfo +
ttlInfo +
- dnssecInfo +
replyInfo +
dbInfo +
- " |