kopia lustrzana https://github.com/tayfunulu/WiFiManager
Change positional placeholders back to named placeholders
rodzic
94638b0bf3
commit
b4ab02d419
22
wifimgr.py
22
wifimgr.py
|
@ -238,12 +238,12 @@ def handle_root(client):
|
||||||
while len(ssids):
|
while len(ssids):
|
||||||
ssid = ssids.pop(0)
|
ssid = ssids.pop(0)
|
||||||
client.sendall("""\
|
client.sendall("""\
|
||||||
<a onclick="document.getElementById('ssid').value = '{0}';" href="javascript:void(0)">
|
<a onclick="document.getElementById('ssid').value = '{ssid}';" href="javascript:void(0)">
|
||||||
<li>
|
<li>
|
||||||
{0}
|
{ssid}
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
""".format(ssid))
|
""".format(ssid=ssid))
|
||||||
client.sendall("""\
|
client.sendall("""\
|
||||||
<li onclick="document.getElementById('ssid').focus()">
|
<li onclick="document.getElementById('ssid').focus()">
|
||||||
<span class="fixedWidth">SSID</span>
|
<span class="fixedWidth">SSID</span>
|
||||||
|
@ -262,7 +262,7 @@ def handle_root(client):
|
||||||
Infos:
|
Infos:
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
Your ssid and password information will be saved into the "{}" file in your ESP module for future usage. Be careful about security!
|
Your ssid and password information will be saved into the "{filename}" file in your ESP module for future usage. Be careful about security!
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Original code from <a href="https://github.com/cpopp/MicroPythonSamples" target="_blank" rel="noopener">cpopp/MicroPythonSamples</a>.
|
Original code from <a href="https://github.com/cpopp/MicroPythonSamples" target="_blank" rel="noopener">cpopp/MicroPythonSamples</a>.
|
||||||
|
@ -273,7 +273,7 @@ def handle_root(client):
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""".format(NETWORK_PROFILES))
|
""".format(filename=NETWORK_PROFILES))
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,14 +298,14 @@ def handle_configure(client, request):
|
||||||
if do_connect(ssid, password):
|
if do_connect(ssid, password):
|
||||||
response = """\
|
response = """\
|
||||||
<html>
|
<html>
|
||||||
{}
|
{html_head}
|
||||||
<body>
|
<body>
|
||||||
<h1>
|
<h1>
|
||||||
ESP successfully connected to WiFi network "<span class="monospace">{}</span>"
|
ESP successfully connected to WiFi network "<span class="monospace">{ssid}</span>"
|
||||||
</h1>
|
</h1>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""".format(html_head, ssid)
|
""".format(html_head=html_head, ssid=ssid)
|
||||||
send_response(client, response)
|
send_response(client, response)
|
||||||
try:
|
try:
|
||||||
profiles = read_profiles()
|
profiles = read_profiles()
|
||||||
|
@ -320,15 +320,15 @@ def handle_configure(client, request):
|
||||||
else:
|
else:
|
||||||
response = """\
|
response = """\
|
||||||
<html>
|
<html>
|
||||||
{}
|
{html_head}
|
||||||
<body>
|
<body>
|
||||||
<h1>
|
<h1>
|
||||||
ESP could not connect to WiFi network "<span class="monospace">{}</span>"
|
ESP could not connect to WiFi network "<span class="monospace">{ssid}</span>"
|
||||||
</h1>
|
</h1>
|
||||||
<button onclick="history.back()">Go back</button>
|
<button onclick="history.back()">Go back</button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
""".format(html_head, ssid)
|
""".format(html_head=html_head, ssid=ssid)
|
||||||
send_response(client, response)
|
send_response(client, response)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue