From c45bcd9d8e5b8eab245d6338bf239140d9618592 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 May 2020 11:22:47 +0200 Subject: [PATCH 1/3] Add support for HOSTNAME diagnostics message Signed-off-by: DL6ER --- scripts/pi-hole/js/messages.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js index 124a69e2..92932091 100644 --- a/scripts/pi-hole/js/messages.js +++ b/scripts/pi-hole/js/messages.js @@ -57,6 +57,24 @@ function renderMessage(data, type, row) { " to get the group configuration for this client." ); + case "HOSTNAME": + var hint = ""; + for (var i = 0; i < row.blob2 + row.message.length + 2; i++) hint += " "; + return ( + "Host names contains invalid character " + + decodeURIComponent(escape(row.blob1))[row.blob2] + + ":
" +
+        hint +
+        "↓\n" +
+        row.message +
+        ": " +
+        decodeURIComponent(escape(row.blob1)) +
+        "\n" +
+        hint +
+        "↑" +
+        "
" + ); + default: return "Unknown message type
" + JSON.stringify(row) + "
"; } From 1df85ff7a9e6bd194eed97b9985de7f8c4f64365 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 May 2020 20:34:05 +0200 Subject: [PATCH 2/3] Simplify code for space generation and use HTML entities. Signed-off-by: DL6ER --- scripts/pi-hole/js/messages.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js index 92932091..d9281de0 100644 --- a/scripts/pi-hole/js/messages.js +++ b/scripts/pi-hole/js/messages.js @@ -65,14 +65,13 @@ function renderMessage(data, type, row) { decodeURIComponent(escape(row.blob1))[row.blob2] + ":
" +
         hint +
-        "↓\n" +
+        "↓\n" +
         row.message +
         ": " +
         decodeURIComponent(escape(row.blob1)) +
         "\n" +
         hint +
-        "↑" +
-        "
" + "↑" ); default: From 075c474fbc626b1ce8e40bc74c197a4415dcdcea Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 3 Jun 2020 20:32:55 +0100 Subject: [PATCH 3/3] Use new Array().join() for space generation. Signed-off-by: Adam Warner --- scripts/pi-hole/js/messages.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js index d9281de0..a3010a24 100644 --- a/scripts/pi-hole/js/messages.js +++ b/scripts/pi-hole/js/messages.js @@ -58,10 +58,9 @@ function renderMessage(data, type, row) { ); case "HOSTNAME": - var hint = ""; - for (var i = 0; i < row.blob2 + row.message.length + 2; i++) hint += " "; + var hint = new Array(row.blob2 + row.message.length + 3).join(" "); return ( - "Host names contains invalid character " + + "Hostname contains invalid character " + decodeURIComponent(escape(row.blob1))[row.blob2] + ":
" +
         hint +