feat: add POST /api/action/sync-time endpoint for manual NTP/RTC sync

Allows triggering NTP sync + hardware RTC write from the web UI,
useful for periodic manual time correction (e.g., every 30 days
or when charging).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-05 20:42:25 -04:00
parent ac6c6eaf79
commit b2f85d752a

View File

@@ -183,6 +183,12 @@ void AppWebServer::setupAPIRoutes() {
req->send(200, "application/json", response);
});
_server.on("/api/action/sync-time", HTTP_POST,
[this](AsyncWebServerRequest* req) {
_wifi->syncNTP();
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"RTC synced\"}");
});
_server.on("/api/action/reboot", HTTP_POST,
[](AsyncWebServerRequest* req) {
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"Rebooting...\"}");