kopia lustrzana https://github.com/tayfunulu/WiFiManager
network selection: sort ssids, use radiobutton
just one click on the right button, not 2 clicks as for dropdown menu.pull/3/head
rodzic
a1b6ae5855
commit
e20694340f
|
@ -45,6 +45,9 @@ def send_response(client, payload, status_code=200):
|
||||||
|
|
||||||
def handle_root(client):
|
def handle_root(client):
|
||||||
global wlan_sta
|
global wlan_sta
|
||||||
|
wlan_sta.active(True)
|
||||||
|
ssids = sorted(ssid.decode('utf-8') for ssid, *_ in wlan_sta.scan())
|
||||||
|
|
||||||
response_header = """\
|
response_header = """\
|
||||||
<html>
|
<html>
|
||||||
<h1 style="color: #5e9ca0; text-align: center;">
|
<h1 style="color: #5e9ca0; text-align: center;">
|
||||||
|
@ -55,25 +58,22 @@ def handle_root(client):
|
||||||
<form action="configure" method="post">
|
<form action="configure" method="post">
|
||||||
<table style="margin-left: auto; margin-right: auto;">
|
<table style="margin-left: auto; margin-right: auto;">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
WiFi Name
|
|
||||||
</td>
|
|
||||||
<td style="text-align: center;">
|
|
||||||
<select id="ssid" name="ssid">
|
|
||||||
"""
|
"""
|
||||||
wlan_sta.active(True)
|
|
||||||
|
|
||||||
response_variable = ""
|
response_variable = []
|
||||||
for ssid, *_ in wlan_sta.scan():
|
for ssid in ssids:
|
||||||
response_variable += '<option value="{0}">{0}</option>'.format(ssid.decode("utf-8"))
|
response_variable.append("""\
|
||||||
|
<tr>
|
||||||
response_footer = """\
|
<td colspan="2">
|
||||||
</select>
|
<input type="radio" name="ssid" value="{0}" />{0}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
""".format(ssid))
|
||||||
|
response_variable = "\n".join(response_variable)
|
||||||
|
|
||||||
|
response_footer = """\
|
||||||
<tr>
|
<tr>
|
||||||
<td>Password</td>
|
<td>Password:</td>
|
||||||
<td><input name="password" type="password" /></td>
|
<td><input name="password" type="password" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Ładowanie…
Reference in New Issue