refactor!: use rustls instead of native-tls (#4901)

* refactor(utils): remove apub

* refactor(utils): remove apub

* refactor(utils): remove openssl

* refactor(utils): remove openssl

* Use rustls instead of native-tls.

* refactor(utils): remove apub

* refactor(utils): remove apub

* refactor(utils): remove openssl

* refactor(utils): remove openssl

* Use rustls instead of native-tls.

* Upping activitypub_federation dep

* Using git dep of webmention.

---------

Co-authored-by: Dessalines <tyhou13@gmx.com>
This commit is contained in:
藍+85CD 2024-07-18 20:40:43 +08:00 committed by GitHub
parent 8abbd56400
commit 847c01f348
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 204 additions and 504 deletions

661
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -99,7 +99,7 @@ lemmy_db_views = { version = "=0.19.5", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.5", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.5", path = "./crates/db_views_moderator" }
lemmy_federate = { version = "=0.19.5", path = "./crates/federate" }
activitypub_federation = { version = "0.5.6", default-features = false, features = [
activitypub_federation = { version = "0.5.8", default-features = false, features = [
"actix-web",
] }
diesel = "2.1.6"
@ -121,7 +121,12 @@ tracing-error = "0.2.0"
tracing-log = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
url = { version = "2.5.0", features = ["serde"] }
reqwest = { version = "0.11.27", features = ["json", "blocking", "gzip"] }
reqwest = { version = "0.11.27", default-features = false, features = [
"json",
"blocking",
"gzip",
"rustls-tls",
] }
reqwest-middleware = "0.2.5"
reqwest-tracing = "0.4.8"
clokwerk = "0.4.0"

View File

@ -28,7 +28,7 @@ uuid = { workspace = true }
moka.workspace = true
once_cell.workspace = true
anyhow.workspace = true
webmention = "0.5.0"
webmention = { git = "https://github.com/dessalines/webmention", branch = "remove_reqwest_default_features" }
accept-language = "3.1.0"
[package.metadata.cargo-machete]

View File

@ -31,6 +31,7 @@ impl LocalUserVoteDisplayMode {
.get_result::<Self>(conn)
.await
}
pub async fn update(
pool: &mut DbPool<'_>,
local_user_id: LocalUserId,

View File

@ -44,7 +44,6 @@ full = [
"dep:enum-map",
"dep:futures",
"dep:tokio",
"dep:openssl",
"dep:html2text",
"dep:lettre",
"dep:uuid",
@ -74,13 +73,14 @@ uuid = { workspace = true, features = ["serde", "v4"], optional = true }
rosetta-i18n = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
urlencoding = { workspace = true, optional = true }
openssl = { version = "0.10.64", optional = true }
html2text = { version = "0.12.5", optional = true }
deser-hjson = { version = "2.2.4", optional = true }
smart-default = { version = "0.7.1", optional = true }
lettre = { version = "0.11.7", features = [
lettre = { version = "0.11.7", default-features = false, features = [
"builder",
"tokio1",
"tokio1-native-tls",
"tokio1-rustls-tls",
"smtp-transport",
], optional = true }
markdown-it = { version = "0.6.0", optional = true }
ts-rs = { workspace = true, optional = true }

View File

@ -1,26 +0,0 @@
use openssl::{pkey::PKey, rsa::Rsa};
use std::io::{Error, ErrorKind};
pub struct Keypair {
pub private_key: String,
pub public_key: String,
}
/// Generate the asymmetric keypair for ActivityPub HTTP signatures.
pub fn generate_actor_keypair() -> Result<Keypair, Error> {
let rsa = Rsa::generate(2048)?;
let pkey = PKey::from_rsa(rsa)?;
let public_key = pkey.public_key_to_pem()?;
let private_key = pkey.private_key_to_pem_pkcs8()?;
let key_to_string = |key| match String::from_utf8(key) {
Ok(s) => Ok(s),
Err(e) => Err(Error::new(
ErrorKind::Other,
format!("Failed converting key to string: {e}"),
)),
};
Ok(Keypair {
private_key: key_to_string(private_key)?,
public_key: key_to_string(public_key)?,
})
}

View File

@ -2,7 +2,6 @@ use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "full")] {
pub mod apub;
pub mod cache_header;
pub mod email;
pub mod rate_limit;