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;}
</style>
<script>
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';}}
function hSC(){if (document.getElementById('_st').checked){document.getElementById('staticip').style.display = 'block';}else{document.getElementById('staticip').style.display = 'none';}}
function c(l){document.getElementById('_s').value=l.innerText||l.textContent;document.getElementById('_p').focus();})====="
#if defined(WIFICONFIG_APMODE_ENABLE)
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>
</head><body><h1>)=====" WIFICONFIG_TITLE R"=====(</h1><div style='text-align:left;display:inline-block;min-width:260px;'>
<div id="ssids">
</div>
<form method='post' action='s'>
<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>
<div>
<label>Heslo<br><input id='_p' name='_p' onfocus="this.select();" maxlength=64 value="$PASS$" type='password' placeholder='heslo'></label><br>)====="
#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>
<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>
</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>
<div>)====="
#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">
<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>
@ -55,9 +59,11 @@ $USER$
<br>
<button type='submit'>Uložit a restartovat</button></form>
<script>
window.onload = function() {
hAP();
hSC();
window.onload = function() {)====="
#if defined(WIFICONFIG_APMODE_ENABLE)
" hAP();"
#endif
R"=====( hSC();
var req = new XMLHttpRequest();
req.open("GET", "/scan", true);
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"=====(
<form action="/o" method="post">
<button class="yellow">Předminulá konfigurace</button>
<button class="yellow">Předchozí konfigurace</button>
</form><br/>
)=====";