Browse Source

Revert "Escape html for weblog in the client"

This reverts commit 8da3f54e91.
rfm69
Xose Pérez 6 years ago
parent
commit
448ce2ccb9
4 changed files with 11 additions and 10 deletions
  1. +7
    -3
      code/espurna/debug.ino
  2. +1
    -4
      code/html/custom.css
  3. +1
    -1
      code/html/custom.js
  4. +2
    -2
      code/html/index.html

+ 7
- 3
code/espurna/debug.ino View File

@ -62,11 +62,15 @@ void _debugSend(char * message) {
#if DEBUG_WEB_SUPPORT #if DEBUG_WEB_SUPPORT
if (wsConnected() && (getFreeHeap() > 10000)) { 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("{", "&#123");
m.replace("}", "&#125");
char buffer[m.length() + 24];
#if DEBUG_ADD_TIMESTAMP #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 #else
snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s\"}"), message);
snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s\"}"), m.c_str());
#endif #endif
wsSend(buffer); wsSend(buffer);
} }


+ 1
- 4
code/html/custom.css View File

@ -129,7 +129,7 @@ div.state {
} }
.pure-g span.terminal, .pure-g span.terminal,
.pure-g ul.terminal {
.pure-g textarea.terminal {
font-family: 'Courier New', monospace; font-family: 'Courier New', monospace;
font-size: 80%; font-size: 80%;
line-height: 100%; line-height: 100%;
@ -316,8 +316,5 @@ span.slider {
#weblog { #weblog {
height: 400px; height: 400px;
padding: 0.5em 0.6em;
margin-bottom: 10px; margin-bottom: 10px;
list-style: none;
overflow-y: scroll;
} }

+ 1
- 1
code/html/custom.js View File

@ -1161,7 +1161,7 @@ function processData(data) {
// Web log // Web log
if ("weblog" === key) { if ("weblog" === key) {
$("<li></li>").addClass("weblog-event").text(value).appendTo("#weblog");
$("#weblog").append(value);
$("#weblog").scrollTop($("#weblog")[0].scrollHeight - $("#weblog").height()); $("#weblog").scrollTop($("#weblog")[0].scrollHeight - $("#weblog").height());
return; return;
} }


+ 2
- 2
code/html/index.html View File

@ -983,8 +983,8 @@
</div> </div>
<div class="pure-g"> <div class="pure-g">
<ul class="pure-u-1 terminal" id="weblog" name="weblog"></ul>
<div class="pure-u-1-4 pure-u-lg-1-4"><button class="pure-button button-dbg-clear pure-u-23-24">Clear</button></div>
<textarea class="pure-u-1 terminal" id="weblog" name="weblog" wrap="off" readonly></textarea>
<div class=" pure-u-1-4 pure-u-lg-1-4"><button class="pure-button button-dbg-clear pure-u-23-24">Clear</button></div>
</div> </div>
</fieldset> </fieldset>


Loading…
Cancel
Save