Skip to content

Commit

Permalink
backend: Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pbzweihander committed May 13, 2024
1 parent 39debfb commit 5c141f2
Show file tree
Hide file tree
Showing 16 changed files with 998 additions and 682 deletions.
1,546 changes: 928 additions & 618 deletions Cargo.lock

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,56 @@ version = "0.1.0"
edition = "2021"

[dependencies]
activitypub_federation = { version = "0.4.6", default-features = false, features = [
activitypub_federation = { version = "0.5.6", default-features = false, features = [
"axum",
] }
anyhow = { version = "1.0.72", features = ["backtrace"] }
anyhow = { version = "1.0.83", features = ["backtrace"] }
askama = { version = "0.12.1", features = ["with-axum"] }
askama_axum = "0.3.0"
async-stream = "0.3.5"
async-trait = "0.1.72"
async-trait = "0.1.80"
axum = { version = "0.6.20", features = ["headers"] }
axum-client-ip = "0.4.2"
axum-extra = { version = "0.8.0", features = ["async-read-body"] }
bcrypt = "0.15.0"
chrono = { version = "0.4.26", features = ["serde"] }
bcrypt = "0.15.1"
chrono = { version = "0.4.38", features = ["serde"] }
derivative = "2.2.0"
dotenvy = "0.15.7"
enum_delegate = "0.2.0"
envy = "0.4.2"
futures-util = "0.3.28"
futures-util = "0.3.30"
include_dir = "0.7.3"
migration = { version = "0.1.0", path = "../migration" }
mime = "0.3.17"
mime_guess = "2.0.4"
mime_serde_shim = "0.2.2"
object_store = { version = "0.8.0", features = ["aws"] }
once_cell = "1.18.0"
reqwest = { version = "0.11.18", features = ["json"] }
sea-orm = { version = "0.12.2", features = [
object_store = { version = "0.10.0", features = ["aws"] }
once_cell = "1.19.0"
reqwest = { version = "0.11.27", features = ["json"] }
sea-orm = { version = "0.12.15", features = [
"sqlx-postgres",
"runtime-tokio-native-tls",
"macros",
"sea-orm-internal",
] }
serde = { version = "1.0.182", features = ["derive"] }
serde_json = "1.0.104"
sqlx = { version = "0.7.1", features = ["postgres"] }
sqlx-postgres = "0.7.1"
stopper = "0.2.0"
tokio = { version = "1.29.1", features = [
serde = { version = "1.0.201", features = ["derive"] }
serde_json = "1.0.117"
sqlx = { version = "0.7.4", features = ["postgres"] }
sqlx-postgres = "0.7.4"
stopper = "0.2.7"
tokio = { version = "1.37.0", features = [
"rt-multi-thread",
"macros",
"signal",
"time",
"sync",
] }
tower-http = { version = "0.4.4", features = ["trace"] }
tracing = { version = "0.1.37", features = ["log"] }
tracing = { version = "0.1.40", features = ["log"] }
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "fmt"] }
ulid = { version = "1.0.0", features = ["serde", "uuid"] }
url = { version = "2.4.0", features = ["serde"] }
utoipa = { version = "4.1.0", features = ["axum_extras", "chrono"] }
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "fmt"] }
ulid = { version = "1.1.2", features = ["serde", "uuid"] }
url = { version = "2.5.0", features = ["serde"] }
utoipa = { version = "4.2.3", features = ["axum_extras", "chrono"] }
utoipa-redoc = { version = "1.0.0", features = ["axum"] }
uuid = { version = "1.4.1", features = ["serde", "v4"] }
uuid = { version = "1.8.0", features = ["serde", "v4"] }
8 changes: 5 additions & 3 deletions backend/src/ap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity, config::Data, protocol::context::WithContext,
activity_queue::queue_activity, config::Data, protocol::context::WithContext,
traits::ActivityHandler,
};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -43,11 +43,13 @@ impl NoteOrAnnounce {
Self::Note(note) => {
let create_note = self::note::CreateNote::new(note)?;
let with_context = WithContext::new_default(create_note);
send_activity(with_context, &me, inboxes, data).await
queue_activity(&with_context, &me, inboxes, data).await?;
Ok(())
}
Self::Announce(announce) => {
let with_context = WithContext::new_default(announce);
send_activity(with_context, &me, inboxes, data).await
queue_activity(&with_context, &me, inboxes, data).await?;
Ok(())
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions backend/src/ap/delete.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity,
activity_queue::queue_activity,
config::Data,
kinds::{activity::DeleteType, object::TombstoneType},
protocol::{context::WithContext, verification::verify_domains_match},
Expand Down Expand Up @@ -61,7 +61,8 @@ impl Delete {
pub async fn send(self, data: &Data<State>, inboxes: Vec<Url>) -> Result<(), Error> {
let me = LocalPerson::get(&*data.db).await?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, inboxes, data).await
queue_activity(&with_context, &me, inboxes, data).await?;
Ok(())
}
}

Expand Down
5 changes: 3 additions & 2 deletions backend/src/ap/flag.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity,
activity_queue::queue_activity,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::FlagType,
Expand Down Expand Up @@ -52,7 +52,8 @@ impl Flag {
pub async fn send(self, data: &Data<State>, inbox: Url) -> Result<(), Error> {
let me = LocalPerson::get(&*data.db).await?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, vec![inbox], data).await
queue_activity(&with_context, &me, vec![inbox], data).await?;
Ok(())
}
}

Expand Down
11 changes: 7 additions & 4 deletions backend/src/ap/follow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity,
activity_queue::queue_activity,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::{AcceptType, FollowType, RejectType},
Expand Down Expand Up @@ -48,7 +48,8 @@ impl Follow {
let inbox = object.dereference(data).await?.inbox;
let inbox = Url::parse(&inbox).context_internal_server_error("malformed user inbox URL")?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, vec![inbox], data).await
queue_activity(&with_context, &me, vec![inbox], data).await?;
Ok(())
}
}

