diff --git a/tools/cdata.js b/tools/cdata.js index c05b28e5..d2950ac1 100644 --- a/tools/cdata.js +++ b/tools/cdata.js @@ -388,12 +388,6 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()====="; name: "PAGE_update", method: "gzip", filter: "html-minify", - mangle: (str) => - str - .replace( - /function GetV().*\<\/script\>/gms, - "" - ) }, { file: "welcome.htm", diff --git a/wled00/data/update.htm b/wled00/data/update.htm index 783a609e..d8b8876e 100644 --- a/wled00/data/update.htm +++ b/wled00/data/update.htm @@ -17,7 +17,26 @@ } window.open(getURL("/update?revert"),"_self"); } - function GetV() {/*injected values here*/} + function GetV() { + // Fetch device info via JSON API instead of compiling it in + fetch('/json/info') + .then(response => response.json()) + .then(data => { + document.querySelector('.installed-version').textContent = `${data.brand} ${data.ver} (${data.vid})`; + document.querySelector('.release-name').textContent = data.release; + // TODO - assemble update URL + // TODO - can this be done at build time? + if (data.arch == "esp8266") { + toggle('rev'); + } + }) + .catch(error => { + console.log('Could not fetch device info:', error); + // Fallback to compiled-in value if API call fails + document.querySelector('.installed-version').textContent = 'Unknown'; + document.querySelector('.release-name').textContent = 'Unknown'; + }); + }