WIP: moznost nepovolit zapnuti AP (ovladano direktivou WIFICONFIG_APMODE_ENABLE)

This commit is contained in:
Pavel Brychta 2022-09-30 10:38:39 +02:00
parent 66cd08894e
commit 166dd319b3

View File

@ -26,24 +26,28 @@ button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-he
#rssiBar > div{width: 52px;height: 15px;background: #c20000;} #rssiBar > div{width: 52px;height: 15px;background: #c20000;}
</style> </style>
<script> <script>
function c(l){document.getElementById('_s').value=l.innerText||l.textContent;document.getElementById('_p').focus();} function c(l){document.getElementById('_s').value=l.innerText||l.textContent;document.getElementById('_p').focus();})====="
function hAP(){if (document.getElementById('_a').checked){document.getElementById('apconfig').style.display = 'block';}else{document.getElementById('apconfig').style.display = 'none';}} #if defined(WIFICONFIG_APMODE_ENABLE)
function hSC(){if (document.getElementById('_st').checked){document.getElementById('staticip').style.display = 'block';}else{document.getElementById('staticip').style.display = 'none';}} R"=====(function hAP(){if (document.getElementById('_a').checked){document.getElementById('apconfig').style.display = 'block';}else{document.getElementById('apconfig').style.display = 'none';}})====="
#endif
R"=====(function hSC(){if (document.getElementById('_st').checked){document.getElementById('staticip').style.display = 'block';}else{document.getElementById('staticip').style.display = 'none';}}
</script> </script>
</head><body><h1>)=====" WIFICONFIG_TITLE R"=====(</h1><div style='text-align:left;display:inline-block;min-width:260px;'> </head><body><h1>)=====" WIFICONFIG_TITLE R"=====(</h1><div style='text-align:left;display:inline-block;min-width:260px;'>
<div id="ssids"> <div id="ssids">
</div> </div>
<form method='post' action='s'> <form method='post' action='s'>
<label>SSID<br><input id='_s' name='_s' maxlength=32 required placeholder='SSID' value="$SSID$"></label><br> <label>SSID<br><input id='_s' name='_s' maxlength=32 required placeholder='SSID' value="$SSID$"></label><br>
<label>Heslo<br><input id='_p' name='_p' onfocus="this.select();" maxlength=64 value="$PASS$" type='password' placeholder='heslo'></label><br> <label>Heslo<br><input id='_p' name='_p' onfocus="this.select();" maxlength=64 value="$PASS$" type='password' placeholder='heslo'></label><br>)====="
<div> #if defined(WIFICONFIG_APMODE_ENABLE)
R"=====(<div>
<label><input id='_a' name='_a' type='checkbox' style="width: 10%; float: left; margin-top: 5px;" onclick='hAP();' $APMODE$>Režim AP</label> <label><input id='_a' name='_a' type='checkbox' style="width: 10%; float: left; margin-top: 5px;" onclick='hAP();' $APMODE$>Režim AP</label>
<div id="apconfig"> <div id="apconfig">
<label>Kanál<br><input type="number" name="_ch" min="1" max="13" title='cislo kanalu v intervalu 1-13' value='$APCHAN$'></label><br> <label>Kanál<br><input type="number" name="_ch" min="1" max="13" title='cislo kanalu v intervalu 1-13' value='$APCHAN$'></label><br>
</div> </div>
</div> </div>
<div> <div>)====="
<label><input id='_st' name='_st' type='checkbox' style="width: 10%; float: left; margin-top: 5px;" onclick='hSC();' $STATIC$>Statická IP konfigurace</label> #endif
R"=====(<label><input id='_st' name='_st' type='checkbox' style="width: 10%; float: left; margin-top: 5px;" onclick='hSC();' $STATIC$>Statická IP konfigurace</label>
<div id="staticip"> <div id="staticip">
<label>IP adresa<br><input type="text" name="_i" value='$IP$'></label><br> <label>IP adresa<br><input type="text" name="_i" value='$IP$'></label><br>
<label>Síťová maska<br><input type="text" name="_m" value='$MASK$'></label><br> <label>Síťová maska<br><input type="text" name="_m" value='$MASK$'></label><br>
@ -55,9 +59,11 @@ $USER$
<br> <br>
<button type='submit'>Uložit a restartovat</button></form> <button type='submit'>Uložit a restartovat</button></form>
<script> <script>
window.onload = function() { window.onload = function() {)====="
hAP(); #if defined(WIFICONFIG_APMODE_ENABLE)
hSC(); " hAP();"
#endif
R"=====( hSC();
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.open("GET", "/scan", true); req.open("GET", "/scan", true);
req.onreadystatechange = function() { req.onreadystatechange = function() {
@ -261,6 +267,6 @@ button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-he
static const char PAGE_RESTORE[] PROGMEM = R"=====( static const char PAGE_RESTORE[] PROGMEM = R"=====(
<form action="/o" method="post"> <form action="/o" method="post">
<button class="yellow">Předminulá konfigurace</button> <button class="yellow">Předchozí konfigurace</button>
</form><br/> </form><br/>
)====="; )=====";