mirror of
https://github.com/aljazceru/pubky-core.git
synced 2025-12-31 04:44:37 +01:00
fix: clippy
This commit is contained in:
@@ -66,7 +66,7 @@ impl EntryPath {
|
||||
|
||||
impl std::fmt::Display for EntryPath {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", &self)
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,22 +108,20 @@ pub struct CookieJar {
|
||||
impl CookieJar {
|
||||
pub(crate) fn store_session_after_signup(&self, response: &Response, pubky: PublicKey) {
|
||||
for (header_name, header_value) in response.headers() {
|
||||
if header_name == "set-cookie" {
|
||||
if header_value.as_ref().starts_with(b"session_id=") {
|
||||
if let Ok(Ok(cookie)) =
|
||||
std::str::from_utf8(header_value.as_bytes()).map(cookie::Cookie::parse)
|
||||
{
|
||||
if cookie.name() == "session_id" {
|
||||
let domain = format!("_pubky.{pubky}");
|
||||
tracing::debug!(?cookie, "Storing coookie after signup");
|
||||
if header_name == "set-cookie" && header_value.as_ref().starts_with(b"session_id=") {
|
||||
if let Ok(Ok(cookie)) =
|
||||
std::str::from_utf8(header_value.as_bytes()).map(cookie::Cookie::parse)
|
||||
{
|
||||
if cookie.name() == "session_id" {
|
||||
let domain = format!("_pubky.{pubky}");
|
||||
tracing::debug!(?cookie, "Storing coookie after signup");
|
||||
|
||||
self.pubky_sessions
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(domain, cookie.value().to_string());
|
||||
}
|
||||
};
|
||||
}
|
||||
self.pubky_sessions
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(domain, cookie.value().to_string());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,9 +164,7 @@ impl CookieStore for CookieJar {
|
||||
.read()
|
||||
.unwrap()
|
||||
.get(url.host_str().unwrap())
|
||||
.and_then(|secret| {
|
||||
Some(HeaderValue::try_from(format!("session_id={secret}")).unwrap())
|
||||
});
|
||||
.map(|secret| HeaderValue::try_from(format!("session_id={secret}")).unwrap());
|
||||
}
|
||||
|
||||
HeaderValue::from_maybe_shared(bytes::Bytes::from(s)).ok()
|
||||
|
||||
Reference in New Issue
Block a user