From 724c763f7f11eba037adb58ec5966cee2d878dd2 Mon Sep 17 00:00:00 2001 From: BlueFox Date: Tue, 26 Mar 2024 19:25:17 +0100 Subject: [PATCH] simpledemo.html: Added access point information getters --- simpledemo.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/simpledemo.html b/simpledemo.html index a4f778e..ca1f302 100644 --- a/simpledemo.html +++ b/simpledemo.html @@ -146,6 +146,14 @@ WiFi SSID + + AP SSID + + + + AP PSK + + @@ -550,6 +558,8 @@ restoreStateLabel1 = document.getElementById('updatedLabel_RESTORESTATE_table') restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table') wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table'); + apSsidLabel1 = document.getElementById('updatedLabel_APSSID_table'); + apPskLabel1 = document.getElementById('updatedLabel_APPSK_table'); 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"); @@ -590,6 +600,7 @@ restoreStateApiEndpoint = "/api/v1/system/restore_state/get"; restorePlayingStateApiEndpoint = "/api/v1/system/restore_playing/get"; wifiApiEndpoint = "/api/v1/system/wifi/get_ssid"; + apApiEndpoint = "/api/v1/system/wifi/get_ap_creds"; playbackInfoApiEndpoint = "/api/v1/playback/info"; volumeApiEndpoint = "/api/v1/volume/get"; eqApiEndpoint = "/api/v1/eq/get"; @@ -655,6 +666,19 @@ wifiRequest.open("GET", apiBase + wifiApiEndpoint, true); wifiRequest.send(); + /* AP SSID and PSK parser */ + var apRequest = new XMLHttpRequest(); + apRequest.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + var apSsidString = JSON.parse(this.responseText).ap_ssid; + var apPskString = JSON.parse(this.responseText).ap_psk; + apSsidLabel1.innerHTML = apSsidString; + apPskLabel1.innerHTML = apPskString; + } + } + apRequest.open("GET", apiBase + apApiEndpoint, true); + apRequest.send(); + /* Playback info parser */ var playbackInfoRequest = new XMLHttpRequest(); playbackInfoRequest.onreadystatechange = function() {