From eb39ca59e7c6b8c34fc2262b1df46760b71e1eb5 Mon Sep 17 00:00:00 2001 From: agessaman Date: Sat, 19 Sep 2026 10:35:49 -0700 Subject: [PATCH] fix(webconfig): persist the admin password before completing Ethernet onboarding The upstream `password` command saves /prefs.json without reporting the result, and WebConfig overwrites its reply with "OK". If that write failed while the later /mqtt.json write succeeded, wifi.setup_complete was set and the factory password came back after reboot with first-run setup suppressed. onInitialSetupComplete() now re-saves /prefs.json and records completion only when it succeeds; otherwise the batch fails, setup stays open, and no reboot is queued. --- examples/simple_repeater/MyMesh.h | 2 ++ examples/simple_room_server/MyMesh.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/simple_repeater/MyMesh.h b/examples/simple_repeater/MyMesh.h index 6cc179d8..99394a47 100644 --- a/examples/simple_repeater/MyMesh.h +++ b/examples/simple_repeater/MyMesh.h @@ -508,6 +508,8 @@ public: } void onConfigBatchEnd() override; bool onInitialSetupComplete() override { + // The password command does not report its save; make it durable first. + if (!_cli.savePrefs(_fs)) return false; MQTTPrefs* obs = _cli.getObserverPrefs(); obs->network_setup_complete = 1; if (_cli.saveObserverPrefs(_fs)) return true; diff --git a/examples/simple_room_server/MyMesh.h b/examples/simple_room_server/MyMesh.h index f5e0be7e..594450f8 100644 --- a/examples/simple_room_server/MyMesh.h +++ b/examples/simple_room_server/MyMesh.h @@ -498,6 +498,8 @@ public: } void onConfigBatchEnd() override; bool onInitialSetupComplete() override { + // The password command does not report its save; make it durable first. + if (!_cli.savePrefs(_fs)) return false; MQTTPrefs* obs = _cli.getObserverPrefs(); obs->network_setup_complete = 1; if (_cli.saveObserverPrefs(_fs)) return true;