Fix strings
This commit is contained in:
parent
e91c16947a
commit
60d1529c89
1 changed files with 6 additions and 6 deletions
12
Setup.py
12
Setup.py
|
@ -13,11 +13,9 @@ def ap(switch):
|
||||||
def writeconfig(ssid, password):
|
def writeconfig(ssid, password):
|
||||||
rtline = "\n"
|
rtline = "\n"
|
||||||
with io.open("/etc/wpa_supplicant/wpa_supplicant.conf", "w", encoding="utf8") as note:
|
with io.open("/etc/wpa_supplicant/wpa_supplicant.conf", "w", encoding="utf8") as note:
|
||||||
conf = "ctrl_interface=/var/run/wpa_supplicant\nupdate_config=1\ncountry=FR\nnetwork={\nssid=\""
|
conf = str()
|
||||||
conf += ssid
|
for i in ["ctrl_interface=/var/run/wpa_supplicant\nupdate_config=1\ncountry=FR\nnetwork={\nssid=\"", ssid, "\"\nscan_ssid=1\npsk=\"", password, "\"\n}"]:
|
||||||
conf += "\"\nscan_ssid=1\npsk=\""
|
conf += i
|
||||||
conf += password
|
|
||||||
conf += "\"\n}"
|
|
||||||
note.write(conf)
|
note.write(conf)
|
||||||
ap(False)
|
ap(False)
|
||||||
subprocess.check_call(["sudo", "wpa_cli", "-i", "wlan0", "reconfigure"])
|
subprocess.check_call(["sudo", "wpa_cli", "-i", "wlan0", "reconfigure"])
|
||||||
|
@ -38,7 +36,9 @@ def web_setup():
|
||||||
else:
|
else:
|
||||||
writeconfig(request.args.get("ssid"), request.args.get("password"))
|
writeconfig(request.args.get("ssid"), request.args.get("password"))
|
||||||
if testinternet():
|
if testinternet():
|
||||||
r = get(f"http://flifloo.ddns.net:5000/locksetup?mac={io.open("/sys/class/net/wlan0/address").read()}&id={io.open("/sys/class/net/wlan0/address").read()}")
|
mac = io.open("/sys/class/net/wlan0/address").read()
|
||||||
|
id = request.args.get("id")
|
||||||
|
r = get(f"http://flifloo.ddns.net:5000/locksetup?mac={mac}&id={id}")
|
||||||
else:
|
else:
|
||||||
ap(True)
|
ap(True)
|
||||||
return "Cant connect"
|
return "Cant connect"
|
||||||
|
|
Reference in a new issue