show build version in html
This commit is contained in:
@@ -22,6 +22,12 @@ struct SSIDList<'a> {
|
||||
ssids: Vec<&'a String<32>>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
struct VersionInfo<'a> {
|
||||
git_hash: &'a str,
|
||||
build_time: &'a str
|
||||
}
|
||||
|
||||
pub fn httpd_initial(reboot_now: Arc<AtomicBool>) -> Box<EspHttpServer<'static>> {
|
||||
let mut server = shared();
|
||||
server
|
||||
@@ -170,7 +176,14 @@ pub fn shared() -> Box<EspHttpServer<'static>> {
|
||||
server
|
||||
.fn_handler("/version", Method::Get, |request| {
|
||||
let mut response = request.into_ok_response()?;
|
||||
response.write(env!("VERGEN_GIT_DESCRIBE").as_bytes())?;
|
||||
let git_hash = env!("VERGEN_GIT_DESCRIBE");
|
||||
let build_time = env!("VERGEN_BUILD_TIMESTAMP");
|
||||
let version_info = VersionInfo{
|
||||
git_hash,
|
||||
build_time,
|
||||
};
|
||||
let version_info_json = serde_json::to_string(&version_info)?;
|
||||
response.write(version_info_json.as_bytes())?;
|
||||
anyhow::Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user