Display the list of OTA updates in the frontend

This commit is contained in:
2024-10-08 21:53:21 +02:00
parent 2924d14281
commit 6cf7c2cae1
8 changed files with 113 additions and 5 deletions

View File

@ -10,7 +10,7 @@ use actix_multipart::form::MultipartForm;
use actix_web::{web, HttpResponse};
pub async fn supported_platforms() -> HttpResult {
Ok(HttpResponse::Ok().json(vec![OTAPlatform::Wt32Eth01]))
Ok(HttpResponse::Ok().json(OTAPlatform::supported_platforms()))
}
#[derive(Debug, MultipartForm)]
@ -53,6 +53,11 @@ pub async fn upload_firmware(
Ok(HttpResponse::Accepted().body("OTA update successfully saved."))
}
/// Get the list of all OTA updates
pub async fn list_all_ota() -> HttpResult {
Ok(HttpResponse::Ok().json(ota_manager::get_all_ota_updates()?))
}
#[derive(serde::Deserialize)]
pub struct ListOTAPath {
platform: OTAPlatform,