1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

chore: upgrade rust

this is needed for recent versions of ruma
This commit is contained in:
Matthias Ahouansou 2025-02-23 13:50:02 +00:00
parent 3686f6d260
commit 406367b4f2
No known key found for this signature in database
13 changed files with 23 additions and 26 deletions

View file

@ -19,7 +19,7 @@ repository = "https://gitlab.com/famedly/conduit"
version = "0.10.0-alpha" version = "0.10.0-alpha"
# See also `rust-toolchain.toml` # See also `rust-toolchain.toml`
rust-version = "1.79.0" rust-version = "1.80.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
FROM rust:1.79.0 FROM rust:1.80.0
WORKDIR /workdir WORKDIR /workdir

View file

@ -59,7 +59,7 @@
file = ./rust-toolchain.toml; file = ./rust-toolchain.toml;
# See also `rust-toolchain.toml` # See also `rust-toolchain.toml`
sha256 = "sha256-Ngiz76YP4HTY75GGdH2P+APE/DEIx2R/Dn+BwwOyzZU="; sha256 = "sha256-6eN/GKzjVSjEhGO9FhWObkRFaE1Jf+uqMSdQnb8lcB4=";
}; };
}); });
in in

View file

@ -9,7 +9,7 @@
# If you're having trouble making the relevant changes, bug a maintainer. # If you're having trouble making the relevant changes, bug a maintainer.
[toolchain] [toolchain]
channel = "1.79.0" channel = "1.80.0"
components = [ components = [
# For rust-analyzer # For rust-analyzer
"rust-src", "rust-src",

View file

@ -305,7 +305,7 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe
/// - Requires UIAA to verify user password /// - Requires UIAA to verify user password
/// - Changes the password of the sender user /// - Changes the password of the sender user
/// - The password hash is calculated using argon2 with 32 character salt, the plain password is /// - The password hash is calculated using argon2 with 32 character salt, the plain password is
/// not saved /// not saved
/// ///
/// If logout_devices is true it does the following for each device except the sender device: /// If logout_devices is true it does the following for each device except the sender device:
/// - Invalidates access token /// - Invalidates access token

View file

@ -11,7 +11,7 @@ use tracing::error;
/// Allows loading room history around an event. /// Allows loading room history around an event.
/// ///
/// - Only works if the user is joined (TODO: always allow, but only show events if the user was /// - Only works if the user is joined (TODO: always allow, but only show events if the user was
/// joined, depending on history_visibility) /// joined, depending on history_visibility)
pub async fn get_context_route( pub async fn get_context_route(
body: Ruma<get_context::v3::Request>, body: Ruma<get_context::v3::Request>,
) -> Result<get_context::v3::Response> { ) -> Result<get_context::v3::Response> {

View file

@ -115,7 +115,7 @@ pub async fn send_message_event_route(
/// Allows paginating through room history. /// Allows paginating through room history.
/// ///
/// - Only works if the user is joined (TODO: always allow, but only show events where the user was /// - Only works if the user is joined (TODO: always allow, but only show events where the user was
/// joined, depending on history_visibility) /// joined, depending on history_visibility)
pub async fn get_message_events_route( pub async fn get_message_events_route(
body: Ruma<get_message_events::v3::Request>, body: Ruma<get_message_events::v3::Request>,
) -> Result<get_message_events::v3::Response> { ) -> Result<get_message_events::v3::Response> {

View file

@ -37,7 +37,7 @@ use tracing::{error, info};
/// Synchronize the client's state with the latest state on the server. /// Synchronize the client's state with the latest state on the server.
/// ///
/// - This endpoint takes a `since` parameter which should be the `next_batch` value from a /// - This endpoint takes a `since` parameter which should be the `next_batch` value from a
/// previous request for incremental syncs. /// previous request for incremental syncs.
/// ///
/// Calling this endpoint without a `since` parameter returns: /// Calling this endpoint without a `since` parameter returns:
/// - Some of the most recent events of each timeline /// - Some of the most recent events of each timeline
@ -49,9 +49,9 @@ use tracing::{error, info};
/// For joined rooms: /// For joined rooms:
/// - Some of the most recent events of each timeline that happened after since /// - Some of the most recent events of each timeline that happened after since
/// - If user joined the room after since: All state events (unless lazy loading is activated) and /// - If user joined the room after since: All state events (unless lazy loading is activated) and
/// all device list updates in that room /// all device list updates in that room
/// - If the user was already in the room: A list of all events that are in the state now, but were /// - If the user was already in the room: A list of all events that are in the state now, but were
/// not in the state at `since` /// not in the state at `since`
/// - If the state we send contains a member event: Joined and invited member counts, heroes /// - If the state we send contains a member event: Joined and invited member counts, heroes
/// - Device list updates that happened after `since` /// - Device list updates that happened after `since`
/// - If there are events in the timeline we send or the user send updated his read mark: Notification counts /// - If there are events in the timeline we send or the user send updated his read mark: Notification counts
@ -65,7 +65,7 @@ use tracing::{error, info};
/// - If the user left after `since`: prev_batch token, empty state (TODO: subset of the state at the point of the leave) /// - If the user left after `since`: prev_batch token, empty state (TODO: subset of the state at the point of the leave)
/// ///
/// - Sync is handled in an async task, multiple requests from the same device with the same /// - Sync is handled in an async task, multiple requests from the same device with the same
/// `since` will be cached /// `since` will be cached
pub async fn sync_events_route( pub async fn sync_events_route(
body: Ruma<sync_events::v3::Request>, body: Ruma<sync_events::v3::Request>,
) -> Result<sync_events::v3::Response, RumaResponse<UiaaResponse>> { ) -> Result<sync_events::v3::Response, RumaResponse<UiaaResponse>> {

View file

@ -12,7 +12,7 @@ use ruma::{
/// Searches all known users for a match. /// Searches all known users for a match.
/// ///
/// - Hides any local users that aren't in any public rooms (i.e. those that have the join rule set to public) /// - Hides any local users that aren't in any public rooms (i.e. those that have the join rule set to public)
/// and don't share a room with the sender /// and don't share a room with the sender
pub async fn search_users_route( pub async fn search_users_route(
body: Ruma<search_users::v3::Request>, body: Ruma<search_users::v3::Request>,
) -> Result<search_users::v3::Response> { ) -> Result<search_users::v3::Response> {

View file

@ -696,7 +696,7 @@ pub async fn get_server_version_route(
/// Gets the public signing keys of this server. /// Gets the public signing keys of this server.
/// ///
/// - Matrix does not support invalidating public keys, so the key returned by this will be valid /// - Matrix does not support invalidating public keys, so the key returned by this will be valid
/// forever. /// forever.
// Response type for this endpoint is Json because we need to calculate a signature for the response // Response type for this endpoint is Json because we need to calculate a signature for the response
pub async fn get_server_keys_route() -> Result<impl IntoResponse> { pub async fn get_server_keys_route() -> Result<impl IntoResponse> {
let mut verify_keys: BTreeMap<OwnedServerSigningKeyId, VerifyKey> = BTreeMap::new(); let mut verify_keys: BTreeMap<OwnedServerSigningKeyId, VerifyKey> = BTreeMap::new();
@ -743,7 +743,7 @@ pub async fn get_server_keys_route() -> Result<impl IntoResponse> {
/// Gets the public signing keys of this server. /// Gets the public signing keys of this server.
/// ///
/// - Matrix does not support invalidating public keys, so the key returned by this will be valid /// - Matrix does not support invalidating public keys, so the key returned by this will be valid
/// forever. /// forever.
pub async fn get_server_keys_deprecated_route() -> impl IntoResponse { pub async fn get_server_keys_deprecated_route() -> impl IntoResponse {
get_server_keys_route().await get_server_keys_route().await
} }

View file

@ -1,5 +1,3 @@
use std::mem;
use ruma::{ use ruma::{
events::receipt::ReceiptEvent, serde::Raw, CanonicalJsonObject, OwnedUserId, RoomId, UserId, events::receipt::ReceiptEvent, serde::Raw, CanonicalJsonObject, OwnedUserId, RoomId, UserId,
}; };
@ -73,12 +71,13 @@ impl service::rooms::edus::read_receipt::Data for KeyValueDatabase {
.iter_from(&first_possible_edu, false) .iter_from(&first_possible_edu, false)
.take_while(move |(k, _)| k.starts_with(&prefix2)) .take_while(move |(k, _)| k.starts_with(&prefix2))
.map(move |(k, v)| { .map(move |(k, v)| {
let count = utils::u64_from_bytes( let count =
&k[prefix.len()..prefix.len() + mem::size_of::<u64>()], utils::u64_from_bytes(&k[prefix.len()..prefix.len() + size_of::<u64>()])
) .map_err(|_| {
.map_err(|_| Error::bad_database("Invalid readreceiptid count in db."))?; Error::bad_database("Invalid readreceiptid count in db.")
})?;
let user_id = UserId::parse( let user_id = UserId::parse(
utils::string_from_bytes(&k[prefix.len() + mem::size_of::<u64>() + 1..]) utils::string_from_bytes(&k[prefix.len() + size_of::<u64>() + 1..])
.map_err(|_| { .map_err(|_| {
Error::bad_database("Invalid readreceiptid userid bytes in db.") Error::bad_database("Invalid readreceiptid userid bytes in db.")
})?, })?,

View file

@ -1,4 +1,4 @@
use std::{mem, sync::Arc}; use std::sync::Arc;
use ruma::{EventId, RoomId, UserId}; use ruma::{EventId, RoomId, UserId};
@ -40,7 +40,7 @@ impl service::rooms::pdu_metadata::Data for KeyValueDatabase {
.iter_from(&current, true) .iter_from(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix)) .take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(tofrom, _data)| { .map(move |(tofrom, _data)| {
let from = utils::u64_from_bytes(&tofrom[(mem::size_of::<u64>())..]) let from = utils::u64_from_bytes(&tofrom[(size_of::<u64>())..])
.map_err(|_| Error::bad_database("Invalid count in tofrom_relation."))?; .map_err(|_| Error::bad_database("Invalid count in tofrom_relation."))?;
let mut pduid = shortroomid.to_be_bytes().to_vec(); let mut pduid = shortroomid.to_be_bytes().to_vec();

View file

@ -1,5 +1,3 @@
use std::mem;
use ruma::{api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId}; use ruma::{api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId};
use crate::{database::KeyValueDatabase, service, services, utils, Error, PduEvent, Result}; use crate::{database::KeyValueDatabase, service, services, utils, Error, PduEvent, Result};
@ -28,7 +26,7 @@ impl service::rooms::threads::Data for KeyValueDatabase {
.iter_from(&current, true) .iter_from(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix)) .take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(pduid, _users)| { .map(move |(pduid, _users)| {
let count = utils::u64_from_bytes(&pduid[(mem::size_of::<u64>())..]) let count = utils::u64_from_bytes(&pduid[(size_of::<u64>())..])
.map_err(|_| Error::bad_database("Invalid pduid in threadid_userids."))?; .map_err(|_| Error::bad_database("Invalid pduid in threadid_userids."))?;
let mut pdu = services() let mut pdu = services()
.rooms .rooms