Skip to content

Commit

Permalink
feat: swap base64 crate for data-encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Aug 25, 2023
1 parent 68b57c9 commit 2895a0c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ description = "leafcast pi client"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = "0.21"
clap={version="4.4", features = ["derive", "unicode"] }
data-encoding = "2.4.0"
dotenvy = "0.15"
figlet-rs = "0.1"
futures-util = "0.3"
Expand Down
5 changes: 3 additions & 2 deletions src/ws/ws_sender.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use base64::{engine, Engine};
use data_encoding::BASE64;
use futures_util::lock::Mutex;
use futures_util::SinkExt;
use std::process;
Expand Down Expand Up @@ -81,10 +81,11 @@ impl WSSender {
date_time.second()
);
let pi_info = SysInfo::new(&self.app_envs, connected_at).await;

Response::Photo(Photo {
image: format!(
"data:image/webp;base64,{}",
engine::general_purpose::STANDARD.encode(photo_buffer)
BASE64.encode(photo_buffer.as_slice())
),
pi_info,
timestamp,
Expand Down

0 comments on commit 2895a0c

Please sign in to comment.