Preserve admin password input and clarify reconnect guidance

This commit is contained in:
mikecarper committed 2026-10-18 13:45:13 -07:00
1 parent ad4124b055
commit 5d741318f5
15 files changed
+2858 -2334

No files matched your search

+2 -1
View File
@@ -206,7 +206,8 @@ int main() {
Request absent; get(&absent); assert(absent.code == 401);
assert(absent.queued_response->headers.size() == 2);
assert(absent.queued_response->headers[0].first == "WWW-Authenticate"
&& absent.queued_response->headers[0].second == "Basic realm=\"MeshCore admin\", charset=\"UTF-8\"");
&& absent.queued_response->headers[0].second == "Basic realm=\"MeshCore (username: admin)\", charset=\"UTF-8\"");
assert(absent.body == "Sign in with username admin and this node's admin password.");
assert(absent.queued_response->headers[1].first == "Cache-Control"
&& absent.queued_response->headers[1].second == "no-store");
Request wrong; authorize(wrong, "Basic wrong"); get(&wrong); assert(wrong.code == 401);
+166
View File
@@ -0,0 +1,166 @@
// Real JSON CLI parser, form command builder, drain dispatch and both real
// role password setters. Only auth entry and persistence/peripherals are fake.
#include <cassert>
#include <cstdio>
#include <cstring>
#include <mutex>
#include <string>
#include <ArduinoJson.h>
#define MESH_MANAGEMENT_PASSWORD_HOST_TEST
#define ESP32_PLATFORM
#define ESP_PLATFORM
#define WIFI_SSID ""
#include <helpers/esp32/ManagementPassword.h>
#include <helpers/CLICommandUtils.h>
#include <helpers/WebConfigBatch.h>
#include <helpers/WebConfigKeys.h>
namespace password = mesh::esp32::managementPassword;
using String = std::string;
using WCLock = std::lock_guard<std::mutex>;
uint32_t millis() { return 1000; }
bool save_ok = true;
unsigned saves = 0;
bool durableSave() { ++saves; return save_ok; }
namespace mesh { namespace esp32 { namespace companionAdminPassword {
bool save(const char*) { return durableSave(); }
}} namespace wifi {
constexpr bool kPrimaryEspNowRadio = false;
bool parseEspNowChannel(const char*, uint8_t&) { return false; }
} struct Debug { template<typename... T> void printf(const char*, T...) {} };
Debug& usbDebugPort() { static Debug value; return value; }
}
struct StrHelper { static void strncpy(char* out, const char* in, size_t size) {
::strncpy(out, in, size); out[size - 1] = 0;
}};
struct CommonCLI {
struct Prefs { char password[16] = "original"; } prefs;
Prefs* _prefs = &prefs;
bool trySavePrefs() { return durableSave(); }
void command(char* command, char* reply) {
@SETTER@
}
};
struct MyMesh {
char _management_password[16] = "original";
bool _management_password_ready = true;
bool handleLocalControlCommand(const char*, char*, size_t);
void command(char* cmd, char* reply) { handleLocalControlCommand(cmd, reply, 160); }
};
@COMPANION@
struct Callback {
bool companion = false;
unsigned starts = 0, ends = 0, calls = 0;
CommonCLI infrastructure; MyMesh node;
bool supportsCliTerminal() const { return true; }
void execCommand(char* cmd, char* reply) {
++calls;
if (companion) node.command(cmd, reply); else infrastructure.command(cmd, reply);
}
void execAdminCommand(char* cmd, char* reply) { execCommand(cmd, reply); }
void onConfigBatchStart() { ++starts; }
void onConfigBatchEnd() { ++ends; }
};
struct AsyncWebServerRequest {
int status = 0;
std::string body, reply;
void* _tempObject = nullptr;
size_t contentLength() const { return body.size(); }
void send(int code, const char*, const char* text) { status = code; reply = text; }
void send(int code, const char*, const String& text) { status = code; reply = text; }
void payload(const std::string& text) { body = text; _tempObject = &body[0]; }
};
static const char SECRET_SENTINEL[] = "********";
static bool isAllowedSetKey(const char*, bool);
static bool isSecretKey(const char*);
struct WebConfigServer {
static constexpr unsigned MAX_BATCH = 24, MAX_BODY = 6144;
struct BatchEntry { char key[33] = {}, cmd[160] = {}, reply[160] = {}; } _batch[MAX_BATCH];
enum Mode { MODE_OFF, MODE_SETUP, MODE_LAN } _mode = MODE_LAN;
enum BatchKind { BATCH_CONFIG, BATCH_CLI } _batch_kind = BATCH_CLI;
enum State { BATCH_IDLE, BATCH_PENDING, BATCH_DONE } _batch_state = BATCH_IDLE;
std::mutex _mux;
Callback cb; Callback* _cb = &cb;
bool _cli_enabled = true, _initial_setup = false, _admin_pwd_set = false;
bool _batch_reboot = false, _batch_reboot_armed = false, _batch_all_ok = true;
bool _batch_started = false, _batch_reauth_required = false, _batch_reauth_delivered = false;
bool _standalone_wifi = false, _standalone_wifi_dirty = false;
int _batch_count = 0, _batch_next = 0;
uint32_t _batch_auth_generation = 0, _batch_reauth_until = 0, _batch_last_cmd = 0;
uint32_t _session_generation = 0, _session_last_seen = 1;
char _batch_owner_token[33] = {}, _session_token[33] = "0123456789abcdef0123456789abcdef";
char _batch_reqid[24] = {}, _wifi_ssid[32] = {}, _wifi_password[65] = {};
uint8_t _wifi_power_save = 0;
void* _mqtt_prefs = nullptr;
bool checkAuth(AsyncWebServerRequest*) { return true; }
bool checkAuthLocked(AsyncWebServerRequest*, uint32_t* generation) {
password::Snapshot value; assert(password::snapshot(value)); *generation = value.generation; return true;
}
bool bluetoothWiFiCoexistenceRequired() const { return false; }
void reloadStandaloneWiFi() {}
static WebConfigBatch::State toSpecState(State value) { return static_cast<WebConfigBatch::State>(value); }
void clearSessionLocked();
void beginBatchAuthorizationLocked(uint32_t);
void cancelStaleBatchLocked(uint32_t);
void handleCliPost(AsyncWebServerRequest*);
void drainBatch(uint32_t);
void configForTest(AsyncWebServerRequest* req) {
DynamicJsonDocument doc(6144); assert(!deserializeJson(doc, req->body));
JsonObject set = doc["set"];
int count = 0;
@CONFIG_LOOP@
_batch_count = count; _batch_next = 0; _batch_kind = BATCH_CONFIG;
password::Snapshot value; assert(password::snapshot(value));
beginBatchAuthorizationLocked(value.generation); _batch_state = BATCH_PENDING;
req->send(202, "application/json", "{}");
}
};
@METHODS@
void reset() {
auto& state = password::detail::state();
{ password::detail::Lock lock(state); state.current = {}; state.changing = state.uploading = state.rotating = false; }
assert(password::initialize("original")); save_ok = true; saves = 0;
}
std::string cliPayload(const std::string& command, bool prepend = false) {
DynamicJsonDocument doc(6144); doc["reqid"] = "0123456789abcdef";
JsonArray cmds = doc.createNestedArray("cmds"); if (prepend) cmds.add("get name"); cmds.add(command);
std::string out; serializeJson(doc, out); return out;
}
int main() {
for (bool companion : {false, true}) {
for (bool config : {false, true}) {
for (bool success : {false, true}) {
reset(); WebConfigServer server; server.cb.companion = companion; save_ok = success;
const char* value = " NewSecret ";
AsyncWebServerRequest req;
if (config) {
req.payload(std::string("{\"set\":{\"password\":\"") + value + "\"}}");
server.configForTest(&req);
} else {
req.payload(cliPayload(std::string(" PaSsWoRd ") + value)); server.handleCliPost(&req);
}
assert(req.status == 202 && server._batch_count == 1);
assert(!strcmp(server._batch[0].cmd, "password NewSecret "));
server.drainBatch(1000);
password::Snapshot current; assert(password::snapshot(current));
assert(server.cb.calls == 1 && saves == 1);
assert(!strcmp(current.password, success ? value : "original"));
const char* runtime = companion ? server.cb.node._management_password
: server.cb.infrastructure.prefs.password;
assert(!strcmp(runtime, success ? value : "original"));
assert(server._batch_reauth_required == success);
assert(bool(server._session_token[0]) != success);
assert(!strcmp(server._batch[0].reply, "OK") == success);
assert(strstr(server._batch[0].reply, "NewSecret") == nullptr);
}
}
}
for (const char* command : {"PASSWORD bad\rvalue", "password bad\nvalue", "pass\nword rejected"}) {
reset(); WebConfigServer server; AsyncWebServerRequest req;
req.payload(cliPayload(command, true)); server.handleCliPost(&req);
assert(req.status == 400 && server._batch_state == WebConfigServer::BATCH_IDLE);
assert(server.cb.calls == 0 && saves == 0);
}
reset(); WebConfigServer ordinary; AsyncWebServerRequest req;
req.payload(cliPayload(" get name\r\n \t")); ordinary.handleCliPost(&req);
assert(req.status == 202 && !strcmp(ordinary._batch[0].cmd, "get name"));
}
+3 -1
View File
@@ -251,11 +251,13 @@ int main() {
+ "/update";
assert(strncmp(reply.text, url.c_str(), url.size()) == 0);
assert(strstr(reply.text, instruction));
assert(strstr(reply.text, "Login: admin / node admin password"));
if (ap || !WiFi.connected) {
assert(WiFi.ap_protocol == 7);
assert(WiFi.ap_channel == (constrain_espnow_channel ? 6 : 1));
}
assert(strlen(reply.text) < 160 && reply.guard == 0x12345678);
assert(strlen(reply.text) + strlen("; WebConfig stopped") < 160
&& reply.guard == 0x12345678);
};
// Normal start reports the actual LAN address and does not disconnect it.
start(false, "10.20.30.40", "same WiFi/LAN");
+4 -1
View File
@@ -76,7 +76,10 @@ int main() {
for (const char* path : {"/", "/update", "/log"}) {
const auto absent = request("GET", path, "");
assert(absent.find("401 Unauthorized") != std::string::npos
&& absent.find("WWW-Authenticate: Basic realm=\"MeshCore admin\", charset=\"UTF-8\"") != std::string::npos);
&& absent.find("WWW-Authenticate: Basic realm=\"MeshCore (username: admin)\", charset=\"UTF-8\"") != std::string::npos);
const std::string help = "Sign in with username admin and this node's admin password.";
assert(absent.find("Content-Length: " + std::to_string(help.size()) + "\r\n") != std::string::npos);
assert(absent.substr(absent.find("\r\n\r\n") + 4) == help);
assert(request("GET", path, "Authorization: Basic wrong\r\n").find("401 Unauthorized") != std::string::npos);
assert(request("GET", path, good).find("200 OK") != std::string::npos);
}
+39
View File
@@ -100,6 +100,45 @@ class WebConfigPasswordSessionsTest(unittest.TestCase):
self.assertNotEqual(old, fixture)
self.compile_run(old, expect_rejection=True, includes=self.receipt_json_include())
def command_fixture(self):
source = (ROOT / "src/helpers/esp32/WebConfigServer.cpp").read_text()
methods = "\n".join(extract_braced(source, signature) for signature in (
"static bool fixedTimeEquals(", "static inline bool wcCliEchoesSecret(",
"static inline bool wcIsDeferredReboot(", "static const char* wcCliUnavailable(",
"static bool isAllowedSetKey(", "static bool isSecretKey(",
"void WebConfigServer::clearSessionLocked(",
"void WebConfigServer::beginBatchAuthorizationLocked(",
"void WebConfigServer::cancelStaleBatchLocked(",
"void WebConfigServer::handleCliPost("))
drain = extract_braced(source, "void WebConfigServer::drainBatch(")
# Run actual command dispatch, masking, and committed-generation hook.
# Subsequent WiFi/reboot handoff is covered by its dedicated fixtures.
methods += "\n" + drain[:drain.index(" if (_standalone_wifi_dirty)")] + "\n}\n"
config = extract_braced(source, "void WebConfigServer::handleConfigPost(")
config_loop = extract_braced(config[config.index(" int count = 0;"):], " for (JsonPair kv : set)")
cli = (ROOT / "src/helpers/CommonCLI.cpp").read_text()
start = cli.index(' } else if (memcmp(command, "password ", 9) == 0) {')
end = cli.index(' } else if (memcmp(command, "clear stats",', start)
setter = cli[start:end].replace('} else if (', 'if (', 1) + '\n }\n'
companion = (ROOT / "examples/companion_radio/MyMesh.cpp").read_text()
start = companion.index('bool MyMesh::handleLocalControlCommand(')
end = companion.index(' if (mesh::powerdiag::handleCommand(', start)
companion = companion[start:end] + ' return false;\n}\n'
return (ROOT / "test/fixtures/webconfig_password_command.cpp").read_text().replace(
"@METHODS@", methods).replace("@CONFIG_LOOP@", config_loop).replace(
"@SETTER@", setter).replace("@COMPANION@", companion)
def test_actual_parser_drain_and_role_setters_preserve_password_bytes(self):
self.compile_run(self.command_fixture(), includes=self.receipt_json_include())
def test_old_cli_suffix_trimming_fails_executable_regression(self):
fixture = self.command_fixture()
old = fixture.replace(' if (wcCliEchoesSecret(e.cmd)) {',
" while (pos > 0 && (e.cmd[pos - 1] == ' ' || e.cmd[pos - 1] == '\\t')) --pos;\n"
" e.cmd[pos] = 0;\n if (wcCliEchoesSecret(e.cmd)) {", 1)
self.assertNotEqual(old, fixture)
self.compile_run(old, expect_rejection=True, includes=self.receipt_json_include())
if __name__ == "__main__":
unittest.main()
+176
View File
@@ -1120,6 +1120,182 @@ window.addEventListener("load",function(){
self.assertIn('data-test-withheld="true"', dom)
self.assertIn('data-test-error-detail="true"', dom)
def test_typed_and_pasted_cli_password_preserves_argument_bytes_for_reauth(self):
for entry in ("typed", "whole_paste", "partial_single", "partial_block"):
with self.subTest(entry=entry):
status, config = self.setup_values()
status.update(mode="lan", cli=True, terminal_stream=False)
prelude = r'''<script>
(function(){
var entry=%s,status=%s,config=%s,submitted=null,posts=0,logins=0,polls=0,authorized=true;
var expected=entry==="typed"?["password typed "]:entry==="whole_paste"?["PaSsWoRd pasted ","get name"]
:entry==="partial_single"?["password suffix "]:["password suffix ","get name"];
var exactCommands=false,exactLogin=false,exactContext=false;
function response(value,code){code=code||200;return Promise.resolve({ok:code<400,status:code,json:function(){return Promise.resolve(value)}})}
window.fetch=function(path,options){
if(path==="/api/status")return response(status);
if(path==="/api/config")return response(config);
if(path==="/api/cli"&&options&&options.method==="POST"){
posts++;submitted=JSON.parse(options.body);authorized=false;
exactCommands=JSON.stringify(submitted.cmds)===JSON.stringify(expected);
exactContext=cliPasswordContext(submitted.cmds).password===expected[0].slice(9);
return response({state:"pending",reqid:submitted.reqid},202);
}
if(path.indexOf("/api/cli/result?")===0){
polls++;
if(path.indexOf("reqid="+submitted.reqid)<0)throw new Error("lost request id");
return response({state:"done",reqid:submitted.reqid,all_ok:true,reauth_required:!authorized,
results:submitted.cmds.map(function(){return{ok:true,reply:"OK"}})});
}
if(path==="/api/login"){
logins++;exactLogin=JSON.parse(options.body).password===expected[0].slice(9);
authorized=exactLogin;return response(exactLogin?{ok:true}:{error:"wrong password"},exactLogin?200:401);
}
return response({},404);
};
window.addEventListener("load",function(){
setTimeout(function(){
var input=document.getElementById("term-in");
if(entry!=="typed"){
input.value=entry==="whole_paste"?"":"password ";
var event=new Event("paste",{bubbles:true,cancelable:true});
Object.defineProperty(event,"clipboardData",{value:{getData:function(){return entry==="whole_paste"
?" > PaSsWoRd pasted \r\n get name \t\r\n # comment\r\n"
:entry==="partial_single"?"suffix \n":"suffix \nget name"}}});
input.dispatchEvent(event);
if(entry==="partial_single")input.dispatchEvent(new KeyboardEvent("keydown",{key:"Enter",bubbles:true,cancelable:true}));
}else{
input.value=" password typed ";
input.dispatchEvent(new KeyboardEvent("keydown",{key:"Enter",bubbles:true,cancelable:true}));
}
var go=document.querySelector(".term-cfm .go");if(go)go.click();
},120);
setTimeout(function(){
var body=document.body;
body.setAttribute("data-test-posts",posts);body.setAttribute("data-test-logins",logins);body.setAttribute("data-test-polls",polls);
body.setAttribute("data-test-exact-commands",exactCommands);body.setAttribute("data-test-exact-context",exactContext);
body.setAttribute("data-test-exact-login",exactLogin);body.setAttribute("data-test-busy",cli.busy);
body.setAttribute("data-test-login-visible",!document.getElementById("v-login").classList.contains("hide"));
body.setAttribute("data-test-normal-trim",cliCommandLine(" get name \t")==="get name");
body.setAttribute("data-test-empty-password",cliParse(" PASSWORD \n")[0]==="PASSWORD ");
body.setAttribute("data-test-mixedcase-risk",cliRisks(["PaSsWoRd secret "]).length===1);
body.setAttribute("data-test-password-seen",cli.pwd===true);
},600);
});
})();
</script>''' % (json.dumps(entry), json.dumps(status), json.dumps(config))
dom = self.run_page(prelude, virtual_time=900)
for attr, expected in (("posts", "1"), ("logins", "1"), ("polls", "2"),
("exact-commands", "true"), ("exact-context", "true"),
("exact-login", "true"), ("busy", "false"),
("login-visible", "false"), ("normal-trim", "true"),
("empty-password", "true"), ("mixedcase-risk", "true"),
("password-seen", "true")):
self.assertIn(f'data-test-{attr}="{expected}"', dom)
def test_setup_security_banner_and_live_password_preview(self):
banners = {
"admin_password": "Setup WiFi uses this node's admin password.",
"open_admin_login": "Setup WiFi is open; web configuration and firmware uploads still require this node's admin password.",
"open_no_password": "Setup WiFi is open. This build has no admin password configured.",
"unavailable": "Setup WiFi security is unavailable.",
"missing": "Setup WiFi security is unavailable.",
"pending": "Setup WiFi restart pending. Reconnect after the hotspot restarts to check its security.",
"lan": "Setup WiFi uses this node's admin password.",
}
for security, banner in banners.items():
with self.subTest(security=security):
status, config = self.setup_values()
status.update(mode="lan" if security == "lan" else "setup")
if security != "missing":
status["ap_security"] = "admin_password" if security in ("lan", "pending") else security
status["ap_restart_pending"] = security == "pending"
vectors = ["abcdefgh", "a" * 15, "a" * 7, "a" * 16,
"é" * 4, "abc\x1fdefg", "~~~~~~~~", " " * 8, "abcd\x7fefg", ""]
prelude = r'''<script>
(function(){
var status=%s,config=%s,values=%s;
window.fetch=function(path){var value=path==="/api/status"?status:path==="/api/config"?config:{};return Promise.resolve({ok:true,status:200,json:function(){return Promise.resolve(value)}})};
window.addEventListener("load",function(){setTimeout(function(){
var body=document.body,input=document.querySelector('#v-wizard [data-k="password"]');
var previews=values.map(function(value){
input.value=value;input.dispatchEvent(new Event("input",{bubbles:true}));
var hints=Array.prototype.slice.call(document.querySelectorAll("[data-admin-ap-hint]"));
var hidden=hints.every(function(h){return h.classList.contains("hide")});
return hidden?"hidden":hints.every(function(h){return h.textContent==="Setup WiFi will use this password."})?"protected":hints.every(function(h){return h.textContent==="WiFi will be open; web configuration and firmware uploads still require this password."})?"open":"wrong";
});
body.setAttribute("data-test-banner",document.getElementById("setup-security").textContent);
body.setAttribute("data-test-banner-hidden",document.getElementById("setup-security").classList.contains("hide"));
body.setAttribute("data-test-previews",previews.join(","));
body.setAttribute("data-test-login-default",document.querySelector("#v-login code").textContent);
},200)});
})();
</script>''' % (json.dumps(status), json.dumps(config), json.dumps(vectors))
dom = self.run_page(prelude, virtual_time=500)
self.assertIn('data-test-banner="%s"' % banner, dom)
self.assertIn('data-test-banner-hidden="%s"' % str(security == "lan").lower(), dom)
self.assertIn('data-test-previews="%s"' % (
",".join(["hidden"] * 10) if security == "lan" else
"protected,protected,open,open,open,open,protected,protected,open,hidden"), dom)
self.assertIn('data-test-login-default="password"', dom)
def test_setup_password_receipt_reconnect_guidance_matches_new_ap_policy(self):
for password, protected, legacy in (("new-admin", True, False), ("éééé", False, False),
("éééé", False, True)):
with self.subTest(protected=protected, legacy=legacy):
status, config = self.setup_values()
status.update(mode="setup", ap_security="admin_password")
prelude = r'''<script>
(function(){
var status=%s,config=%s,password=%s,legacy=%s,submitted=null,authSeen=null,posts=0,logins=0,polls=0,authorized=true;
function response(value,code){code=code||200;return Promise.resolve({ok:code<400,status:code,json:function(){return Promise.resolve(value)}})}
window.fetch=function(path,options){
if(path==="/api/status")return response(status);
if(path==="/api/config"&&options&&options.method==="POST"){
posts++;submitted=JSON.parse(options.body);authorized=false;return response({state:"pending",reqid:submitted.reqid},202);
}
if(path.indexOf("/api/config/result?")===0){
polls++;if(legacy&&!authorized)return response({error:"auth"},401);
return response({state:"done",reqid:submitted.reqid,all_ok:true,reauth_required:!authorized,results:[{key:"password",reply:"OK"}]});
}
if(path==="/api/login"){
logins++;authorized=JSON.parse(options.body).password===password;return response(authorized?{ok:true}:{error:"wrong password"},authorized?200:401);
}
if(path==="/api/config")return response(config);
if(path.indexOf("/api/scan")===0)return response({state:"done",networks:[]});
return response({},404);
};
window.addEventListener("load",function(){
setTimeout(function(){
var realReauth=reauthenticateOnce;reauthenticateOnce=function(auth,note,resume,keepView){authSeen=auth;return realReauth(auth,note,resume,keepView)};
st.dirty.password=password;saveChanges();
},120);
setTimeout(function(){
var body=document.body;
body.setAttribute("data-test-posts",posts);body.setAttribute("data-test-logins",logins);body.setAttribute("data-test-polls",polls);
body.setAttribute("data-test-pending-banner",document.getElementById("setup-security").textContent);
body.setAttribute("data-test-note",document.getElementById("login-note").textContent);
body.setAttribute("data-test-ram-secret-cleared",!!authSeen&&authSeen.password==="");
body.setAttribute("data-test-ap-protected",authSeen&&authSeen.apProtected);
},500);
});
})();
</script>''' % (json.dumps(status), json.dumps(config), json.dumps(password), json.dumps(legacy))
dom = self.run_page(prelude, virtual_time=800)
for attr, expected in (("posts", "1"), ("logins", "1"), ("polls", "2"),
("ram-secret-cleared", "true"), ("ap-protected", str(protected).lower())):
self.assertIn(f'data-test-{attr}="{expected}"', dom)
reconnect = ("Rejoin it with the new admin password." if protected else
"Join it without a WiFi password, then sign in with the new admin password.")
initial_note = ("Settings were sent. Sign in to read the saved result." if legacy else
"Settings saved. The admin password changed.")
self.assertIn('data-test-note="%s The setup WiFi may restart. %s"' %
(initial_note, reconnect), dom)
target = ("rejoin with the new admin password." if protected else
"join without a WiFi password; web configuration and firmware uploads still require the new admin password.")
self.assertIn('data-test-pending-banner="Setup WiFi restart pending. '
'After it restarts, %s"' % target, dom)
def test_admin_password_validation_counts_utf8_bytes(self):
status, config = self.setup_values()
status.update(mode="lan")
+2 -2
View File
@@ -417,8 +417,8 @@ class WifiOtaLifecycleTests(unittest.TestCase):
def assert_healthy_ota(self, scenario, url, ap_starts):
observation = self.observations[scenario]
self.assertTrue(observation["first_started"] and observation["started"])
network = "Join WiFi MeshCore-OTA (OPEN compatibility; HTTP admin login)" if url == "192.168.4.1" else "Use same WiFi/LAN"
self.assertEqual(observation["reply"], f"Started: http://{url}/update - WiFi on; {network}")
network = "Join WiFi MeshCore-OTA (OPEN compatibility)" if url == "192.168.4.1" else "Use same WiFi/LAN"
self.assertEqual(observation["reply"], f"Started: http://{url}/update; {network}; Login: admin / node admin password")
self.assertEqual(observation["server_count"], 1)
self.assertEqual(observation["server_begin_calls"], 1)
self.assertEqual(observation["ap_start_calls"], ap_starts)
+1
View File
@@ -187,6 +187,7 @@ int main() {
ESP32Board board; char reply[160];
assert(board.startOTAUpdate("fixture", reply, true));
assert(strstr(reply, "(admin password)") && WiFi.connected);
assert(strstr(reply, "Login: admin / node admin password"));
assert(WiFi.live_config.ap.authmode == WIFI_AUTH_WPA2_PSK);
assert(!strcmp(reinterpret_cast<char*>(WiFi.live_config.ap.password), "password"));
const unsigned starts = WiFi.starts;