diff --git a/Cargo.lock b/Cargo.lock index 2c370222..ade7465f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2749,7 +2749,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.10.1" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "assign", "js_int", @@ -2769,7 +2769,7 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.10.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "js_int", "ruma-common", @@ -2781,7 +2781,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "as_variant", "assign", @@ -2804,7 +2804,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "as_variant", "base64 0.22.1", @@ -2834,7 +2834,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "as_variant", "indexmap 2.2.6", @@ -2856,7 +2856,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "js_int", "ruma-common", @@ -2868,7 +2868,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "js_int", "thiserror", @@ -2877,7 +2877,7 @@ dependencies = [ [[package]] name = "ruma-identity-service-api" version = "0.9.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "js_int", "ruma-common", @@ -2887,7 +2887,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "once_cell", "proc-macro-crate", @@ -2902,7 +2902,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.9.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "js_int", "ruma-common", @@ -2914,7 +2914,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.15.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "base64 0.22.1", "ed25519-dalek", @@ -2930,7 +2930,7 @@ dependencies = [ [[package]] name = "ruma-state-res" version = "0.11.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#f8f6db89d8efa2b4fddbfcaf502759b80cd2d6cb" dependencies = [ "itertools 0.12.1", "js_int", diff --git a/Cargo.toml b/Cargo.toml index 3633bc1d..4c9ba3f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -715,7 +715,6 @@ correctness = "warn" nursery = "warn" ## some sadness -future_not_send = { level = "allow", priority = 1 } # TODO missing_const_for_fn = { level = "allow", priority = 1 } # TODO needless_collect = { level = "allow", priority = 1 } # TODO option_if_let_else = { level = "allow", priority = 1 } # TODO diff --git a/src/api/client/keys.rs b/src/api/client/keys.rs index b021bea1..0cfb0138 100644 --- a/src/api/client/keys.rs +++ b/src/api/client/keys.rs @@ -248,7 +248,7 @@ pub(crate) async fn get_key_changes_route( }) } -pub(crate) async fn get_keys_helper bool>( +pub(crate) async fn get_keys_helper bool + Send>( sender_user: Option<&UserId>, device_keys_input: &BTreeMap>, allowed_signatures: F, include_display_names: bool, ) -> Result { diff --git a/src/router/mod.rs b/src/router/mod.rs index 9bc27356..e9bae3c5 100644 --- a/src/router/mod.rs +++ b/src/router/mod.rs @@ -14,16 +14,16 @@ conduit::mod_ctor! {} conduit::mod_dtor! {} #[no_mangle] -pub extern "Rust" fn start(server: &Arc) -> Pin>>> { +pub extern "Rust" fn start(server: &Arc) -> Pin> + Send>> { Box::pin(run::start(server.clone())) } #[no_mangle] -pub extern "Rust" fn stop(server: &Arc) -> Pin>>> { +pub extern "Rust" fn stop(server: &Arc) -> Pin> + Send>> { Box::pin(run::stop(server.clone())) } #[no_mangle] -pub extern "Rust" fn run(server: &Arc) -> Pin>>> { +pub extern "Rust" fn run(server: &Arc) -> Pin> + Send>> { Box::pin(run::run(server.clone())) } diff --git a/src/service/globals/migrations.rs b/src/service/globals/migrations.rs index aa172b5c..0d0978a7 100644 --- a/src/service/globals/migrations.rs +++ b/src/service/globals/migrations.rs @@ -528,15 +528,20 @@ pub(crate) async fn migrations(db: &KeyValueDatabase, config: &Config) -> Result #[cfg(feature = "sha256_media")] { + use std::path::PathBuf; if services().globals.database_version()? < 14 && cfg!(feature = "sha256_media") { warn!("sha256_media feature flag is enabled, migrating legacy base64 file names to sha256 file names"); // Move old media files to new names + let mut changes = Vec::<(PathBuf, PathBuf)>::new(); for (key, _) in db.mediaid_file.iter() { let old_path = services().globals.get_media_file(&key); debug!("Old file path: {old_path:?}"); let path = services().globals.get_media_file_new(&key); debug!("New file path: {path:?}"); - // move the file to the new location + changes.push((old_path, path)); + } + // move the file to the new location + for (old_path, path) in changes { if old_path.exists() { tokio::fs::rename(&old_path, &path).await?; } diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index 636ba4dd..5736ef1d 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -47,7 +47,7 @@ impl Service { #[tracing::instrument(skip(self, dest, request))] pub async fn send_request(&self, dest: &str, request: T) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_0]; diff --git a/src/service/rooms/event_handler/signing_keys.rs b/src/service/rooms/event_handler/signing_keys.rs index 91ba0aa4..d22af9bd 100644 --- a/src/service/rooms/event_handler/signing_keys.rs +++ b/src/service/rooms/event_handler/signing_keys.rs @@ -28,7 +28,7 @@ impl super::Service { &'a self, events: E, pub_key_map: &RwLock>>, ) -> Result<()> where - E: IntoIterator>, + E: IntoIterator> + Send, { let mut server_key_ids = HashMap::new(); for event in events { diff --git a/src/service/sending/appservice.rs b/src/service/sending/appservice.rs index 4df5b934..721424e1 100644 --- a/src/service/sending/appservice.rs +++ b/src/service/sending/appservice.rs @@ -12,7 +12,7 @@ use crate::{debug_error, services, utils, Error, Result}; /// registration file pub(crate) async fn send_request(registration: Registration, request: T) -> Result> where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_0]; diff --git a/src/service/sending/mod.rs b/src/service/sending/mod.rs index 4ad40f67..ab813489 100644 --- a/src/service/sending/mod.rs +++ b/src/service/sending/mod.rs @@ -219,7 +219,7 @@ impl Service { #[tracing::instrument(skip(self, request), name = "request")] pub async fn send_federation_request(&self, dest: &ServerName, request: T) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { let client = &services().globals.client.federation; send::send(client, dest, request).await @@ -233,7 +233,7 @@ impl Service { &self, registration: Registration, request: T, ) -> Result> where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { appservice::send_request(registration, request).await } diff --git a/src/service/sending/send.rs b/src/service/sending/send.rs index e8432d12..f600f196 100644 --- a/src/service/sending/send.rs +++ b/src/service/sending/send.rs @@ -18,7 +18,7 @@ use crate::{debug_error, debug_warn, services, Error, Result}; #[tracing::instrument(skip_all, name = "send")] pub async fn send(client: &Client, dest: &ServerName, req: T) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { if !services().globals.allow_federation() { return Err(Error::bad_config("Federation is disabled.")); @@ -33,7 +33,7 @@ async fn execute( client: &Client, dest: &ServerName, actual: &ActualDest, request: Request, ) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { let method = request.method().clone(); let url = request.url().clone(); @@ -50,7 +50,7 @@ where async fn prepare(dest: &ServerName, actual: &ActualDest, req: T) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_5]; @@ -72,7 +72,7 @@ async fn handle_response( dest: &ServerName, actual: &ActualDest, method: &Method, url: &Url, mut response: Response, ) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { trace!("Received response from {} for {} with {}", actual.string, url, response.url()); let status = response.status(); @@ -121,7 +121,7 @@ fn handle_error( _dest: &ServerName, actual: &ActualDest, method: &Method, url: &Url, mut e: reqwest::Error, ) -> Result where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { if e.is_timeout() || e.is_connect() { e = e.without_url(); @@ -144,7 +144,7 @@ where fn sign_request(dest: &ServerName, http_request: &mut http::Request>) where - T: OutgoingRequest + Debug, + T: OutgoingRequest + Debug + Send, { let mut req_map = serde_json::Map::new(); if !http_request.body().is_empty() {