Skip to content

Commit 46ab2db

Browse files
committed
Simplify WiFi network handling in settings server
1 parent e342a99 commit 46ab2db

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

gonotego/settings/server.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -175,22 +175,10 @@ def do_POST(self):
175175
try:
176176
# Handle WiFi networks specially
177177
if key == 'WIFI_NETWORKS':
178-
try:
179-
# Parse the value to ensure it's in the correct format
180-
if isinstance(value, str):
181-
networks = json.loads(value)
182-
else:
183-
networks = value
184-
185-
# Save networks using the wifi module's function
186-
# This already calls settings.set() internally
187-
wifi.save_networks(networks)
188-
189-
# Update wpa_supplicant configuration using the wifi module
190-
wifi.update_wpa_supplicant_config()
191-
wifi.reconfigure_wifi()
192-
except Exception as e:
193-
print(f"Error updating WiFi configuration: {e}")
178+
networks = json.loads(value)
179+
wifi.save_networks(networks)
180+
wifi.update_wpa_supplicant_config()
181+
wifi.reconfigure_wifi()
194182
else:
195183
# For all other settings, just use settings.set
196184
settings.set(key, value)

0 commit comments

Comments
 (0)