diff --git a/app/www/index.html b/app/www/index.html index 537b0fd..a37d3b6 100644 --- a/app/www/index.html +++ b/app/www/index.html @@ -80,6 +80,9 @@ +
+ Local IP: null +
diff --git a/app/www/static/css/index.css b/app/www/static/css/index.css index 9bdb448..931e032 100644 --- a/app/www/static/css/index.css +++ b/app/www/static/css/index.css @@ -296,11 +296,17 @@ footer > div.selected{ } #available.active{ - border-color: #20ce45;; + border-color: #20ce45; } -#password,#wifi{ +#ip{ + color: #666; +} +#ip span{ + color: #20ce45; +} +#password,#wifi,#ip{ display: none; } -#password.active,#wifi.active{ +#password.active,#ip.active,#wifi.active{ display: block; } \ No newline at end of file diff --git a/app/www/static/js/intval.mobile.js b/app/www/static/js/intval.mobile.js index d38a2dc..4a98ff9 100644 --- a/app/www/static/js/intval.mobile.js +++ b/app/www/static/js/intval.mobile.js @@ -15,7 +15,8 @@ mobile.ble = { mobile.wifi = { current : 'null', - available : [] + available : [], + ip : null }; mobile.ble.scan = function () { @@ -301,6 +302,7 @@ mobile.getWifiSuccess = function (data) { const elem = document.getElementById('available'); const wifi = document.getElementById('wifi'); const password = document.getElementById('password'); + const ip = document.getElementById('ip'); let option = document.createElement('option'); let str = bytesToString(data); let res = JSON.parse(str); @@ -341,8 +343,20 @@ mobile.getWifiSuccess = function (data) { } } } + if (typeof res.ip !== 'undefined' && res.ip != null ) { + ip.innerHTML = `Local IP: ${res.ip}` + if (!ip.classList.contains('active')) { + ip.classList.add('active'); + } + } else { + ip.innerHTML = 'Local IP: null' + if (ip.classList.contains('active')) { + ip.classList.remove('active'); + } + } mobile.wifi.current = res.current; mobile.wifi.available = res.available; + mobile.wifi.ip = res.ip; }; mobile.editWifi = function () {