From fa9e318e410e5cb18ffff9e604bae64ca879a359 Mon Sep 17 00:00:00 2001 From: kernelkind Date: Tue, 18 Feb 2025 16:04:18 -0500 Subject: [PATCH] update ehttp to 0.5.0 Signed-off-by: kernelkind --- Cargo.lock | 17 ++--------------- Cargo.toml | 2 +- crates/notedeck_columns/src/media_upload.rs | 18 ++++++++---------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c91c4842..1eb4a56b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1269,7 +1269,7 @@ checksum = "bf3c1f5cd8dfe2ade470a218696c66cf556fcfd701e7830fa2e9f4428292a2a1" dependencies = [ "ahash", "egui", - "ehttp 0.5.0", + "ehttp", "enum-map", "image", "log", @@ -1326,19 +1326,6 @@ dependencies = [ "web-time 1.1.0", ] -[[package]] -name = "ehttp" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80b69a6f9168b96c0ae04763bec27a8b06b34343c334dd2703a4ec21f0f5e110" -dependencies = [ - "js-sys", - "ureq", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "ehttp" version = "0.5.0" @@ -2809,7 +2796,7 @@ dependencies = [ "egui_nav", "egui_tabs", "egui_virtual_list", - "ehttp 0.2.0", + "ehttp", "enostr", "hex", "image", diff --git a/Cargo.toml b/Cargo.toml index 76cca0d9..b1490234 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ egui_extras = { version = "0.29.1", features = ["all_loaders"] } egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "ac7d663307b76634757024b438dd4b899790da99" } egui_tabs = "0.2.0" egui_virtual_list = "0.5.0" -ehttp = "0.2.0" +ehttp = "0.5.0" enostr = { path = "crates/enostr" } ewebsock = { version = "0.2.0", features = ["tls"] } hex = "0.4.3" diff --git a/crates/notedeck_columns/src/media_upload.rs b/crates/notedeck_columns/src/media_upload.rs index 73447eb8..fb6fb411 100644 --- a/crates/notedeck_columns/src/media_upload.rs +++ b/crates/notedeck_columns/src/media_upload.rs @@ -1,4 +1,4 @@ -use std::{collections::BTreeMap, path::PathBuf}; +use std::path::PathBuf; use base64::{prelude::BASE64_URL_SAFE, Engine}; use ehttp::Request; @@ -104,15 +104,13 @@ fn create_nip96_request( body.extend(file_contents); body.extend(format!("\r\n--{}--\r\n", boundary).as_bytes()); - let headers = { - let mut map = BTreeMap::new(); - map.insert( - "Content-Type".to_owned(), - format!("multipart/form-data; boundary={boundary}"), - ); - map.insert("Authorization".to_owned(), format!("Nostr {nip98_base64}")); - map - }; + let headers = ehttp::Headers::new(&[ + ( + "Content-Type", + format!("multipart/form-data; boundary={boundary}").as_str(), + ), + ("Authorization", format!("Nostr {nip98_base64}").as_str()), + ]); Request { method: "POST".to_string(),