From 448ce2ccb957dfb3e6034e1d2964b2b72daa2dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 30 Mar 2018 23:59:41 +0200 Subject: [PATCH] Revert "Escape html for weblog in the client" This reverts commit 8da3f54e9104cb3facd9c69794e04d4b0330d28d. --- code/espurna/debug.ino | 10 +++++++--- code/html/custom.css | 5 +---- code/html/custom.js | 2 +- code/html/index.html | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/code/espurna/debug.ino b/code/espurna/debug.ino index 6de5b098..554e3fdc 100644 --- a/code/espurna/debug.ino +++ b/code/espurna/debug.ino @@ -62,11 +62,15 @@ void _debugSend(char * message) { #if DEBUG_WEB_SUPPORT if (wsConnected() && (getFreeHeap() > 10000)) { - char buffer[strlen(message) + 24]; // 8 char timestamp [234567] + space + 14 char json wrap + String m = String(message); + m.replace("\"", """); + m.replace("{", "{"); + m.replace("}", "}"); + char buffer[m.length() + 24]; #if DEBUG_ADD_TIMESTAMP - snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s%s\"}"), timestamp, message); + snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s%s\"}"), timestamp, m.c_str()); #else - snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s\"}"), message); + snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s\"}"), m.c_str()); #endif wsSend(buffer); } diff --git a/code/html/custom.css b/code/html/custom.css index 0779278c..9002e6fa 100644 --- a/code/html/custom.css +++ b/code/html/custom.css @@ -129,7 +129,7 @@ div.state { } .pure-g span.terminal, -.pure-g ul.terminal { +.pure-g textarea.terminal { font-family: 'Courier New', monospace; font-size: 80%; line-height: 100%; @@ -316,8 +316,5 @@ span.slider { #weblog { height: 400px; - padding: 0.5em 0.6em; margin-bottom: 10px; - list-style: none; - overflow-y: scroll; } diff --git a/code/html/custom.js b/code/html/custom.js index 601c5577..5209021f 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -1161,7 +1161,7 @@ function processData(data) { // Web log if ("weblog" === key) { - $("
  • ").addClass("weblog-event").text(value).appendTo("#weblog"); + $("#weblog").append(value); $("#weblog").scrollTop($("#weblog")[0].scrollHeight - $("#weblog").height()); return; } diff --git a/code/html/index.html b/code/html/index.html index 0de831d8..76c63564 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -983,8 +983,8 @@
    - -
    + +