Compare commits
No commits in common. "6ce468850cfb869cf7a1cacc59740a7f3a258276" and "fdc60139c73a90ea69b8830294ee657ba4bbe98b" have entirely different histories.
6ce468850c
...
fdc60139c7
|
@ -7,7 +7,7 @@
|
|||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
</head>
|
||||
<body>
|
||||
<div class="pageTitle">Takway.AI Wi-Fi连接</div>
|
||||
<div class="pageTitle">配置</div>
|
||||
<div class="inputLabel">WIFI 名称</div>
|
||||
<div class="inputDiv">
|
||||
<div class="select-menu">
|
||||
|
|
|
@ -34,6 +34,11 @@ 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}")
|
||||
|
||||
|
@ -46,6 +51,7 @@ 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]
|
||||
|
@ -54,9 +60,10 @@ 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:
|
||||
|
@ -133,9 +140,8 @@ def submit():
|
|||
stop_hotspot() # 关闭热点
|
||||
return redirect(url_for('index'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
debug_mode = False # 设置为 True 以跳过 Wi-Fi 连接状态检测
|
||||
debug_mode = True # 设置为 True 以跳过 Wi-Fi 连接状态检测
|
||||
|
||||
if not debug_mode:
|
||||
if check_wifi_connection():
|
||||
|
@ -151,6 +157,8 @@ if __name__ == '__main__':
|
|||
print(wf_list)
|
||||
|
||||
|
||||
'''
|
||||
# 启动 Flask 服务器
|
||||
app.run(host='0.0.0.0', port=80, debug=True)
|
||||
'''
|
||||
|
Loading…
Reference in New Issue