Remove WiFi station (client) support
- Drop station connect/status/credentials from wifi util and settings API - Remove station activation from main - Remove station UI and JS from index, settings template, and help.js - Device settings now only configure WiFi Access Point Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -13,51 +13,6 @@ async def get_settings(request):
|
||||
# trigger MicroPython's "dict update sequence has wrong length" quirk.
|
||||
return json.dumps(settings), 200, {'Content-Type': 'application/json'}
|
||||
|
||||
@controller.get('/wifi/station')
|
||||
async def get_station_status(request):
|
||||
"""Get WiFi station connection status."""
|
||||
status = wifi.get_sta_status()
|
||||
if status:
|
||||
return json.dumps(status), 200, {'Content-Type': 'application/json'}
|
||||
return json.dumps({"error": "Failed to get station status"}), 500
|
||||
|
||||
@controller.post('/wifi/station')
|
||||
async def connect_station(request):
|
||||
"""Connect to WiFi station with credentials."""
|
||||
try:
|
||||
data = request.json
|
||||
ssid = data.get('ssid')
|
||||
password = data.get('password', '')
|
||||
ip = data.get('ip')
|
||||
gateway = data.get('gateway')
|
||||
|
||||
if not ssid:
|
||||
return json.dumps({"error": "SSID is required"}), 400
|
||||
|
||||
# Save credentials to settings
|
||||
settings['wifi_station_ssid'] = ssid
|
||||
settings['wifi_station_password'] = password
|
||||
if ip:
|
||||
settings['wifi_station_ip'] = ip
|
||||
if gateway:
|
||||
settings['wifi_station_gateway'] = gateway
|
||||
settings.save()
|
||||
|
||||
# Attempt connection
|
||||
result = wifi.connect(ssid, password, ip, gateway)
|
||||
if result:
|
||||
return json.dumps({
|
||||
"message": "Connected successfully",
|
||||
"ip": result[0],
|
||||
"netmask": result[1],
|
||||
"gateway": result[2],
|
||||
"dns": result[3] if len(result) > 3 else None
|
||||
}), 200, {'Content-Type': 'application/json'}
|
||||
else:
|
||||
return json.dumps({"error": "Failed to connect"}), 400
|
||||
except Exception as e:
|
||||
return json.dumps({"error": str(e)}), 500
|
||||
|
||||
@controller.get('/wifi/ap')
|
||||
async def get_ap_config(request):
|
||||
"""Get Access Point configuration."""
|
||||
@@ -106,15 +61,6 @@ async def configure_ap(request):
|
||||
except Exception as e:
|
||||
return json.dumps({"error": str(e)}), 500
|
||||
|
||||
@controller.get('/wifi/station/credentials')
|
||||
async def get_station_credentials(request):
|
||||
"""Get saved WiFi station credentials (without password)."""
|
||||
return json.dumps({
|
||||
"ssid": settings.get('wifi_station_ssid', ''),
|
||||
"ip": settings.get('wifi_station_ip', ''),
|
||||
"gateway": settings.get('wifi_station_gateway', '')
|
||||
}), 200, {'Content-Type': 'application/json'}
|
||||
|
||||
@controller.put('/settings')
|
||||
async def update_settings(request):
|
||||
"""Update general settings."""
|
||||
|
||||
Reference in New Issue
Block a user