build: update dependencies
This commit is contained in:
parent
407460d2aa
commit
36d3a18b08
5 changed files with 13 additions and 19 deletions
|
@ -27,15 +27,15 @@ regex = "1.11"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
simple_logger = "5.0.0"
|
simple_logger = "5.0.0"
|
||||||
redis = { version = "0.31.0", features= ["tokio-comp"] }
|
redis = { version = "0.32", features= ["tokio-comp"] }
|
||||||
tokio-tungstenite = { version = "0.26", features = ["native-tls", "url"] }
|
tokio-tungstenite = { version = "0.27", features = ["native-tls", "url"] }
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
url = { version = "2.5", features = ["serde"] }
|
url = { version = "2.5", features = ["serde"] }
|
||||||
uuid = { version = "1.17", features = ["serde", "v7"] }
|
uuid = { version = "1.17", features = ["serde", "v7"] }
|
||||||
random-string = "1.1"
|
random-string = "1.1"
|
||||||
actix-ws = "0.3.0"
|
actix-ws = "0.3.0"
|
||||||
futures-util = "0.3.31"
|
futures-util = "0.3.31"
|
||||||
bunny-api-tokio = "0.3.0"
|
bunny-api-tokio = { version = "0.4", features = ["edge_storage"], default-features = false }
|
||||||
bindet = "0.3.2"
|
bindet = "0.3.2"
|
||||||
deadpool = "0.12"
|
deadpool = "0.12"
|
||||||
diesel = { version = "2.2", features = ["uuid", "chrono"], default-features = false }
|
diesel = { version = "2.2", features = ["uuid", "chrono"], default-features = false }
|
||||||
|
@ -43,7 +43,7 @@ diesel-async = { version = "0.5", features = ["deadpool", "postgres", "async-con
|
||||||
diesel_migrations = { version = "2.2.0", features = ["postgres"] }
|
diesel_migrations = { version = "2.2.0", features = ["postgres"] }
|
||||||
thiserror = "2.0.12"
|
thiserror = "2.0.12"
|
||||||
actix-multipart = "0.7.2"
|
actix-multipart = "0.7.2"
|
||||||
lettre = { version = "0.11.16", features = ["tokio1", "tokio1-native-tls"] }
|
lettre = { version = "0.11", features = ["tokio1", "tokio1-native-tls"] }
|
||||||
chrono = { version = "0.4.41", features = ["serde"] }
|
chrono = { version = "0.4.41", features = ["serde"] }
|
||||||
|
|
||||||
[dependencies.tokio]
|
[dependencies.tokio]
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub async fn upload(
|
||||||
|
|
||||||
guild
|
guild
|
||||||
.set_icon(
|
.set_icon(
|
||||||
&data.bunny_cdn,
|
&data.bunny_storage,
|
||||||
&mut conn,
|
&mut conn,
|
||||||
data.config.bunny.cdn_url.clone(),
|
data.config.bunny.cdn_url.clone(),
|
||||||
bytes,
|
bytes,
|
||||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -40,7 +40,7 @@ pub struct Data {
|
||||||
pub config: Config,
|
pub config: Config,
|
||||||
pub argon2: Argon2<'static>,
|
pub argon2: Argon2<'static>,
|
||||||
pub start_time: SystemTime,
|
pub start_time: SystemTime,
|
||||||
pub bunny_cdn: bunny_api_tokio::Client,
|
pub bunny_storage: bunny_api_tokio::EdgeStorageClient,
|
||||||
pub mail_client: MailClient,
|
pub mail_client: MailClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,14 +65,9 @@ async fn main() -> Result<(), Error> {
|
||||||
|
|
||||||
let cache_pool = redis::Client::open(config.cache_database.url())?;
|
let cache_pool = redis::Client::open(config.cache_database.url())?;
|
||||||
|
|
||||||
let mut bunny_cdn = bunny_api_tokio::Client::new("").await?;
|
|
||||||
|
|
||||||
let bunny = config.bunny.clone();
|
let bunny = config.bunny.clone();
|
||||||
|
|
||||||
bunny_cdn
|
let bunny_storage = bunny_api_tokio::EdgeStorageClient::new(bunny.api_key, bunny.endpoint, bunny.storage_zone).await?;
|
||||||
.storage
|
|
||||||
.init(bunny.api_key, bunny.endpoint, bunny.storage_zone)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let mail = config.mail.clone();
|
let mail = config.mail.clone();
|
||||||
|
|
||||||
|
@ -122,7 +117,7 @@ async fn main() -> Result<(), Error> {
|
||||||
// TODO: Possibly implement "pepper" into this (thinking it could generate one if it doesnt exist and store it on disk)
|
// TODO: Possibly implement "pepper" into this (thinking it could generate one if it doesnt exist and store it on disk)
|
||||||
argon2: Argon2::default(),
|
argon2: Argon2::default(),
|
||||||
start_time: SystemTime::now(),
|
start_time: SystemTime::now(),
|
||||||
bunny_cdn,
|
bunny_storage,
|
||||||
mail_client,
|
mail_client,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ impl Guild {
|
||||||
// FIXME: Horrible security
|
// FIXME: Horrible security
|
||||||
pub async fn set_icon(
|
pub async fn set_icon(
|
||||||
&mut self,
|
&mut self,
|
||||||
bunny_cdn: &bunny_api_tokio::Client,
|
bunny_storage: &bunny_api_tokio::EdgeStorageClient,
|
||||||
conn: &mut Conn,
|
conn: &mut Conn,
|
||||||
cdn_url: Url,
|
cdn_url: Url,
|
||||||
icon: BytesMut,
|
icon: BytesMut,
|
||||||
|
@ -199,12 +199,12 @@ impl Guild {
|
||||||
if let Some(icon) = &self.icon {
|
if let Some(icon) = &self.icon {
|
||||||
let relative_url = icon.path().trim_start_matches('/');
|
let relative_url = icon.path().trim_start_matches('/');
|
||||||
|
|
||||||
bunny_cdn.storage.delete(relative_url).await?;
|
bunny_storage.delete(relative_url).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = format!("icons/{}/icon.{}", self.uuid, image_type);
|
let path = format!("icons/{}/icon.{}", self.uuid, image_type);
|
||||||
|
|
||||||
bunny_cdn.storage.upload(path.clone(), icon.into()).await?;
|
bunny_storage.upload(path.clone(), icon.into()).await?;
|
||||||
|
|
||||||
let icon_url = cdn_url.join(&path)?;
|
let icon_url = cdn_url.join(&path)?;
|
||||||
|
|
||||||
|
|
|
@ -85,13 +85,12 @@ impl Me {
|
||||||
|
|
||||||
let relative_url = avatar_url.path().trim_start_matches('/');
|
let relative_url = avatar_url.path().trim_start_matches('/');
|
||||||
|
|
||||||
data.bunny_cdn.storage.delete(relative_url).await?;
|
data.bunny_storage.delete(relative_url).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = format!("avatar/{}/avatar.{}", self.uuid, image_type);
|
let path = format!("avatar/{}/avatar.{}", self.uuid, image_type);
|
||||||
|
|
||||||
data.bunny_cdn
|
data.bunny_storage
|
||||||
.storage
|
|
||||||
.upload(path.clone(), avatar.into())
|
.upload(path.clone(), avatar.into())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue