feat: open full web CLI access and add panel redirect flow

This commit is contained in:
Jared Dohrman
2026-04-20 08:59:24 +10:00
parent 5a4adadbbf
commit bcce0071f1
5 ha cambiato i file con 63 aggiunte e 198 eliminazioni
-96
Vedi File
@@ -1992,102 +1992,6 @@ void MyMesh::runWebCommand(const char* command, char* reply, size_t reply_size)
return;
}
auto matches_exact = [command](const char* candidate) -> bool {
return strcmp(command, candidate) == 0;
};
auto matches_prefix = [command](const char* candidate) -> bool {
size_t len = strlen(candidate);
return strncmp(command, candidate, len) == 0;
};
bool allowed =
matches_exact("clock") ||
matches_exact("region default") ||
matches_exact("get mqtt.status") ||
matches_exact("get web.status") ||
matches_exact("get web.stats.status") ||
matches_exact("get web") ||
matches_exact("advert") ||
matches_exact("reboot") ||
matches_exact("start ota") ||
matches_exact("get wifi.status") ||
matches_exact("get wifi.powersaving") ||
matches_exact("stats-core") ||
matches_exact("stats-radio") ||
matches_exact("stats-packets") ||
matches_exact("memory") ||
matches_exact("get mqtt.iata") ||
matches_exact("get mqtt.owner") ||
matches_exact("get mqtt.email") ||
matches_exact("get mqtt.packets") ||
matches_exact("get mqtt.raw") ||
matches_exact("get mqtt.statuscfg") ||
matches_exact("get mqtt.tx") ||
matches_exact("get mqtt.eastmesh-au") ||
matches_exact("get mqtt.eastmesh.au") ||
matches_exact("get mqtt.letsmesh-eu") ||
matches_exact("get mqtt.letsmesh.eu") ||
matches_exact("get mqtt.letsmesh-us") ||
matches_exact("get mqtt.letsmesh.us") ||
matches_exact("get name") ||
matches_exact("get lat") ||
matches_exact("get lon") ||
matches_exact("get radio") ||
matches_exact("get prv.key") ||
matches_exact("get role") ||
matches_exact("get public.key") ||
matches_exact("get advert.interval") ||
matches_exact("get agc.reset.interval") ||
matches_exact("get flood.advert.interval") ||
matches_exact("get repeat") ||
matches_exact("get flood.max") ||
matches_exact("get path.hash.mode") ||
matches_exact("get owner.info") ||
matches_exact("get guest.password") ||
matches_prefix("set wifi.ssid ") ||
matches_prefix("set wifi.pwd ") ||
matches_prefix("set wifi.powersaving ") ||
matches_prefix("set mqtt.iata ") ||
matches_prefix("set mqtt.owner ") ||
matches_prefix("set mqtt.email ") ||
matches_prefix("set mqtt.packets ") ||
matches_prefix("set mqtt.raw ") ||
matches_prefix("set mqtt.status ") ||
matches_prefix("set mqtt.tx ") ||
matches_prefix("set web ") ||
matches_prefix("set.web ") ||
matches_prefix("set web.stats ") ||
matches_prefix("set.web.stats ") ||
matches_prefix("set mqtt.eastmesh-au ") ||
matches_prefix("set mqtt.eastmesh.au ") ||
matches_prefix("set mqtt.letsmesh-eu ") ||
matches_prefix("set mqtt.letsmesh.eu ") ||
matches_prefix("set mqtt.letsmesh-us ") ||
matches_prefix("set mqtt.letsmesh.us ") ||
matches_prefix("set name ") ||
matches_prefix("set lat ") ||
matches_prefix("set lon ") ||
matches_prefix("set radio ") ||
matches_prefix("password ") ||
matches_prefix("set guest.password ") ||
matches_prefix("set prv.key ") ||
matches_prefix("set advert.interval ") ||
matches_prefix("set agc.reset.interval ") ||
matches_prefix("set flood.advert.interval ") ||
matches_prefix("set repeat ") ||
matches_prefix("set flood.max ") ||
matches_prefix("set path.hash.mode ") ||
matches_prefix("region default ") ||
matches_prefix("time ") ||
matches_prefix("time.force ") ||
matches_prefix("set owner.info ");
if (!allowed) {
strncpy(reply, "Err - command not allowlisted for web access", reply_size - 1);
reply[reply_size - 1] = 0;
return;
}
char command_buf[192];
StrHelper::strncpy(command_buf, command, sizeof(command_buf));
handleCommand(0, command_buf, reply);