Formatting

This commit is contained in:
Aleksei Voronov 2023-10-16 12:06:41 +02:00
parent f0ca7e58e8
commit 8ad19f6fa5
5 changed files with 17 additions and 9 deletions

View File

@ -79,7 +79,7 @@ impl CommitProcessor for PostIndexer {
} => { } => {
for algo in self.algos.iter_all() { for algo in self.algos.iter_all() {
if algo.should_index_post(author_did, post).await? { if algo.should_index_post(author_did, post).await? {
info!("Received insertable post from {author_did}: {post:?}", ); info!("Received insertable post from {author_did}: {post:?}",);
self.database self.database
.insert_profile_if_it_doesnt_exist(author_did) .insert_profile_if_it_doesnt_exist(author_did)

View File

@ -28,7 +28,9 @@ impl Bluesky {
pub fn unauthenticated() -> Self { pub fn unauthenticated() -> Self {
Self { Self {
client: AtpServiceClient::new(AuthenticateableXrpcClient::new(Self::XRPC_HOST.to_owned())), client: AtpServiceClient::new(AuthenticateableXrpcClient::new(
Self::XRPC_HOST.to_owned(),
)),
session: None, session: None,
} }
} }
@ -36,7 +38,8 @@ impl Bluesky {
pub async fn login(handle: &str, password: &str) -> Result<Self> { pub async fn login(handle: &str, password: &str) -> Result<Self> {
use atrium_api::com::atproto::server::create_session::Input; use atrium_api::com::atproto::server::create_session::Input;
let client = AtpServiceClient::new(AuthenticateableXrpcClient::new(Self::XRPC_HOST.to_owned())); let client =
AtpServiceClient::new(AuthenticateableXrpcClient::new(Self::XRPC_HOST.to_owned()));
let result = client let result = client
.service .service
@ -182,9 +185,13 @@ impl Bluesky {
let url = match cursor { let url = match cursor {
Some(cursor) => format!( Some(cursor) => format!(
"{}/xrpc/com.atproto.sync.subscribeRepos?cursor={}", "{}/xrpc/com.atproto.sync.subscribeRepos?cursor={}",
Self::FIREHOSE_HOST, cursor Self::FIREHOSE_HOST,
cursor
),
None => format!(
"{}/xrpc/com.atproto.sync.subscribeRepos",
Self::FIREHOSE_HOST
), ),
None => format!("{}/xrpc/com.atproto.sync.subscribeRepos", Self::FIREHOSE_HOST),
}; };
let (mut stream, _) = connect_async(url).await?; let (mut stream, _) = connect_async(url).await?;

View File

@ -1,11 +1,11 @@
mod follow; mod follow;
mod like; mod like;
mod post; mod post;
mod session;
mod profile; mod profile;
mod session;
pub use follow::FollowRecord; pub use follow::FollowRecord;
pub use like::LikeRecord; pub use like::LikeRecord;
pub use post::PostRecord; pub use post::PostRecord;
pub use session::Session;
pub use profile::ProfileDetails; pub use profile::ProfileDetails;
pub use session::Session;

View File

@ -26,7 +26,8 @@ impl TryFrom<CborValue> for PostRecord {
.remove("langs") .remove("langs")
.map(|value| value.try_into()) .map(|value| value.try_into())
.transpose()?, .transpose()?,
reply: map.remove("reply") reply: map
.remove("reply")
.map(|value| value.try_into()) .map(|value| value.try_into())
.transpose()?, .transpose()?,
}) })

View File

@ -10,7 +10,7 @@ impl From<ProfileRecord> for ProfileDetails {
fn from(value: ProfileRecord) -> Self { fn from(value: ProfileRecord) -> Self {
Self { Self {
display_name: value.display_name.unwrap_or_default(), display_name: value.display_name.unwrap_or_default(),
description: value.description.unwrap_or_default() description: value.description.unwrap_or_default(),
} }
} }
} }