mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
Firmware update UI revamp with support for local proxy
This commit is contained in:
@@ -1001,8 +1001,12 @@ void register_config_cmd(void){
|
||||
register_audio_config();
|
||||
// register_squeezelite_config();
|
||||
register_bt_source_config();
|
||||
register_i2s_config();
|
||||
register_spdif_config();
|
||||
if(!is_dac_config_locked()){
|
||||
register_i2s_config();
|
||||
}
|
||||
if(!is_spdif_config_locked()){
|
||||
register_spdif_config();
|
||||
}
|
||||
register_rotary_config();
|
||||
}
|
||||
|
||||
|
||||
@@ -633,7 +633,7 @@ void ota_task(void *pvParameter)
|
||||
gettimeofday(&tv, NULL);
|
||||
uint32_t elapsed_ms= (tv.tv_sec-ota_status->OTA_start.tv_sec )*1000+(tv.tv_usec-ota_status->OTA_start.tv_usec)/1000;
|
||||
ESP_LOGI(TAG,"OTA progress : %d/%.0f (%d pct), %d KB/s", ota_status->actual_image_len, ota_status->total_image_len, ota_status->newpct, elapsed_ms>0?ota_status->actual_image_len*1000/elapsed_ms/1024:0);
|
||||
sendMessaging(MESSAGING_INFO,"Writing binary file %%%3d.",ota_status->newpct);
|
||||
sendMessaging(MESSAGING_INFO,"Writing binary file %3d %%.",ota_status->newpct);
|
||||
ota_status->lastpct=ota_status->newpct;
|
||||
}
|
||||
taskYIELD();
|
||||
@@ -662,7 +662,7 @@ void ota_task(void *pvParameter)
|
||||
ESP_LOGI(TAG,"OTA Process completed successfully!");
|
||||
sendMessaging(MESSAGING_INFO,"Success!");
|
||||
IF_DISPLAY(GDS_TextLine(display, 2, GDS_TEXT_LEFT, GDS_TEXT_CLEAR | GDS_TEXT_UPDATE, "Success!"));
|
||||
vTaskDelay(1500/ portTICK_PERIOD_MS); // wait here to give the UI a chance to refresh
|
||||
vTaskDelay(3500/ portTICK_PERIOD_MS); // wait here to give the UI a chance to refresh
|
||||
IF_DISPLAY(GDS_Clear(display,GDS_COLOR_BLACK));
|
||||
esp_restart();
|
||||
} else {
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\test.js":"1","C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\custom.js":"2"},{"size":4775,"mtime":1608244817341,"results":"3","hashOfConfig":"4"},{"size":57729,"mtime":1618063084495,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"8"},"1lj4yrw",{"filePath":"9","messages":"10","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\test.js",[],[],"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\custom.js",[]]
|
||||
[{"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\test.js":"1","C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\custom.js":"2"},{"size":4775,"mtime":1608244817341,"results":"3","hashOfConfig":"4"},{"size":61704,"mtime":1618437799595,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"8"},"1275pne",{"filePath":"9","messages":"10","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\test.js",[],[],"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\custom.js",[]]
|
||||
@@ -1,51 +1,123 @@
|
||||
[{
|
||||
[
|
||||
{
|
||||
"message": "Save Success",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_SYSTEM",
|
||||
"sent_time": 14084,
|
||||
"current_time": 16958
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Initializing...\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119203,
|
||||
"current_time": 121837
|
||||
"sent_time": 14110,
|
||||
"current_time": 16958
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Starting OTA...\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
"sent_time": 14146,
|
||||
"current_time": 16958
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing...\",\"ota_pct\":0}",
|
||||
"message": "{\"ota_dsc\":\"Downloading firmware\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing...\",\"ota_pct\":10}",
|
||||
"sent_time": 15208,
|
||||
"current_time": 16958
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Download success\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
"sent_time": 18825,
|
||||
"current_time": 22219
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing...\",\"ota_pct\":100}",
|
||||
"message": "{\"ota_dsc\":\"New version is : mock version \",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
"sent_time": 18849,
|
||||
"current_time": 22220
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Flashing...\",\"ota_pct\":10}",
|
||||
"message": "{\"ota_dsc\":\"Formatting OTA partition\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
"sent_time": 18850,
|
||||
"current_time": 22220
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing...\",\"ota_pct\":90}",
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (1/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
"sent_time": 22217,
|
||||
"current_time": 22220
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (5/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 29896,
|
||||
"current_time": 29902
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (7/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 33395,
|
||||
"current_time": 33408
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (9/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 36843,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing flash complete.\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 39463,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":5}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 41862,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":10}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 44003,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":40}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 56678,
|
||||
"current_time": 65185
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":70}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 69407,
|
||||
"current_time": 77858
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":95}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 80010,
|
||||
"current_time": 82592
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":100}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 82084,
|
||||
"current_time": 82592
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Success!\",\"ota_pct\":100}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
117
components/wifi-manager/webapp/mock/messages_ota_flash.json
Normal file
117
components/wifi-manager/webapp/mock/messages_ota_flash.json
Normal file
@@ -0,0 +1,117 @@
|
||||
[
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Initializing...\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 14110,
|
||||
"current_time": 16958
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Starting OTA...\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 14146,
|
||||
"current_time": 16958
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"New version is : mock version \",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 18849,
|
||||
"current_time": 22220
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Formatting OTA partition\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 18850,
|
||||
"current_time": 22220
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (1/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 22217,
|
||||
"current_time": 22220
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (5/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 29896,
|
||||
"current_time": 29902
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (7/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 33395,
|
||||
"current_time": 33408
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Erasing flash (9/11)\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 36843,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Erasing flash complete.\",\"ota_pct\":0}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 39463,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":5}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 41862,
|
||||
"current_time": 54597
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":25}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 50307,
|
||||
"current_time": 54598
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":30}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 52455,
|
||||
"current_time": 54598
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":35}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 54603,
|
||||
"current_time": 65184
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":55}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 63042,
|
||||
"current_time": 65185
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":60}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 65190,
|
||||
"current_time": 77858
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":95}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 80010,
|
||||
"current_time": 82592
|
||||
}, {
|
||||
"message": "{\"ota_dsc\":\"Writing binary file\",\"ota_pct\":100}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 82084,
|
||||
"current_time": 82592
|
||||
},
|
||||
{
|
||||
"message": "{\"ota_dsc\":\"Success!\",\"ota_pct\":100}",
|
||||
"type": "MESSAGING_INFO",
|
||||
"class": "MESSAGING_CLASS_OTA",
|
||||
"sent_time": 119255,
|
||||
"current_time": 121838
|
||||
}
|
||||
]
|
||||
@@ -18,6 +18,9 @@
|
||||
"lms_cport": 9090,
|
||||
"lms_port": 9100,
|
||||
"lms_ip": "127.0.0.1",
|
||||
"platform_name": "SqueezeAmp",
|
||||
"mock_plugin_has_proxy": "x",
|
||||
"platform_name": "SqueezeAmp"
|
||||
"mock_fail_fw_update":"",
|
||||
"mock_fail_recovery":"",
|
||||
"mock_old_recovery":""
|
||||
}
|
||||
@@ -26,11 +26,11 @@
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="nav navbar-nav mr-auto">
|
||||
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#tab-wifi">WiFi</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#tab-syslog">Status<span
|
||||
<li class="nav-item omsg"><a class="nav-link" data-toggle="tab" href="#tab-syslog">Status<span
|
||||
class="badge badge-pill badge-success" id="msgcnt"></span></a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#tab-cfg-audio">Audio</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#tab-cfg-syst">System</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#tab-cfg-hw">Hardware</a></li>
|
||||
<li class="nav-item orec"><a class="nav-link" data-toggle="tab" href="#tab-cfg-audio">Audio</a></li>
|
||||
<li class="nav-item orec"><a class="nav-link" data-toggle="tab" href="#tab-cfg-syst">System</a></li>
|
||||
<li class="nav-item orec"><a class="nav-link" data-toggle="tab" href="#tab-cfg-hw">Hardware</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#tab-cfg-fw">Updates</a></li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#tab-nvs">NVS Editor</a></li>
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
</div>
|
||||
</header>
|
||||
<main role="main" class="flex-grow mt-1 mb-5" id="content">
|
||||
<main role="main" class="flex-grow mt-1 mb-12" style="margin-bottom: 7rem;" id="content">
|
||||
<!-- Button trigger modal -->
|
||||
|
||||
<!-- Modal -->
|
||||
@@ -185,10 +185,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card text-white mb-3 recovery_element" style="display: none;">
|
||||
<div class="card text-white mb-3" >
|
||||
<div class="card-header">Local Firmware Upload</div>
|
||||
<div class="card-body">
|
||||
<div id="uploaddiv" class="recovery_element form-group row">
|
||||
<div id="uploaddiv" class="form-group row">
|
||||
<label for="flashfilename" class="col-auto col-form-label">Local File</label>
|
||||
<div class="col">
|
||||
<input type="file" class="form-control-file" id="flashfilename" aria-describedby="fileHelp">
|
||||
@@ -217,12 +217,8 @@
|
||||
<tbody id="nvsTable">
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="buttons">
|
||||
<div id="boot-div">
|
||||
<form id="reboot-form" action="/reboot.json" method="post" target="dummyframe">
|
||||
<button id="reboot-button" type="submit" class="btn btn-primary">Reboot</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between ">
|
||||
<button button id="reboot-button" class="btn btn-primary" type="submit" onclick="handleReboot('reboot');" >Reboot</button>
|
||||
<input id="save-nvs" type="button" class="btn btn-success" value="Commit">
|
||||
<input id="save-as-nvs" type="button" class="btn btn-success" value="Download config">
|
||||
<input id="load-nvs" type="button" class="btn btn-success" value="Load File">
|
||||
@@ -411,7 +407,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card border-primary mb-3">
|
||||
<div class="card border-primary mb-3" id="pins" style="display: none;">
|
||||
<div class="card-header">Pin Assignments</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
|
||||
@@ -112,14 +112,16 @@ const flash_status_codes = {
|
||||
REBOOT_TO_RECOVERY: 2,
|
||||
SET_FWURL: 5,
|
||||
FLASHING: 6,
|
||||
DONE: 7
|
||||
DONE: 7,
|
||||
UPLOADING: 8,
|
||||
ERROR: 9
|
||||
};
|
||||
let flash_state=flash_status_codes.FLASH_NONE;
|
||||
let flash_ota_dsc='';
|
||||
let flash_ota_pct=0;
|
||||
let older_recovery=false;
|
||||
function isFlashExecuting(data){
|
||||
return data.ota_dsc!='' || data.ota_pct>0;
|
||||
return (flash_state!=flash_status_codes.UPLOADING ) && (data.ota_dsc!='' || data.ota_pct>0);
|
||||
}
|
||||
function post_config(data){
|
||||
let confPayload={
|
||||
@@ -140,16 +142,21 @@ function process_ota_event(data){
|
||||
if(data.ota_dsc){
|
||||
flash_ota_dsc=data.ota_dsc;
|
||||
}
|
||||
if(data.ota_pct){
|
||||
if( data.ota_pct != undefined){
|
||||
flash_ota_pct=data.ota_pct;
|
||||
}
|
||||
if(isFlashExecuting(data)){
|
||||
|
||||
if(flash_state==flash_status_codes.ERROR){
|
||||
return;
|
||||
}
|
||||
else if(isFlashExecuting(data)){
|
||||
flash_state=flash_status_codes.FLASHING;
|
||||
}
|
||||
if(flash_state==flash_status_codes.FLASHING){
|
||||
else if(flash_state==flash_status_codes.FLASHING ){
|
||||
if(flash_ota_pct ==100){
|
||||
// we were processing OTA, and we've reached 100%
|
||||
flash_state=flash_status_codes.DONE;
|
||||
$('#flashfilename').val('');
|
||||
}
|
||||
else if(flash_ota_pct<0 && older_recovery){
|
||||
// we were processing OTA on an older recovery and we missed the
|
||||
@@ -161,11 +168,48 @@ function process_ota_event(data){
|
||||
flash_state=flash_status_codes.DONE;
|
||||
}
|
||||
}
|
||||
else if(flash_state ==flash_status_codes.UPLOADING){
|
||||
if(flash_ota_pct ==100){
|
||||
// we were processing OTA, and we've reached 100%
|
||||
// reset the progress bar
|
||||
flash_ota_pct = 0;
|
||||
flash_state=flash_status_codes.FLASHING;
|
||||
}
|
||||
}
|
||||
}
|
||||
function set_ota_error(message){
|
||||
flash_state=flash_status_codes.ERROR;
|
||||
handle_flash_state({
|
||||
ota_pct: 0,
|
||||
ota_dsc: message,
|
||||
event: flash_events.SET_ERROR
|
||||
});
|
||||
}
|
||||
function show_update_dialog(){
|
||||
$('#otadiv').modal();
|
||||
if (flash_ota_pct >= 0) {
|
||||
update_progress();
|
||||
}
|
||||
if (flash_ota_dsc !== '') {
|
||||
$('span#flash-status').html(flash_ota_dsc);
|
||||
}
|
||||
}
|
||||
const flash_events={
|
||||
SET_ERROR: function(data){
|
||||
if(data.ota_dsc){
|
||||
flash_ota_dsc=data.ota_dsc;
|
||||
}
|
||||
else {
|
||||
flash_ota_dsc = 'Error';
|
||||
}
|
||||
flash_ota_pct=data.ota_pct??0;
|
||||
$('#fwProgressLabel').parent().addClass('bg-danger');
|
||||
update_progress();
|
||||
show_update_dialog();
|
||||
},
|
||||
START_OTA : function() {
|
||||
if (flash_state == flash_status_codes.NONE || flash_state == undefined) {
|
||||
console.log('Starting OTA process');
|
||||
if (flash_state == flash_status_codes.NONE || flash_state == flash_status_codes.ERROR || flash_state == undefined) {
|
||||
$('#fwProgressLabel').parent().removeClass('bg-danger');
|
||||
flash_state=flash_status_codes.REBOOT_TO_RECOVERY;
|
||||
if(!recovery){
|
||||
flash_ota_dsc = 'Starting recovery mode...';
|
||||
@@ -181,13 +225,19 @@ const flash_events={
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
data: JSON.stringify(data),
|
||||
error: handleExceptionResponse,
|
||||
error: function(xhr, _ajaxOptions, thrownError){
|
||||
set_ota_error(`Unexpected error while trying to restart to recovery. (status=${xhr.status??''}, error=${thrownError??''} ) `);
|
||||
},
|
||||
complete: function(response) {
|
||||
console.log(response.responseText);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
flash_ota_dsc='Starting Update';
|
||||
}
|
||||
show_update_dialog();
|
||||
|
||||
}
|
||||
else {
|
||||
console.warn('Unexpected status while starting flashing');
|
||||
@@ -195,17 +245,49 @@ const flash_events={
|
||||
},
|
||||
FOUND_RECOVERY: function(data) {
|
||||
console.log(JSON.stringify(data));
|
||||
const url=$('#fw-url-input').val();
|
||||
if(flash_state == flash_status_codes.REBOOT_TO_RECOVERY){
|
||||
flash_ota_dsc = 'Recovery mode found. Flashing device.';
|
||||
flash_state= flash_status_codes.SET_FWURL;
|
||||
let confData= { fwurl: {
|
||||
value: $('#fw-url-input').val(),
|
||||
type: 33,
|
||||
}
|
||||
};
|
||||
post_config(confData);
|
||||
const fileInput = $('#flashfilename')[0].files;
|
||||
if (fileInput.length > 0) {
|
||||
flash_ota_dsc = 'Sending file to device.';
|
||||
flash_state= flash_status_codes.UPLOADING;
|
||||
const uploadPath = '/flash.json';
|
||||
const xhttp = new XMLHttpRequest();
|
||||
// xhrObj.upload.addEventListener("loadstart", loadStartFunction, false);
|
||||
xhttp.upload.addEventListener("progress", progressFunction, false);
|
||||
//xhrObj.upload.addEventListener("load", transferCompleteFunction, false);
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState === 4) {
|
||||
if(xhttp.status === 0 || xhttp.status === 404) {
|
||||
set_ota_error(`Upload Failed. Recovery version might not support uploading. Please use web update instead.`);
|
||||
$('#flashfilename').val('');
|
||||
}
|
||||
}
|
||||
};
|
||||
xhttp.open('POST', uploadPath, true);
|
||||
xhttp.send(fileInput[0] );
|
||||
}
|
||||
else if(url==''){
|
||||
flash_state= flash_status_codes.NONE;
|
||||
}
|
||||
else {
|
||||
flash_ota_dsc = 'Saving firmware URL location.';
|
||||
flash_state= flash_status_codes.SET_FWURL;
|
||||
let confData= { fwurl: {
|
||||
value: $('#fw-url-input').val(),
|
||||
type: 33,
|
||||
}
|
||||
};
|
||||
post_config(confData);
|
||||
}
|
||||
show_update_dialog();
|
||||
}
|
||||
},
|
||||
PROCESS_OTA_UPLOAD: function(data){
|
||||
flash_state= flash_status_codes.UPLOADING;
|
||||
process_ota_event(data);
|
||||
show_update_dialog();
|
||||
},
|
||||
PROCESS_OTA_STATUS: function(data){
|
||||
if(data.ota_pct>0){
|
||||
older_recovery = true;
|
||||
@@ -218,22 +300,33 @@ const flash_events={
|
||||
flash_state=flash_status_codes.NONE;
|
||||
$('#rTable tr.release').removeClass('table-success table-warning');
|
||||
$('#fw-url-input').val('');
|
||||
$('#otadiv').modal('hide');
|
||||
}
|
||||
|
||||
else {
|
||||
process_ota_event(data);
|
||||
}
|
||||
|
||||
if(flash_state && (flash_state >flash_status_codes.NONE && flash_ota_pct>=0) ) {
|
||||
show_update_dialog();
|
||||
}
|
||||
}
|
||||
},
|
||||
PROCESS_OTA: function(data) {
|
||||
process_ota_event(data);
|
||||
if(flash_state && (flash_state >flash_status_codes.NONE && flash_ota_pct>=0) ) {
|
||||
show_update_dialog();
|
||||
}
|
||||
}
|
||||
};
|
||||
window.hideSurrounding = function(obj){
|
||||
$(obj).parent().parent().hide();
|
||||
}
|
||||
function update_progress(){
|
||||
$('.progress-bar')
|
||||
.css('width', flash_ota_pct + '%')
|
||||
.attr('aria-valuenow', flash_ota_pct)
|
||||
.text(flash_ota_pct+'%')
|
||||
$('.progress-bar').html((flash_state==flash_status_codes.DONE?100:flash_ota_pct) + '%');
|
||||
|
||||
}
|
||||
function handle_flash_state(data) {
|
||||
if(data.event) {
|
||||
data.event(data);
|
||||
@@ -243,37 +336,33 @@ function handle_flash_state(data) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(flash_state && flash_state >flash_status_codes.NONE && flash_ota_pct>=0) {
|
||||
|
||||
$('#otadiv').modal();
|
||||
if (flash_ota_pct !== 0) {
|
||||
$('.progress-bar')
|
||||
.css('width', flash_ota_pct + '%')
|
||||
.attr('aria-valuenow', flash_ota_pct)
|
||||
.text(flash_ota_pct+'%')
|
||||
$('.progress-bar').html((flash_state==flash_status_codes.DONE?100:flash_ota_pct) + '%');
|
||||
}
|
||||
if (flash_ota_dsc !== '') {
|
||||
$('span#flash-status').html(flash_ota_dsc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
flash_ota_pct=0;
|
||||
flash_ota_dsc='';
|
||||
}
|
||||
}
|
||||
window.hFlash = function(){
|
||||
// reset file upload selection if any;
|
||||
$('#flashfilename').val('');
|
||||
handle_flash_state({ event: flash_events.START_OTA, url: $('#fw-url-input').val() });
|
||||
}
|
||||
window.handleReboot = function(link){
|
||||
|
||||
if(link=='reboot_ota'){
|
||||
$('#reboot_ota_nav').removeClass('active'); delayReboot(500,'', 'reboot_ota');
|
||||
$('#reboot_ota_nav').removeClass('active').prop("disabled",true); delayReboot(500,'', 'reboot_ota');
|
||||
}
|
||||
else {
|
||||
$('#reboot_nav').removeClass('active'); delayReboot(500,'',link);
|
||||
}
|
||||
}
|
||||
|
||||
function progressFunction(evt){
|
||||
// if (evt.lengthComputable) {
|
||||
// progressBar.max = evt.total;
|
||||
// progressBar.value = evt.loaded;
|
||||
// percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";
|
||||
// }
|
||||
handle_flash_state({
|
||||
ota_pct: ( Math.round(evt.loaded / evt.total * 100)),
|
||||
ota_dsc: ('Uploading file to device'),
|
||||
event: flash_events.PROCESS_OTA_UPLOAD
|
||||
});
|
||||
}
|
||||
function handlebtstate(data) {
|
||||
let icon = '';
|
||||
let tt = '';
|
||||
@@ -373,6 +462,7 @@ let LastCommandsState = null;
|
||||
var output = '';
|
||||
let hostName = '';
|
||||
let versionName='Squeezelite-ESP32';
|
||||
let prevmessage='';
|
||||
let project_name=versionName;
|
||||
let platform_name=versionName;
|
||||
let btSinkNamesOptSel='#cfg-audio-bt_source-sink_name';
|
||||
@@ -515,6 +605,7 @@ function delayReboot(duration, cmdname, ota = 'reboot') {
|
||||
showLocalMessage('System is rebooting.\n', 'MESSAGING_WARNING');
|
||||
}
|
||||
console.log('now triggering reboot');
|
||||
$("button[onclick*='handleReboot']").addClass('rebooting');
|
||||
$.ajax({
|
||||
url: data.url,
|
||||
dataType: 'text',
|
||||
@@ -619,7 +710,13 @@ window.handleDisconnect = function(){
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
function setPlatformFilter(val){
|
||||
if($('.upf').filter(function(){ return $(this).text().toUpperCase()===val.toUpperCase()}).length>0){
|
||||
$('#splf').val(val).trigger('input');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
window.handleConnect = function(){
|
||||
ConnectingToSSID.ssid = $('#manual_ssid').val();
|
||||
ConnectingToSSID.pwd = $('#manual_pwd').val();
|
||||
@@ -777,40 +874,15 @@ $(document).ready(function() {
|
||||
$('#save-nvs').on('click', function() {
|
||||
post_config(getConfigJson(false));
|
||||
});
|
||||
|
||||
$('#fwUpload').on('click', function() {
|
||||
const uploadPath = '/flash.json';
|
||||
|
||||
if (!recovery) {
|
||||
$('#flash-status').text('Rebooting to recovery. Please try again');
|
||||
window.handleReboot(false);
|
||||
}
|
||||
|
||||
const fileInput = document.getElementById('flashfilename').files;
|
||||
if (fileInput.length === 0) {
|
||||
alert('No file selected!');
|
||||
} else {
|
||||
const file = fileInput[0];
|
||||
const xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState === 4) {
|
||||
if (xhttp.status === 200) {
|
||||
showLocalMessage(xhttp.responseText, 'MESSAGING_INFO');
|
||||
} else if (xhttp.status === 0) {
|
||||
showLocalMessage(
|
||||
'Upload connection was closed abruptly!',
|
||||
'MESSAGING_ERROR'
|
||||
);
|
||||
} else {
|
||||
showLocalMessage(
|
||||
xhttp.status + ' Error!\n' + xhttp.responseText,
|
||||
'MESSAGING_ERROR'
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhttp.open('POST', uploadPath, true);
|
||||
xhttp.send(file);
|
||||
handle_flash_state({ event: flash_events.START_OTA, file: fileInput[0] });
|
||||
}
|
||||
|
||||
});
|
||||
$('[name=output-tmpl]').on('click', function() {
|
||||
handleTemplateTypeRadio(this.id);
|
||||
@@ -874,13 +946,9 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
$('#searchfw').css('display', 'inline');
|
||||
if(platform_name!=='' && $('.upf').filter(function(){ return $(this).text().toUpperCase()===platform_name.toUpperCase()}).length>0){
|
||||
$('#splf').val(platform_name).trigger('input');
|
||||
if(!setPlatformFilter(platform_name)){
|
||||
setPlatformFilter(project_name)
|
||||
}
|
||||
else if($('.upf').filter(function(){ return $(this).text().toUpperCase()===project_name.toUpperCase()}).length>0){
|
||||
$('#splf').val(project_name).trigger('input');
|
||||
}
|
||||
|
||||
$('#rTable tr.release').on('click', function() {
|
||||
var url=this.attributes['fwurl'].value;
|
||||
if (lmsBaseUrl) {
|
||||
@@ -1221,7 +1289,16 @@ function getMessages() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}).fail(handleExceptionResponse);
|
||||
}).fail(function(xhr, ajaxOptions, thrownError){
|
||||
if(xhr.status==404){
|
||||
$('.orec').hide(); // system commands won't be available either
|
||||
}
|
||||
else {
|
||||
handleExceptionResponse(xhr, ajaxOptions, thrownError);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
Minstk is minimum stack space left
|
||||
@@ -1408,6 +1485,12 @@ function checkStatus() {
|
||||
} else {
|
||||
$('#battery').hide();
|
||||
}
|
||||
if((data.message??'')!='' && prevmessage != data.message){
|
||||
// supporting older recovery firmwares - messages will come from the status.json structure
|
||||
prevmessage = data.message;
|
||||
showLocalMessage(data.message, 'MESSAGING_INFO')
|
||||
}
|
||||
$("button[onclick*='handleReboot']").removeClass('rebooting');
|
||||
|
||||
if (typeof lmsBaseUrl == "undefined" || data.lms_ip != prevLMSIP && data.lms_ip && data.lms_port) {
|
||||
const baseUrl = 'http://' + data.lms_ip + ':' + data.lms_port;
|
||||
@@ -1489,9 +1572,29 @@ window.runCommand = function(button, reboot) {
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
data: JSON.stringify(data),
|
||||
error: handleExceptionResponse,
|
||||
complete: function(response) {
|
||||
error: function(xhr, _ajaxOptions, thrownError){
|
||||
var cmd=JSON.parse(this.data ).command;
|
||||
if(xhr.status==404){
|
||||
showCmdMessage(
|
||||
cmd.substr(0,cmd.indexOf(' ')),
|
||||
'MESSAGING_ERROR',
|
||||
`${recovery?'Limited recovery mode active. Unsupported action ':'Unexpected error while processing command'}`,
|
||||
true
|
||||
);
|
||||
}
|
||||
else {
|
||||
handleExceptionResponse(xhr, _ajaxOptions, thrownError);
|
||||
showCmdMessage(
|
||||
cmd.substr(0,cmd.indexOf(' ')-1),
|
||||
'MESSAGING_ERROR',
|
||||
`Unexpected error ${(thrownError !== '')?thrownError:'with return status = '+xhr.status}`,
|
||||
true
|
||||
);
|
||||
}
|
||||
},
|
||||
success: function(response) {
|
||||
// var returnedResponse = JSON.parse(response.responseText);
|
||||
$('.orec').show();
|
||||
console.log(response.responseText);
|
||||
if (
|
||||
response.responseText &&
|
||||
@@ -1509,6 +1612,7 @@ function getLongOps(data, name, longopts){
|
||||
function getCommands() {
|
||||
$.getJSON('/commands.json', function(data) {
|
||||
console.log(data);
|
||||
$('.orec').show();
|
||||
data.commands.forEach(function(command) {
|
||||
if ($('#flds-' + command.name).length === 0) {
|
||||
const cmdParts = command.name.split('-');
|
||||
@@ -1664,7 +1768,13 @@ function getCommands() {
|
||||
}
|
||||
});
|
||||
}).fail(function(xhr, ajaxOptions, thrownError) {
|
||||
handleExceptionResponse(xhr, ajaxOptions, thrownError);
|
||||
if(xhr.status==404){
|
||||
$('.orec').hide();
|
||||
}
|
||||
else {
|
||||
handleExceptionResponse(xhr, ajaxOptions, thrownError);
|
||||
}
|
||||
|
||||
$('#commands-list').empty();
|
||||
blockAjax = false;
|
||||
});
|
||||
@@ -1725,6 +1835,7 @@ function getConfig() {
|
||||
"<tr><td><input type='text' class='form-control' id='nvs-new-key' placeholder='new key'></td><td><input type='text' class='form-control' id='nvs-new-value' placeholder='new value' nvs_type=33 ></td></tr>"
|
||||
);
|
||||
if (entries.gpio) {
|
||||
$('#pins').show();
|
||||
$('tbody#gpiotable tr').remove();
|
||||
entries.gpio.forEach(function(gpioEntry) {
|
||||
$('tbody#gpiotable').append(
|
||||
@@ -1742,6 +1853,9 @@ function getConfig() {
|
||||
);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#pins').hide();
|
||||
}
|
||||
}).fail(function(xhr, ajaxOptions, thrownError) {
|
||||
handleExceptionResponse(xhr, ajaxOptions, thrownError);
|
||||
blockAjax = false;
|
||||
|
||||
@@ -13,6 +13,9 @@ body {
|
||||
tr.hide {
|
||||
display: none;
|
||||
}
|
||||
.rebooting {
|
||||
display: none;
|
||||
}
|
||||
/* body {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/favicon-32x32.png BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/index.html.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/index.5b6fcc.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/node-modules.5b6fcc.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/runtime.5b6fcc.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/index.abeafc.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/node-modules.abeafc.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/runtime.abeafc.bundle.js.gz BINARY)
|
||||
|
||||
@@ -4,31 +4,31 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
|
||||
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
|
||||
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
|
||||
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
|
||||
extern const uint8_t _index_5b6fcc_bundle_js_gz_start[] asm("_binary_index_5b6fcc_bundle_js_gz_start");
|
||||
extern const uint8_t _index_5b6fcc_bundle_js_gz_end[] asm("_binary_index_5b6fcc_bundle_js_gz_end");
|
||||
extern const uint8_t _node_modules_5b6fcc_bundle_js_gz_start[] asm("_binary_node_modules_5b6fcc_bundle_js_gz_start");
|
||||
extern const uint8_t _node_modules_5b6fcc_bundle_js_gz_end[] asm("_binary_node_modules_5b6fcc_bundle_js_gz_end");
|
||||
extern const uint8_t _runtime_5b6fcc_bundle_js_gz_start[] asm("_binary_runtime_5b6fcc_bundle_js_gz_start");
|
||||
extern const uint8_t _runtime_5b6fcc_bundle_js_gz_end[] asm("_binary_runtime_5b6fcc_bundle_js_gz_end");
|
||||
extern const uint8_t _index_abeafc_bundle_js_gz_start[] asm("_binary_index_abeafc_bundle_js_gz_start");
|
||||
extern const uint8_t _index_abeafc_bundle_js_gz_end[] asm("_binary_index_abeafc_bundle_js_gz_end");
|
||||
extern const uint8_t _node_modules_abeafc_bundle_js_gz_start[] asm("_binary_node_modules_abeafc_bundle_js_gz_start");
|
||||
extern const uint8_t _node_modules_abeafc_bundle_js_gz_end[] asm("_binary_node_modules_abeafc_bundle_js_gz_end");
|
||||
extern const uint8_t _runtime_abeafc_bundle_js_gz_start[] asm("_binary_runtime_abeafc_bundle_js_gz_start");
|
||||
extern const uint8_t _runtime_abeafc_bundle_js_gz_end[] asm("_binary_runtime_abeafc_bundle_js_gz_end");
|
||||
const char * resource_lookups[] = {
|
||||
"/dist/favicon-32x32.png",
|
||||
"/dist/index.html.gz",
|
||||
"/js/index.5b6fcc.bundle.js.gz",
|
||||
"/js/node-modules.5b6fcc.bundle.js.gz",
|
||||
"/js/runtime.5b6fcc.bundle.js.gz",
|
||||
"/js/index.abeafc.bundle.js.gz",
|
||||
"/js/node-modules.abeafc.bundle.js.gz",
|
||||
"/js/runtime.abeafc.bundle.js.gz",
|
||||
""
|
||||
};
|
||||
const uint8_t * resource_map_start[] = {
|
||||
_favicon_32x32_png_start,
|
||||
_index_html_gz_start,
|
||||
_index_5b6fcc_bundle_js_gz_start,
|
||||
_node_modules_5b6fcc_bundle_js_gz_start,
|
||||
_runtime_5b6fcc_bundle_js_gz_start
|
||||
_index_abeafc_bundle_js_gz_start,
|
||||
_node_modules_abeafc_bundle_js_gz_start,
|
||||
_runtime_abeafc_bundle_js_gz_start
|
||||
};
|
||||
const uint8_t * resource_map_end[] = {
|
||||
_favicon_32x32_png_end,
|
||||
_index_html_gz_end,
|
||||
_index_5b6fcc_bundle_js_gz_end,
|
||||
_node_modules_5b6fcc_bundle_js_gz_end,
|
||||
_runtime_5b6fcc_bundle_js_gz_end
|
||||
_index_abeafc_bundle_js_gz_end,
|
||||
_node_modules_abeafc_bundle_js_gz_end,
|
||||
_runtime_abeafc_bundle_js_gz_end
|
||||
};
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/***********************************
|
||||
webpack_headers
|
||||
Hash: 5b6fcca7137c495bebc9
|
||||
Version: webpack 4.44.2
|
||||
Time: 8665ms
|
||||
Built at: 2021-04-10 09 h 58 min 36 s
|
||||
Hash: abeafc790ab5fbef1c83
|
||||
Version: webpack 4.46.0
|
||||
Time: 11034ms
|
||||
Built at: 2021-04-14 18 h 05 min 54 s
|
||||
Asset Size Chunks Chunk Names
|
||||
./js/index.5b6fcc.bundle.js 229 KiB 0 [emitted] [immutable] index
|
||||
./js/index.5b6fcc.bundle.js.br 31.3 KiB [emitted]
|
||||
./js/index.5b6fcc.bundle.js.gz 40.6 KiB [emitted]
|
||||
./js/node-modules.5b6fcc.bundle.js 265 KiB 1 [emitted] [immutable] [big] node-modules
|
||||
./js/node-modules.5b6fcc.bundle.js.br 76.2 KiB [emitted]
|
||||
./js/node-modules.5b6fcc.bundle.js.gz 88.6 KiB [emitted]
|
||||
./js/runtime.5b6fcc.bundle.js 1.46 KiB 2 [emitted] [immutable] runtime
|
||||
./js/runtime.5b6fcc.bundle.js.br 644 bytes [emitted]
|
||||
./js/runtime.5b6fcc.bundle.js.gz 722 bytes [emitted]
|
||||
./js/index.abeafc.bundle.js 231 KiB 0 [emitted] [immutable] index
|
||||
./js/index.abeafc.bundle.js.br 32 KiB [emitted]
|
||||
./js/index.abeafc.bundle.js.gz 41.2 KiB [emitted]
|
||||
./js/node-modules.abeafc.bundle.js 266 KiB 1 [emitted] [immutable] [big] node-modules
|
||||
./js/node-modules.abeafc.bundle.js.br 76.3 KiB [emitted]
|
||||
./js/node-modules.abeafc.bundle.js.gz 88.7 KiB [emitted]
|
||||
./js/runtime.abeafc.bundle.js 1.46 KiB 2 [emitted] [immutable] runtime
|
||||
./js/runtime.abeafc.bundle.js.br 644 bytes [emitted]
|
||||
./js/runtime.abeafc.bundle.js.gz 722 bytes [emitted]
|
||||
favicon-32x32.png 578 bytes [emitted]
|
||||
index.html 21.7 KiB [emitted]
|
||||
index.html.br 4.78 KiB [emitted]
|
||||
index.html.gz 5.78 KiB [emitted]
|
||||
index.html.br 4.75 KiB [emitted]
|
||||
index.html.gz 5.76 KiB [emitted]
|
||||
sprite.svg 4.4 KiB [emitted]
|
||||
sprite.svg.br 912 bytes [emitted]
|
||||
Entrypoint index [big] = ./js/runtime.5b6fcc.bundle.js ./js/node-modules.5b6fcc.bundle.js ./js/index.5b6fcc.bundle.js
|
||||
Entrypoint index [big] = ./js/runtime.abeafc.bundle.js ./js/node-modules.abeafc.bundle.js ./js/index.abeafc.bundle.js
|
||||
[6] ./node_modules/bootstrap/dist/js/bootstrap-exposed.js 437 bytes {1} [built]
|
||||
[11] ./src/sass/main.scss 1.55 KiB {0} [built]
|
||||
[16] ./node_modules/remixicon/icons/Device/signal-wifi-fill.svg 340 bytes {1} [built]
|
||||
@@ -35,22 +35,22 @@ Entrypoint index [big] = ./js/runtime.5b6fcc.bundle.js ./js/node-modules.5b6fcc.
|
||||
[25] ./node_modules/remixicon/icons/Device/device-recover-fill.svg 346 bytes {1} [built]
|
||||
[26] ./node_modules/remixicon/icons/Device/bluetooth-fill.svg 336 bytes {1} [built]
|
||||
[27] ./node_modules/remixicon/icons/Device/bluetooth-connect-fill.svg 352 bytes {1} [built]
|
||||
[37] ./src/index.ts + 1 modules 58.4 KiB {0} [built]
|
||||
[37] ./src/index.ts + 1 modules 62.5 KiB {0} [built]
|
||||
| ./src/index.ts 1.36 KiB [built]
|
||||
| ./src/js/custom.js 57 KiB [built]
|
||||
| ./src/js/custom.js 61 KiB [built]
|
||||
+ 23 hidden modules
|
||||
|
||||
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
|
||||
This can impact web performance.
|
||||
Assets:
|
||||
./js/node-modules.5b6fcc.bundle.js (265 KiB)
|
||||
./js/node-modules.abeafc.bundle.js (266 KiB)
|
||||
|
||||
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
|
||||
Entrypoints:
|
||||
index (496 KiB)
|
||||
./js/runtime.5b6fcc.bundle.js
|
||||
./js/node-modules.5b6fcc.bundle.js
|
||||
./js/index.5b6fcc.bundle.js
|
||||
index (499 KiB)
|
||||
./js/runtime.abeafc.bundle.js
|
||||
./js/node-modules.abeafc.bundle.js
|
||||
./js/index.abeafc.bundle.js
|
||||
|
||||
|
||||
WARNING in webpack performance recommendations:
|
||||
@@ -58,10 +58,10 @@ You can limit the size of your bundles by using import() or require.ensure to la
|
||||
For more info visit https://webpack.js.org/guides/code-splitting/
|
||||
Child html-webpack-plugin for "index.html":
|
||||
Asset Size Chunks Chunk Names
|
||||
index.html 559 KiB 0
|
||||
index.html 560 KiB 0
|
||||
Entrypoint undefined = index.html
|
||||
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 23.9 KiB {0} [built]
|
||||
[1] ./node_modules/lodash/lodash.js 530 KiB {0} [built]
|
||||
[1] ./node_modules/lodash/lodash.js 531 KiB {0} [built]
|
||||
[2] (webpack)/buildin/global.js 472 bytes {0} [built]
|
||||
[3] (webpack)/buildin/module.js 497 bytes {0} [built]
|
||||
***********************************/
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,9 @@ const data = {
|
||||
messages: require("../mock/messages.json"),
|
||||
messagequeue: require("../mock/messages.json"),
|
||||
message_queue_sequence: [],
|
||||
status_queue_sequence:[],
|
||||
message_queue_sequence_post_empty: null,
|
||||
status_queue_sequence_post_empty: null,
|
||||
commands: require("../mock/commands.json"),
|
||||
scan: require("../mock/scan.json"),
|
||||
ap: require("../mock/ap.json"),
|
||||
@@ -23,6 +25,7 @@ const data = {
|
||||
statusdefinition: require("../mock/statusdefinition.json"),
|
||||
status: require("../mock/status.json"),
|
||||
messages_ota_fail: require("../mock/messages_ota_fail.json"),
|
||||
messages_ota_flash: require("../mock/messages_ota_flash.json"),
|
||||
messages_ota: require("../mock/messages_ota.json")
|
||||
};
|
||||
const messagingTypes= {
|
||||
@@ -123,8 +126,47 @@ module.exports = merge(common, {
|
||||
app.use(bodyParser.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
|
||||
app.get('/ap.json', function(req, res) { res.json( data.ap ); });
|
||||
app.get('/scan.json', function(req, res) { res.json( data.scan ); });
|
||||
app.get('/config.json', function(req, res) { res.json( data.config ); });
|
||||
app.get('/status.json', function(req, res) { res.json( data.status ); });
|
||||
app.get('/config.json', function(req, res) {
|
||||
if(data.status.recovery==1 && (data.status.mock_old_recovery??'')!==''){
|
||||
res.json( data.config.config );
|
||||
console.log('Mock old recovery - return config structure without gpio');
|
||||
}
|
||||
else {
|
||||
res.json( data.config );
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/status.json', function(req, res) {
|
||||
if(data.status_queue_sequence.length>0){
|
||||
const curstatus = JSON.parse(data.status_queue_sequence_queue_sequence.shift());
|
||||
data.status.ota_pct=curstatus.ota_pct??0;
|
||||
data.status.ota_dsc=curstatus.ota_dsc??'';
|
||||
console.log(`Mock firmware update @${data.status.ota_pct}%, ${data.status.ota_dsc}`)
|
||||
}
|
||||
else if (data.status_queue_sequence_post_empty){
|
||||
data.status_queue_sequence_post_emptyy();
|
||||
console.log(`Mock old firmware update: simulating a restart`);
|
||||
data.status_queue_sequence_post_empty = null;
|
||||
}
|
||||
else if(data.status.ota_pct!=undefined || data.status.ota_dsc!=undefined) {
|
||||
if(data.status.ota_pct!=undefined) delete data.status.ota_pct;
|
||||
if(data.status.ota_dsc!=undefined) delete data.status.ota_dsc;
|
||||
}
|
||||
if(data.status.message) delete data.status.message;
|
||||
if(data.status.recovery==1 && (data.status.mock_old_recovery??'')!==''){
|
||||
if(data.message_queue_sequence.length>0){
|
||||
|
||||
const msgpayload = JSON.parse(data.message_queue_sequence.shift());
|
||||
data.status.message = msgpayload.message??'';
|
||||
console.log(`Mocking recovery, setting status message to ${data.status.message}`)
|
||||
}
|
||||
else if (data.message_queue_sequence_post_empty){
|
||||
data.message_queue_sequence_post_empty();
|
||||
data.message_queue_sequence_post_empty = null;
|
||||
}
|
||||
}
|
||||
res.json( data.status );
|
||||
});
|
||||
app.get('/plugins/SqueezeESP32/firmware/-99', function(req, res) {
|
||||
let has_proxy= data.status.mock_plugin_has_proxy ?? 'n';
|
||||
const statusCode='xy'.includes((has_proxy).toLowerCase())?200:500;
|
||||
@@ -132,6 +174,11 @@ module.exports = merge(common, {
|
||||
res.status(statusCode ).json();
|
||||
});
|
||||
app.get('/messages.json', function(req, res) {
|
||||
if(data.status.recovery==1 && (data.status.mock_old_recovery??'')!==''){
|
||||
console.log('Mocking old recovery, with no commands backend' );
|
||||
res.status(404).end();
|
||||
return;
|
||||
}
|
||||
if(data.message_queue_sequence.length>0){
|
||||
data.messagequeue.push(data.message_queue_sequence.shift());
|
||||
}
|
||||
@@ -144,8 +191,22 @@ module.exports = merge(common, {
|
||||
});
|
||||
|
||||
app.get('/statusdefinition.json', function(req, res) { res.json( data.statusdefinition ); });
|
||||
app.get('/commands.json', function(req, res) { res.json( data.commands ); });
|
||||
app.get('/commands.json', function(req, res) {
|
||||
if(data.status.recovery==1 && (data.status.mock_old_recovery??'')!==''){
|
||||
console.log('Mocking old recovery, with no commands backend' );
|
||||
res.status(404).end();
|
||||
}
|
||||
else {
|
||||
res.json( data.commands );
|
||||
}
|
||||
|
||||
});
|
||||
app.post('/commands.json', function(req, res) {
|
||||
if(data.status.recovery==1 && (data.status.mock_old_recovery??'')!==''){
|
||||
console.log('Mocking old recovery, with no commands backend' );
|
||||
res.status(404).end();
|
||||
return;
|
||||
}
|
||||
console.log(req.body.command);
|
||||
try {
|
||||
const cmdName=req.body.command.split(" ")[0];
|
||||
@@ -189,23 +250,29 @@ module.exports = merge(common, {
|
||||
}
|
||||
res.json( {} );
|
||||
if(fwurl!=='' ){
|
||||
const ota_msg_list= ((data.status.mock_fail_fw_update ?? '')!=='')?data.messages_ota_fail:data.messages_ota;
|
||||
if(data.status.recovery!=1) {
|
||||
// we're not yet in recovery. Simulate reboot to recovery
|
||||
data.status.recovery=1;
|
||||
requeueMessages();
|
||||
}
|
||||
if(fwurl.toLowerCase().includes('fail')){
|
||||
console.log(`queuing ${data.messages_ota_fail.length} ota messages `);
|
||||
data.message_queue_sequence.push(...data.messages_ota_fail);
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(`queuing ${data.messages_ota.length} ota messages `);
|
||||
data.message_queue_sequence.push(...data.messages_ota);
|
||||
data.message_queue_sequence_post_empty = function(){
|
||||
data.status.recovery=0;
|
||||
if((data.status.mock_old_recovery??'')===''){
|
||||
// older recovery partitions possibly aren't
|
||||
// sending messages
|
||||
requeueMessages();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
var targetQueue='message_queue_sequence';
|
||||
var targetPostEmpty='message_queue_sequence_post_empty';
|
||||
if((data.status.mock_old_recovery??'')!==''){
|
||||
console.log('Mocking old firmware flashing mechanism. Starting!');
|
||||
targetQueue='status_queue_sequence';
|
||||
targetPostEmpty='status_queue_sequence_post_empty';
|
||||
}
|
||||
console.log(`queuing ${ota_msg_list.length} ota messages `);
|
||||
data[targetQueue].push(...ota_msg_list);
|
||||
data[targetPostEmpty] = function(){
|
||||
data.status.recovery=0;
|
||||
requeueMessages();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -220,7 +287,7 @@ module.exports = merge(common, {
|
||||
console.log(`Updated status value ${property}\nFrom: ${data.status[property]}\nTo: ${req.body.status[property]}`);
|
||||
data.status[property]=req.body.status[property];
|
||||
}
|
||||
}
|
||||
}
|
||||
res.json( {} );
|
||||
});
|
||||
app.post('/connect.json', function(req, res) {
|
||||
@@ -251,17 +318,37 @@ module.exports = merge(common, {
|
||||
requeueMessages();
|
||||
});
|
||||
app.post('/recovery.json', function(req, res) {
|
||||
data.status.recovery=1;
|
||||
requeueMessages();
|
||||
res.json( { } );
|
||||
if((data.status.mock_fail_recovery ?? '')!==''){
|
||||
res.status(404).end();
|
||||
}
|
||||
else {
|
||||
data.status.recovery=1;
|
||||
requeueMessages();
|
||||
res.json( { } );
|
||||
}
|
||||
});
|
||||
app.post('/flash.json', function(req, res) {
|
||||
|
||||
if(data.status.recovery>0){
|
||||
res.json({});
|
||||
}
|
||||
else {
|
||||
if((data.status.mock_fail_fw_update ?? '')!=='' || (data.status.mock_old_recovery??'')!==''){
|
||||
console.log('Old recovery mock, or fw fail requested' );
|
||||
res.status(404).end();
|
||||
}
|
||||
else {
|
||||
console.log(`queuing ${data.messages_ota_flash.length} flash ota messages `);
|
||||
data.message_queue_sequence.push(...data.messages_ota_flash);
|
||||
data.message_queue_sequence_post_empty = function(){
|
||||
data.status.recovery=0;
|
||||
requeueMessages();
|
||||
|
||||
}
|
||||
res.json({});
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
res.status(404).end();
|
||||
}
|
||||
}
|
||||
});
|
||||
app.delete('/connect.json', function(req, res) {
|
||||
data.status.ssid='';
|
||||
|
||||
Reference in New Issue
Block a user