show build version in html
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
<h2>Current Firmware</h2>
|
||||
<div>
|
||||
<div id="firmware_buildtime">Buildtime loading</div>
|
||||
<div id="firmware_githash">Build githash loading</div>
|
||||
</div>
|
||||
|
||||
<h2>firmeware OTA v3</h2>
|
||||
|
||||
<form id="upload_form" method="post">
|
||||
<input type="file" name="file1" id="file1"><br>
|
||||
<progress id="progressBar" value="0" max="100" style="width:300px;"></progress>
|
||||
@@ -9,6 +16,8 @@
|
||||
<p id="loaded_n_total"></p>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<h2>config</h2>
|
||||
|
||||
<div id="configform">
|
||||
@@ -82,4 +91,4 @@
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
@@ -1,7 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
<input type="button" id="test" value="Test">
|
||||
|
||||
<h2>Current Firmware</h2>
|
||||
<div>
|
||||
<div id="firmware_buildtime">Buildtime loading</div>
|
||||
<div id="firmware_githash">Build githash loading</div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>firmeware OTA v3</h2>
|
||||
<form id="upload_form" method="post">
|
||||
|
@@ -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