Expand Down Expand Up @@ -112,7 +113,8 @@ impl FollowAccept {
let inbox = actor.dereference(data).await?.inbox;
let inbox = Url::parse(&inbox).context_internal_server_error("malformed user inbox URL")?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, vec![inbox], data).await
queue_activity(&with_context, &me, vec![inbox], data).await?;
Ok(())
}
}

Expand Down Expand Up @@ -189,7 +191,8 @@ impl FollowReject {
pub async fn send(self, data: &Data<State>, inbox: Url) -> Result<(), Error> {
let me = LocalPerson::get(&*data.db).await?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, vec![inbox], data).await
queue_activity(&with_context, &me, vec![inbox], data).await?;
Ok(())
}
}

Expand Down
5 changes: 3 additions & 2 deletions backend/src/ap/like.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity,
activity_queue::queue_activity,
config::Data,
fetch::object_id::ObjectId,
kinds::activity::LikeType,
Expand Down Expand Up @@ -53,7 +53,8 @@ impl Like {
let inbox =
Url::parse(&user.inbox).context_internal_server_error("malformed user inbox URL")?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, vec![inbox], data).await
queue_activity(&with_context, &me, vec![inbox], data).await?;
Ok(())
}
}

Expand Down
5 changes: 3 additions & 2 deletions backend/src/ap/person.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity,
activity_queue::queue_activity,
config::Data,
fetch::object_id::ObjectId,
kinds::{activity::UpdateType, object::ImageType, public},
Expand Down Expand Up @@ -277,7 +277,8 @@ impl PersonUpdate {
let me = LocalPerson::get(&*data.db).await?;
let inboxes = get_follower_inboxes(&*data.db).await?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, inboxes, data).await
queue_activity(&with_context, &me, inboxes, data).await?;
Ok(())
}
}

