move 404 handler public, remove 404 info, add examples for overrides

This commit is contained in:
tablatronix
2023-09-08 13:27:15 -05:00
parent 3a303eeb45
commit eb27c525e3
3 changed files with 28 additions and 12 deletions
@@ -72,8 +72,12 @@ void saveParamCallback(){
}
void bindServerCallback(){
wm.server->on("/custom",handleRoute); // this is now crashing esp32 for some reason
// wm.server->on("/info",handleRoute); // you can override wm!
wm.server->on("/custom",handleRoute);
// you can override wm route endpoints, I have not found a way to remove handlers, but this would let you disable them or add auth etc.
// wm.server->on("/info",handleNotFound);
// wm.server->on("/update",handleNotFound);
wm.server->on("/erase",handleNotFound);
}
void handleRoute(){
@@ -81,6 +85,11 @@ void handleRoute(){
wm.server->send(200, "text/plain", "hello from user code");
}
void handleNotFound(){
Serial.println("[HTTP] handle route");
wm.handleNotFound();
}
void handlePreOtaUpdateCallback(){
Update.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("CUSTOM Progress: %u%%\r", (progress / (total / 100)));