Skip to content

Commit 34afb58

Browse files
committed
feat: only update when server is trusted
1 parent e4716ab commit 34afb58

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ws.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ async fn ws_rw(
398398
continue;
399399
}
400400

401+
if unsafe { !crate::state::TRUST_SERVER } {
402+
continue;
403+
}
404+
401405
log::info!("Start update: {firmware}/{version}");
402406
log::info!("Begin update size: {size} crc: {crc}");
403407
ota.ota_begin(size, crc).map_err(WsRwError::OtaError)?;
@@ -430,6 +434,10 @@ async fn ws_rw(
430434
continue;
431435
}
432436

437+
if unsafe { !crate::state::TRUST_SERVER } {
438+
continue;
439+
}
440+
433441
let res = ota.ota_write_chunk(data);
434442
if res == Ok(true) {
435443
log::info!("OTA complete! Veryfying..");

0 commit comments

Comments
 (0)