Pouziti modifikovaneho template placeholderu (nutno overit!)

This commit is contained in:
Pavel Brychta 2021-08-25 17:32:19 +02:00
parent cbeac02edc
commit 610229d21d
2 changed files with 28 additions and 24 deletions

View File

@ -39,6 +39,10 @@
#include <ESPAsyncWebServer.h>
#include <DNSServer.h>
#if TEMPLATE_PLACEHOLDER != '$'
# error 'Need to redefine TEPLATE_PLACEHOLDER to $ sign'
#endif
#define WC_DONT_RUN_CONFIGAP -1 // priznak, ze si neprejeme spoustet konfiguracni AP (uziva se misto parametru timeout). Urceno pro bateriove napajene pristroje
#if not defined(WIFICFG_FILE)

View File

@ -17,9 +17,9 @@ static const char PAGE_INDEX1[] PROGMEM = R"=====(<!DOCTYPE html>
<style>
.c{text-align: center;}
div,input{padding:5px;font-size:1em;}
input{width:95%%;}
input{width:95%;}
body{text-align: center;font-family:verdana;}
button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%%;}
button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;}
.q{float: right;width: 64px;text-align: right;}
.l{background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6OSk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eAXvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==") no-repeat left center;background-size: 1em;}
#rssiBar{width: 100px;height: 15px;background: #fff;}
@ -34,24 +34,24 @@ function hSC(){if (document.getElementById('_st').checked){document.getElementBy
<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>
<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><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">
<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>
<label><input id='_st' name='_st' type='checkbox' style="width: 10%%; float: left; margin-top: 5px;" onclick='hSC();' %STATIC%>Statická IP konfigurace</label>
<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>
<label>Síťová brána<br><input type="text" name="_g" value='%GATE%'></label><br>
<label>Server DNS<br><input type="text" name="_d" value='%DNS%'></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á brána<br><input type="text" name="_g" value='$GATE$'></label><br>
<label>Server DNS<br><input type="text" name="_d" value='$DNS$'></label><br>
</div>
</div>
%USER%
$USER$
<br>
<button type='submit'>Uložit a restartovat</button></form>
<script>
@ -79,7 +79,7 @@ window.onload = function() {
value = 100;
else
value = 2 * (value + 100);
line = "<div><a href='#p' onclick='c(this)'>" + data.ssids[i].ssid + "</a>&nbsp;<span class='q " + lock + "'><meter value='" + value + "' min='0' low='30' optimum='70' high='60' max='100' style='width: 70%%;'></meter></span></div>";
line = "<div><a href='#p' onclick='c(this)'>" + data.ssids[i].ssid + "</a>&nbsp;<span class='q " + lock + "'><meter value='" + value + "' min='0' low='30' optimum='70' high='60' max='100' style='width: 70%;'></meter></span></div>";
html += line;
}
ssids.innerHTML = html;
@ -134,7 +134,7 @@ Restart za několik sekund.
static const char PAGE_CAPTIVEPORTALCATCH[] PROGMEM = R"=====(<!DOCTYPE html>
<html lang="cs"><head><meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/><title>xPablo.cz Setup</title>
<style>.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%%;} body{text-align: center;font-family:verdana;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%%;} .q{float: right;width: 64px;text-align: right;}
<style>.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;}
.vl-info {border-left: thick solid #1fa3ec;background: #cee6ff; text-align:left; display:inline-block; min-width:260px; margin-top:15px}
.red { background-color: #ff0000;}
.magenta { background-color: #ff00ff;}
@ -153,7 +153,7 @@ R"=====(
<button class="magenta">Aktualizace firmware</button></form><br>)====="
#endif
R"=====(
<div class=\"vl-info\">Pokus o připojení: %STATUS%</div>
<div class=\"vl-info\">Pokus o připojení: $STATUS$</div>
)====="
#if defined APP_NAME && defined APP_VERSION
R"=====(<div style='text-align:right;font-size:11px;'><hr/>)====="
@ -239,19 +239,19 @@ static const char PAGE_INFO[] PROGMEM = R"=====(
<style>
.c{text-align: center;}
div,input{padding:5px;font-size:1em;}
input{width:95%%;}
input{width:95%;}
body{text-align: center;font-family:verdana;}
button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%%;}
button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;}
.q{float: right;width: 64px;text-align: right;}
</style>
</head><body><h1>)=====" WIFICONFIG_TITLE R"=====(</h1><div style='text-align:left;display:inline-block;min-width:260px;'>
<form><table><tr><th>System Info<th>
<tr><td>Core Version:<td>%SDK%
<tr><td>Flash Size:<td>%FS% kB
<tr><td>Sketch Size/Free:<td>%SS% kB / %FSS% kB
<tr><td>STA MAC:<td>%STAMAC%
<tr><td>AP MAC:<td>%APMAC%
<tr><td>ESP Chip ID:<td>%ESPID%
<tr><td>Flash Chip ID:<td>%FID%
<tr><td>Core Version:<td>$SDK$
<tr><td>Flash Size:<td>$FS$ kB
<tr><td>Sketch Size/Free:<td>$SS$ kB / $FSS$ kB
<tr><td>STA MAC:<td>$STAMAC$
<tr><td>AP MAC:<td>$APMAC$
<tr><td>ESP Chip ID:<td>$ESPID$
<tr><td>Flash Chip ID:<td>$FID$
</table></form>
)=====";