Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to next Webui #11

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions wifimgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
ap_password = "tayfunulu"
ap_authmode = 3 # WPA2

# If `link_to_next_webui` is set to `True` on the successfully connected page there is a link to the IP of the ESP in the newly connected WiFi.
# This is useful if the ESP shows an other web interface after the WiFiManager, because the user can just click the link and doesn't have to search the new IP of the ESP.
link_to_next_webui = True

NETWORK_PROFILES = 'wifi.dat'

wlan_ap = network.WLAN(network.AP_IF)
Expand Down Expand Up @@ -200,13 +204,21 @@ def handle_configure(client, request):
<br><br>
<h1 style="color: #5e9ca0; text-align: center;">
<span style="color: #ff0000;">
ESP successfully connected to WiFi network %(ssid)s.
ESP successfully connected to WiFi network %(ssid)s with IP %(ip)s.
</span>
</h1>
</h1>""" % dict(ssid=ssid, ip=wlan_sta.ifconfig()[0])
if link_to_next_webui:
response += """\
<p style="text-align: center;">
<a href="http://%(ip)s/">To new Interface</a><br>
(You must be connected to the set network to follow this Link)
</p>
""" % dict(ip=wlan_sta.ifconfig()[0])
response += """\
<br><br>
</center>
</html>
""" % dict(ssid=ssid)
"""
send_response(client, response)
try:
profiles = read_profiles()
Expand Down Expand Up @@ -290,4 +302,3 @@ def start(port=80):
handle_not_found(client, url)
finally:
client.close()