1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-16 04:12:53 +01:00

cargo clippy and cargo fmt

Dieser Commit ist enthalten in:
BlockListed 2023-09-09 18:28:02 +02:00
Ursprung 96261f1284
Commit edcd2640d0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 2D204777C477B588
3 geänderte Dateien mit 15 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -113,13 +113,7 @@ async fn sync(data: SyncData, headers: Headers, mut conn: DbConn) -> Json<Value>
let mut ciphers_json = Vec::with_capacity(ciphers.len()); let mut ciphers_json = Vec::with_capacity(ciphers.len());
for c in ciphers { for c in ciphers {
ciphers_json.push( ciphers_json.push(
c.to_json( c.to_json(&headers.base_url, &headers.user.uuid, Some(&cipher_sync_data), CipherSyncType::User, &mut conn)
&headers.base_url,
&headers.user.uuid,
Some(&cipher_sync_data),
CipherSyncType::User,
&mut conn,
)
.await, .await,
); );
} }
@ -166,13 +160,7 @@ async fn get_ciphers(headers: Headers, mut conn: DbConn) -> Json<Value> {
let mut ciphers_json = Vec::with_capacity(ciphers.len()); let mut ciphers_json = Vec::with_capacity(ciphers.len());
for c in ciphers { for c in ciphers {
ciphers_json.push( ciphers_json.push(
c.to_json( c.to_json(&headers.base_url, &headers.user.uuid, Some(&cipher_sync_data), CipherSyncType::User, &mut conn)
&headers.base_url,
&headers.user.uuid,
Some(&cipher_sync_data),
CipherSyncType::User,
&mut conn,
)
.await, .await,
); );
} }

Datei anzeigen

@ -777,9 +777,8 @@ async fn _get_org_details(org_id: &str, base_url: &str, user_uuid: &str, conn: &
let mut ciphers_json = Vec::with_capacity(ciphers.len()); let mut ciphers_json = Vec::with_capacity(ciphers.len());
for c in ciphers { for c in ciphers {
ciphers_json.push( ciphers_json
c.to_json(base_url, user_uuid, Some(&cipher_sync_data), CipherSyncType::Organization, conn).await, .push(c.to_json(base_url, user_uuid, Some(&cipher_sync_data), CipherSyncType::Organization, conn).await);
);
} }
json!(ciphers_json) json!(ciphers_json)
} }

Datei anzeigen

@ -9,7 +9,7 @@ use openssl::rsa::Rsa;
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use serde::ser::Serialize; use serde::ser::Serialize;
use crate::config::{extract_url_origin, extract_url_host}; use crate::config::{extract_url_host, extract_url_origin};
use crate::{error::Error, CONFIG}; use crate::{error::Error, CONFIG};
const JWT_ALGORITHM: Algorithm = Algorithm::RS256; const JWT_ALGORITHM: Algorithm = Algorithm::RS256;
@ -372,10 +372,12 @@ pub struct HostInfo {
} }
fn get_host_info(host: &str) -> Option<HostInfo> { fn get_host_info(host: &str) -> Option<HostInfo> {
CONFIG CONFIG.host_to_domain(host).and_then(|base_url| Some((base_url, CONFIG.domain_origin(host)?))).map(
.host_to_domain(host) |(base_url, origin)| HostInfo {
.and_then(|base_url| Some((base_url, CONFIG.domain_origin(host)?))) base_url,
.and_then(|(base_url, origin)| Some(HostInfo { base_url, origin })) origin,
},
)
} }
fn get_main_host() -> String { fn get_main_host() -> String {
@ -401,9 +403,7 @@ impl<'r> FromRequest<'r> for HostInfo {
}; };
let host_info = get_host_info(host.as_ref()) let host_info = get_host_info(host.as_ref())
.unwrap_or_else(|| { .unwrap_or_else(|| get_host_info(&get_main_host()).expect("Main domain doesn't have entry!"));
get_host_info(&get_main_host()).expect("Main domain doesn't have entry!")
});
return Outcome::Success(host_info); return Outcome::Success(host_info);
} else if let Some(referer) = headers.get_one("Referer") { } else if let Some(referer) = headers.get_one("Referer") {