From c0b7c2b5fdb2498b14eb8aa468cbad4c02730cf1 Mon Sep 17 00:00:00 2001 From: Marvin Steadfast Date: Tue, 4 May 2021 10:41:18 +0200 Subject: [PATCH] web: print log message only if available --- assets/web/templates/index.html.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/web/templates/index.html.tmpl b/assets/web/templates/index.html.tmpl index 0b10c99..70761bb 100644 --- a/assets/web/templates/index.html.tmpl +++ b/assets/web/templates/index.html.tmpl @@ -22,7 +22,9 @@ var source = new EventSource("/log"); source.onmessage = function(event) { var j = JSON.parse(event.data); - document.getElementById("log").innerHTML += j.message + "
"; + if (j.hasOwnProperty('message')) { + document.getElementById("log").innerHTML += j.message + "
"; + } }; } else { document.getElementById("log").innerHTML = "Sorry, your browser does not support server-sent events...";