From d680a6ba53de332118a12230636cd5f31693a965 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 2 Nov 2025 00:01:48 +0000 Subject: [PATCH] Bump Ruma for device type optimizations. Signed-off-by: Jason Volk --- Cargo.lock | 21 +++++++++++---------- Cargo.toml | 2 +- src/api/client/device.rs | 4 ++-- src/api/client/keys.rs | 2 +- src/api/server/user.rs | 2 +- src/service/users/device.rs | 4 ++-- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e26c995..546381bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3476,7 +3476,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.13.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "assign", "js_int", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.13.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "js_int", "ruma-common", @@ -3507,7 +3507,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.21.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "as_variant", "assign", @@ -3532,7 +3532,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.16.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "as_variant", "base64", @@ -3566,7 +3566,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.31.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "as_variant", "indexmap", @@ -3593,7 +3593,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.12.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "bytes", "headers", @@ -3608,6 +3608,7 @@ dependencies = [ "ruma-events", "serde", "serde_json", + "smallstr", "thiserror 2.0.17", "tracing", ] @@ -3615,7 +3616,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.11.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "js_int", "thiserror 2.0.17", @@ -3624,7 +3625,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.16.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "cfg-if", "proc-macro-crate", @@ -3639,7 +3640,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.12.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "js_int", "ruma-common", @@ -3651,7 +3652,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.18.0" -source = "git+https://github.com/matrix-construct/ruma?rev=9f4ad222669db368e5e376637d8e29c3bec27272#9f4ad222669db368e5e376637d8e29c3bec27272" +source = "git+https://github.com/matrix-construct/ruma?rev=be88c97057b28374d418394db376a7049d8b6464#be88c97057b28374d418394db376a7049d8b6464" dependencies = [ "base64", "ed25519-dalek", diff --git a/Cargo.toml b/Cargo.toml index 977fede8..31ad5a8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -320,7 +320,7 @@ default-features = false [workspace.dependencies.ruma] git = "https://github.com/matrix-construct/ruma" -rev = "9f4ad222669db368e5e376637d8e29c3bec27272" +rev = "be88c97057b28374d418394db376a7049d8b6464" features = [ "__compat", "appservice-api-c", diff --git a/src/api/client/device.rs b/src/api/client/device.rs index 7563ec6d..67f4f46e 100644 --- a/src/api/client/device.rs +++ b/src/api/client/device.rs @@ -7,7 +7,7 @@ use ruma::{ self, delete_device, delete_devices, get_device, get_devices, update_device, }, }; -use tuwunel_core::{Err, Result, debug, err, utils}; +use tuwunel_core::{Err, Result, debug, err, utils, utils::string::to_small_string}; use crate::{Ruma, client::DEVICE_ID_LENGTH, router::auth_uiaa}; @@ -66,7 +66,7 @@ pub(crate) async fn update_device_route( device .last_seen_ip - .clone_from(&Some(client.to_string())); + .clone_from(&Some(to_small_string(client))); device .last_seen_ts diff --git a/src/api/client/keys.rs b/src/api/client/keys.rs index a434af99..f3ce0a9d 100644 --- a/src/api/client/keys.rs +++ b/src/api/client/keys.rs @@ -571,7 +571,7 @@ fn add_unsigned_device_display_name( .or_insert_with(|| CanonicalJsonObject::default().into()) { let display_name = if include_display_names { - CanonicalJsonValue::String(display_name) + CanonicalJsonValue::String(display_name.to_string()) } else { CanonicalJsonValue::String(metadata.device_id.into()) }; diff --git a/src/api/server/user.rs b/src/api/server/user.rs index fdaebf52..d24cb9a1 100644 --- a/src/api/server/user.rs +++ b/src/api/server/user.rs @@ -58,7 +58,7 @@ pub(crate) async fn get_devices_route( .allow_device_name_federation .then_some(display_name) .flatten() - .or_else(|| Some(device_id.as_str().to_owned())); + .or_else(|| Some(device_id.as_str().into())); services .users diff --git a/src/service/users/device.rs b/src/service/users/device.rs index 09fcfae7..ce02af3b 100644 --- a/src/service/users/device.rs +++ b/src/service/users/device.rs @@ -43,8 +43,8 @@ pub async fn create_device( let notify = true; self.put_device_metadata(user_id, notify, &Device { device_id: device_id.into(), - display_name: initial_device_display_name, - last_seen_ip: client_ip, + display_name: initial_device_display_name.map(Into::into), + last_seen_ip: client_ip.map(Into::into), last_seen_ts: Some(MilliSecondsSinceUnixEpoch::now()), });