Expand Down
5 changes: 3 additions & 2 deletions backend/src/ap/undo.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use activitypub_federation::{
activity_queue::send_activity,
activity_queue::queue_activity,
config::Data,
kinds::activity::UndoType,
protocol::{context::WithContext, verification::verify_domains_match},
Expand Down Expand Up @@ -56,7 +56,8 @@ where
pub async fn send(self, data: &Data<State>, inboxes: Vec<Url>) -> Result<(), Error> {
let me = LocalPerson::get(&*data.db).await?;
let with_context = WithContext::new_default(self);
send_activity(with_context, &me, inboxes, data).await
queue_activity(&with_context, &me, inboxes, data).await?;
Ok(())
}
}

Expand Down
1 change: 1 addition & 0 deletions backend/src/entity/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
#![allow(unused_imports)]

pub use super::access_key::Entity as AccessKey;
pub use super::emoji::Entity as Emoji;
Expand Down
5 changes: 1 addition & 4 deletions backend/src/entity_impl/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ use crate::entity::sea_orm_active_enums::Visibility;

impl Visibility {
pub fn is_visible(&self) -> bool {
match self {
Self::Public | Self::Home => true,
_ => false,
}
matches!(self, Self::Public | Self::Home)
}
}
6 changes: 3 additions & 3 deletions backend/src/entity_impl/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use activitypub_federation::{
traits::{Actor, Object},
};
use async_trait::async_trait;
use chrono::{NaiveDateTime, Utc};
use chrono::{DateTime, Utc};
use sea_orm::{
ActiveModelTrait, ActiveValue, ColumnTrait, EntityTrait, ModelTrait, QueryFilter, QuerySelect,
TransactionTrait,
Expand All @@ -31,8 +31,8 @@ impl Object for user::Model {
type Kind = Person;
type Error = Error;

fn last_refreshed_at(&self) -> Option<NaiveDateTime> {
Some(self.last_fetched_at.naive_utc())
fn last_refreshed_at(&self) -> Option<DateTime<Utc>> {
Some(self.last_fetched_at.into())
}

#[tracing::instrument(skip(data))]
Expand Down
28 changes: 13 additions & 15 deletions backend/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,20 @@ impl IntoResponse for Error {
self.inner,
self.context
);
} else if CONFIG.debug {
tracing::warn!(
"responding client error, id: {}\n{:?}\nContext\n{}",
self.id,
self.inner,
self.context
);
} else {
if CONFIG.debug {
tracing::warn!(
"responding client error, id: {}\n{:?}\nContext\n{}",
self.id,
self.inner,
self.context
);
} else {
tracing::debug!(
"responding client error, id: {}\n{:?}\nContext\n{}",
self.id,
self.inner,
self.context
);
}
tracing::debug!(
"responding client error, id: {}\n{:?}\nContext\n{}",
self.id,
self.inner,
self.context
);
}
(self.status_code, Json(resp)).into_response()
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/handler/well_known.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async fn get_webfinger(
let name = extract_webfinger_name(&query.resource, &data)
.context_bad_request("failed to extract resource name")?;
if name == setting.user_handle {
let resp = build_webfinger_response(name, LocalPerson::id());
let resp = build_webfinger_response(name.to_string(), LocalPerson::id());
Ok(Json(resp))
} else {
Err(format_err!(NOT_FOUND, "user not found"))
Expand Down
2 changes: 1 addition & 1 deletion backend/src/object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl ObjectStore {
let path = Path::parse(key)
.context_internal_server_error("failed to construct object store key")?;
self.inner
.put(&path, body)
.put(&path, body.into())
.await
.context_internal_server_error("failed to put object to object store")?;
Ok(match &self.config {
Expand Down
2 changes: 1 addition & 1 deletion migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ path = "src/lib.rs"

[dependencies]
async-std = { version = "1", features = ["attributes", "tokio1"] }
sea-orm-migration = { version = "0.12.2", features = ["runtime-tokio-native-tls", "sqlx-postgres"] }
sea-orm-migration = { version = "0.12.15", features = ["runtime-tokio-native-tls", "sqlx-postgres"] }

0 comments on commit 5c141f2

Please sign in to comment.