simpledemo.html: Added wifi config change interactively; restart button works now; save and restore is remaining

This commit is contained in:
BlueFox 2024-03-26 19:33:09 +01:00
parent 724c763f7f
commit 3677b8aff8
Signed by: BlueFox
GPG Key ID: 327233DA85435270

View File

@ -420,7 +420,7 @@
<p>After doing this, you have to go down to the restart collapsible. There, restart the NetSpeaker and it should connect
to the configured WiFi.</p>
<p>If anything is wrong (either SSID or PSK wrong/typo, or the wifi's not available), the NetSpeaker opens an HotSpot
with the SSID <code></code> and the PSK <code></code>! </p>
with the SSID <code id="updatedLabel_APSSID_code">...</code> and the PSK <code id="updatedLabel_APPSK_code">...</code>! </p>
<div class='input-group mb-3'>
<span class='input-group-text'>SSID</span>
<input type='text' class='form-control' placeholder='Type in a new SSID here (optional)'
@ -435,7 +435,7 @@
= document.getElementById('wifiChange_ssidInput').value;
newPSK = document.getElementById('wifiChange_pskInput').value;
http = new XMLHttpRequest();http.open('GET',
'/api/v1/system/wifi/change?ssid='+newSSID+'&psk='+newPSK);http.send();">
'http://' + document.cookie + '/api/v1/system/wifi/change?ssid='+newSSID+'&psk='+newPSK);http.send();">
Change
</button>
</div>
@ -489,7 +489,7 @@
<button type='button' class='btn btn-danger' onclick="function wait(ms){var start=new Date().getTime();var
end=start;while(end<start+ms){end
= new Date().getTime();}}http = new XMLHttpRequest();http.open('GET',
'/api/v1/system/restart');http.send();wait(3000);window.location.reload();">
'http://' + document.cookie + '/api/v1/system/restart');http.send();wait(3000);window.location.reload();">
<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-bootstrap-reboot'
viewBox='0 0 16 16'>
<path d='M1.161 8a6.84 6.84 0 1 0 6.842-6.84.58.58 0 1 1 0-1.16 8 8 0 1 1-6.556 3.412l-.663-.577a.58.58 0 0 1 .227-.997l2.52-.69a.58.58 0 0 1 .728.633l-.332 2.592a.58.58 0 0 1-.956.364l-.643-.56A6.812 6.812 0 0 0 1.16 8z'></path>
@ -559,7 +559,9 @@
restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table')
wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table');
apSsidLabel1 = document.getElementById('updatedLabel_APSSID_table');
apSsidLabel2 = document.getElementById('updatedLabel_APSSID_code');
apPskLabel1 = document.getElementById('updatedLabel_APPSK_table');
apPskLabel2 = document.getElementById('updatedLabel_APPSK_code');
const playingLabel1 = document.getElementById("updatedLabel_PLAYING_table_top");
const playingLabel2 = document.getElementById("updatedLabel_PLAYING_table_bottom");
const rs_plpathLabel1 = document.getElementById("updatedLabel_RS_PLPATH_table_top");
@ -673,7 +675,9 @@
var apSsidString = JSON.parse(this.responseText).ap_ssid;
var apPskString = JSON.parse(this.responseText).ap_psk;
apSsidLabel1.innerHTML = apSsidString;
apSsidLabel2.innerHTML = apSsidString;
apPskLabel1.innerHTML = apPskString;
apPskLabel2.innerHTML = apPskString;
}
}
apRequest.open("GET", apiBase + apApiEndpoint, true);