Compare commits

..

3 Commits

Author SHA1 Message Date
IrvingGao 6ce468850c update 2024-05-19 20:30:23 +08:00
IrvingGao 6922061719 Merge branch 'main' of http://43.132.157.186:3000/gaohz/wifi_hotpot 2024-05-19 19:43:05 +08:00
IrvingGao 8b1c300f96 first commit 2024-05-19 16:01:10 +08:00
2 changed files with 6 additions and 14 deletions

View File

@ -7,7 +7,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
</head>
<body>
<div class="pageTitle">配置</div>
<div class="pageTitle">Takway.AI Wi-Fi连接</div>
<div class="inputLabel">WIFI 名称</div>
<div class="inputDiv">
<div class="select-menu">

View File

@ -34,11 +34,6 @@ def scan_wifi():
output = subprocess.check_output(['nmcli', 'dev', 'wifi'])
wifi_list = []
lines = output.decode().splitlines()
print(lines)
print(len(lines))
# for new in lines.split("', '"):
# print(f"new: {new}")
print("###### ")
for idx, line in enumerate(lines[1:]):
print(f"{idx}: {line}")
@ -51,7 +46,6 @@ def scan_wifi():
ssid = " ".join(columns[1:3])
if "Infra" in ssid:
ssid = ssid.replace(" Infra", "")
print("ssid: ", ssid.strip())
# 提取第六列的强度值
last_info = columns[4:8]
@ -60,10 +54,9 @@ def scan_wifi():
# 提取"Mbit/s"后两位数字
strength = int(columns[columns.index("Mbit/s")+6:columns.index("Mbit/s")+8])
print("MAC地址:", mac_address)
print("SSID:", ssid)
print("强度:", strength)
# print("MAC地址:", mac_address)
# print("SSID:", ssid)
# print("强度:", strength)
wifi_list.append({'ssid': ssid, 'signal': strength})
if len(wifi_list) == 15:
@ -140,8 +133,9 @@ def submit():
stop_hotspot() # 关闭热点
return redirect(url_for('index'))
if __name__ == '__main__':
debug_mode = True # 设置为 True 以跳过 Wi-Fi 连接状态检测
debug_mode = False # 设置为 True 以跳过 Wi-Fi 连接状态检测
if not debug_mode:
if check_wifi_connection():
@ -157,8 +151,6 @@ if __name__ == '__main__':
print(wf_list)
'''
# 启动 Flask 服务器
app.run(host='0.0.0.0', port=80, debug=True)
'''