From b2f85d752ad3de7438769eaba787b28a822699a9 Mon Sep 17 00:00:00 2001 From: cottongin Date: Wed, 5 Aug 2026 20:42:25 -0400 Subject: [PATCH] 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 --- src/web_server.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/web_server.cpp b/src/web_server.cpp index f86e163..eed8ffd 100644 --- a/src/web_server.cpp +++ b/src/web_server.cpp @@ -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...\"}");