mirror of
https://codeberg.org/icewind/tasmota-mqtt-client.git
synced 2026-06-03 18:24:09 +02:00
expose md5 in download output
This commit is contained in:
parent
82cb784ef3
commit
70b2874d3b
4 changed files with 13 additions and 2 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
|
@ -338,6 +338,12 @@ version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex_fmt"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.10"
|
version = "1.0.10"
|
||||||
|
|
@ -711,6 +717,7 @@ dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"hex",
|
"hex",
|
||||||
|
"hex_fmt",
|
||||||
"md-5",
|
"md-5",
|
||||||
"rumqttc",
|
"rumqttc",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,5 @@ hex = "0.4.3"
|
||||||
md-5 = "0.10.6"
|
md-5 = "0.10.6"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
clap = { version = "4.4.18", features = ["derive"] }
|
clap = { version = "4.4.18", features = ["derive"] }
|
||||||
|
hex_fmt = "0.3.0"
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
use hex_fmt::HexFmt;
|
||||||
pub use tasmota_mqtt_client::{Result, TasmotaClient};
|
pub use tasmota_mqtt_client::{Result, TasmotaClient};
|
||||||
|
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
|
|
@ -23,7 +24,7 @@ async fn main() -> Result<()> {
|
||||||
.download_config(&args.device, &args.device_password)
|
.download_config(&args.device, &args.device_password)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
println!("downloaded {}", file.name);
|
println!("downloaded {} with hash {}", file.name, HexFmt(file.md5));
|
||||||
if let Err(e) = std::fs::write(&file.name, file.data) {
|
if let Err(e) = std::fs::write(&file.name, file.data) {
|
||||||
eprintln!("Error while saving {}: {:#}", file.name, e);
|
eprintln!("Error while saving {}: {:#}", file.name, e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ struct DownloadState {
|
||||||
pub struct DownloadedFile {
|
pub struct DownloadedFile {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub data: Bytes,
|
pub data: Bytes,
|
||||||
|
pub md5: [u8; 16],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
|
|
@ -131,5 +132,6 @@ pub async fn download_config(
|
||||||
Ok(DownloadedFile {
|
Ok(DownloadedFile {
|
||||||
name: state.name,
|
name: state.name,
|
||||||
data: state.data.freeze(),
|
data: state.data.freeze(),
|
||||||
|
md5: state.md5,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue