diff --git a/README.md b/README.md index e5e7c2b..1d0b1eb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1 @@ # schnutibox - -## TODO - -- raspi configuration script diff --git a/assets/web/files/schnutibox.js b/assets/web/files/schnutibox.js index 91e81d8..07aa5a8 100644 --- a/assets/web/files/schnutibox.js +++ b/assets/web/files/schnutibox.js @@ -1,6 +1,6 @@ if(typeof(EventSource) !== "undefined") { - var source = new EventSource("/log"); - source.onmessage = function(event) { + var logSource = new EventSource("/log"); + logSource.onmessage = function(event) { var j = JSON.parse(event.data); /* eslint-disable no-prototype-builtins */ if (j.hasOwnProperty("message")) { @@ -11,6 +11,15 @@ if(typeof(EventSource) !== "undefined") { document.getElementById("log").innerHTML = "Sorry, your browser does not support server-sent events..."; } +if(typeof(EventSource) !== "undefined") { + var currentsongSource = new EventSource("/currentsong"); + currentsongSource.onmessage = function(event){ + document.getElementById("currentsong").innerHTML = event.data + }; +} else { + document.getElementById("currentsong").innerHTML = "Sorry, your browser does not support server-sent events..."; +}; + function handleSubmit(event, url) { event.preventDefault() diff --git a/assets/web/templates/index.html.tmpl b/assets/web/templates/index.html.tmpl index cb4ce50..dd02930 100644 --- a/assets/web/templates/index.html.tmpl +++ b/assets/web/templates/index.html.tmpl @@ -11,6 +11,9 @@