frontend-ota (#1)

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2026-03-03 19:41:33 -05:00
parent 80114b1d9f
commit 9bce74e027
19 changed files with 843 additions and 75 deletions

View File

@@ -13,9 +13,12 @@
#endif
// Project
#include "api/ota/frontend.cpp"
#include "api/ota/status.cpp"
#include "api/system/info.cpp"
#include "api/system/reboot.cpp"
internal const char *TAG = "HTTP_SERVER";
constexpr uint8 kGZ_Extension_Length = sizeof(".gz") - 1;
@@ -178,7 +181,7 @@ internal httpd_handle_t start_webserver(void)
#ifdef CONFIG_CALENDINK_DEPLOY_WEB_PAGES
esp_vfs_littlefs_conf_t conf = {};
conf.base_path = "/www";
conf.partition_label = "www";
conf.partition_label = g_Active_WWW_Partition == 0 ? "www_0" : "www_1";
conf.format_if_mount_failed = false;
conf.dont_mount = false;
esp_err_t ret = esp_vfs_littlefs_register(&conf);
@@ -229,6 +232,8 @@ internal httpd_handle_t start_webserver(void)
// Register system API routes
httpd_register_uri_handler(server, &api_system_info_uri);
httpd_register_uri_handler(server, &api_system_reboot_uri);
httpd_register_uri_handler(server, &api_ota_status_uri);
httpd_register_uri_handler(server, &api_ota_frontend_uri);
#ifdef CONFIG_CALENDINK_DEPLOY_WEB_PAGES
// Register static file handler last as a catch-all wildcard if deployed
@@ -253,7 +258,8 @@ internal void stop_webserver(httpd_handle_t server)
{
httpd_stop(server);
#ifdef CONFIG_CALENDINK_DEPLOY_WEB_PAGES
esp_vfs_littlefs_unregister("www");
esp_vfs_littlefs_unregister(g_Active_WWW_Partition == 0 ? "www_0"
: "www_1");
#endif
}
}