refactor(pubky): remove unused session_cookies in PubkyClient

This commit is contained in:
nazeh
2024-09-22 18:33:47 +03:00
parent 966ccc11e1
commit 1f73b72371
3 changed files with 1 additions and 22 deletions

View File

@@ -6,11 +6,6 @@ mod native;
#[cfg(target_arch = "wasm32")]
mod wasm;
#[cfg(target_arch = "wasm32")]
use std::{
collections::HashSet,
sync::{Arc, RwLock},
};
use wasm_bindgen::prelude::*;
@@ -25,9 +20,6 @@ pub struct PubkyClient {
http: reqwest::Client,
#[cfg(not(target_arch = "wasm32"))]
pub(crate) pkarr: pkarr::Client,
/// A cookie jar for nodejs fetch.
#[cfg(target_arch = "wasm32")]
pub(crate) session_cookies: Arc<RwLock<HashSet<String>>>,
#[cfg(target_arch = "wasm32")]
pub(crate) pkarr_relays: Vec<String>,
}

View File

@@ -1,8 +1,3 @@
use std::{
collections::HashSet,
sync::{Arc, RwLock},
};
use wasm_bindgen::prelude::*;
use crate::PubkyClient;
@@ -26,7 +21,6 @@ impl PubkyClient {
pub fn new() -> Self {
Self {
http: reqwest::Client::builder().build().unwrap(),
session_cookies: Arc::new(RwLock::new(HashSet::new())),
pkarr_relays: DEFAULT_RELAYS.into_iter().map(|s| s.to_string()).collect(),
}
}
@@ -37,7 +31,6 @@ impl PubkyClient {
pub fn testnet() -> Self {
Self {
http: reqwest::Client::builder().build().unwrap(),
session_cookies: Arc::new(RwLock::new(HashSet::new())),
pkarr_relays: TESTNET_RELAYS.into_iter().map(|s| s.to_string()).collect(),
}
}

View File

@@ -5,12 +5,6 @@ use url::Url;
impl PubkyClient {
pub(crate) fn inner_request(&self, method: Method, url: Url) -> RequestBuilder {
let mut request = self.http.request(method, url).fetch_credentials_include();
for cookie in self.session_cookies.read().unwrap().iter() {
request = request.header("Cookie", cookie);
}
request
self.http.request(method, url).fetch_credentials_include()
}
}