From 09d07dc26bdac509a8dea6e497cf2ae14b30816f Mon Sep 17 00:00:00 2001 From: Christian Herzog Date: Sun, 22 Sep 2019 20:29:49 +0200 Subject: [PATCH] show list of FW and write url --- components/wifi-manager/code.js | 43 ++++++++++++++++++++++++++++++ components/wifi-manager/index.html | 16 +++++++++-- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index ed59e196..7dbaa78a 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -11,6 +11,7 @@ if (!String.prototype.format) { }; } +var releaseURL = 'https://api.github.com/repos/sle118/squeezelite-esp32/releases'; var recovery = false; var enableTimers = true; var commandHeader = 'squeezelite -b 500:2000 -d all=info '; @@ -253,6 +254,36 @@ $(document).ready(function(){ } }); + $('#fwcheck').on("click", function(){ + $("#releaseTable").html(""); + $.getJSON(releaseURL, function(data) { + console.log(data); + data.forEach(function(release) { + var url = ''; + release.assets.forEach(function(asset) { + if (asset.name.match(/\.bin$/)) { + url = asset.browser_download_url; + } + }); + var [ver, idf, cfg, branch] = release.name.split('-'); + $("#releaseTable").append( + ""+ + ""+ver+""+ + ""+idf+""+ + ""+cfg+""+ + ""+branch+""+ + ""+ + "" + ); + console.log(release.assets); + }); + }) + .fail(function() { + alert("failed to fetch release history!"); + }); + }); + + //first time the page loads: attempt to get the connection status and start the wifi scan refreshAP(); getConfig(); @@ -262,6 +293,18 @@ $(document).ready(function(){ startRefreshAPInterval(); }); +function setURL(button) { + var url = button.dataset.url; + $.ajax({ + url: '/config.json', + dataType: 'json', + method: 'POST', + cache: false, + headers: { "X-Custom-fwurl": url }, + data: { 'timestamp': Date.now() } + }); +} + function performConnect(conntype){ //stop the status refresh. This prevents a race condition where a status //request would be refreshed with wrong ip info from a previous connection diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 961d9010..9a20e774 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -206,9 +206,21 @@

Check for firmware upgrade

- -

Currently running: 0.1 - latest available version: 0.2

+
+ + + + + + + + + + + + +
Firmware versionIDF versionHW platformBranchFlash this FW

Reboot to recovery system to perform firmware upgrade