mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
show list of FW and write url
This commit is contained in:
@@ -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(
|
||||
"<tr>"+
|
||||
"<td>"+ver+"</td>"+
|
||||
"<td>"+idf+"</td>"+
|
||||
"<td>"+cfg+"</td>"+
|
||||
"<td>"+branch+"</td>"+
|
||||
"<td><input id='generate-command' type='button' class='btn btn-success' value='Select' data-url='"+url+"' onclick='setURL(this);' /></td>"+
|
||||
"</tr>"
|
||||
);
|
||||
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
|
||||
|
||||
@@ -206,9 +206,21 @@
|
||||
<div id="recoverydiv">
|
||||
<h1>Check for firmware upgrade</h1>
|
||||
<div class="buttons">
|
||||
<input type="button" id="fwcheck" class="btn btn-primary" value="Check" />
|
||||
<p><span id="currentfw">Currently running: 0.1</span> - <span id="latestfw">latest available version: 0.2</span></p>
|
||||
<input type="button" id="fwcheck" class="btn btn-info" value="Update" />
|
||||
</div>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Firmware version</th>
|
||||
<th scope="col">IDF version</th>
|
||||
<th scope="col">HW platform</th>
|
||||
<th scope="col">Branch</th>
|
||||
<th scope="col">Flash this FW</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="releaseTable">
|
||||
</tbody>
|
||||
</table>
|
||||
<h1>Reboot to recovery system to perform firmware upgrade</h1>
|
||||
<div class="buttons">
|
||||
<input type="button" id="recovery" class="btn btn-primary" value="Recovery" />
|
||||
|
||||
Reference in New Issue
Block a user