Skip to content

Commit 7d56aec

Browse files
dbieberclaude
andcommitted
Fix Wi-Fi network configuration in settings server
The settings UI was correctly updating Wi-Fi networks in Redis, but not properly calling wifi.save_networks() which ensures proper handling before updating wpa_supplicant configuration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a50b4e3 commit 7d56aec

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

gonotego/settings/server.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ def do_POST(self):
163163
post_data = self.rfile.read(content_length).decode("utf-8")
164164
settings_data = json.loads(post_data)
165165

166+
# Write all settings being processed to debug file
167+
with open('/tmp/wifi_debug.log', 'a') as f:
168+
f.write("===== SETTINGS UPDATE =====\n")
169+
for k, v in settings_data.items():
170+
f.write(f"Key: {k}, Value type: {type(v)}, Value: {v}\n")
171+
f.write("========================\n")
172+
166173
# Update settings
167174
for key, value in settings_data.items():
168175
# Skip masked values - we don't want to overwrite with placeholder text
@@ -175,9 +182,21 @@ def do_POST(self):
175182

176183
try:
177184
settings.set(key, value)
178-
# If we're updating WiFi networks, update the wpa_supplicant.conf file
185+
# If we're updating WiFi networks, save networks and update the wpa_supplicant.conf file
179186
if key == 'WIFI_NETWORKS':
180187
try:
188+
# Write debug info to a file that can be checked later
189+
with open('/tmp/wifi_debug.log', 'a') as f:
190+
f.write(f"WIFI_NETWORKS value type: {type(value)}, value: {value}\n")
191+
# Parse the value to ensure it's in the correct format
192+
if isinstance(value, str):
193+
networks = json.loads(value)
194+
else:
195+
networks = value
196+
197+
# Save networks using the wifi module's function
198+
wifi.save_networks(networks)
199+
181200
# Update wpa_supplicant configuration using the wifi module
182201
wifi.update_wpa_supplicant_config()
183202
wifi.reconfigure_wifi()

0 commit comments

Comments
 (0)