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:
@@ -183,6 +183,12 @@ void AppWebServer::setupAPIRoutes() {
|
|||||||
req->send(200, "application/json", response);
|
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,
|
_server.on("/api/action/reboot", HTTP_POST,
|
||||||
[](AsyncWebServerRequest* req) {
|
[](AsyncWebServerRequest* req) {
|
||||||
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"Rebooting...\"}");
|
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"Rebooting...\"}");
|
||||||
|
|||||||
Reference in New Issue
Block a user