mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
rename Ruma to Ar
This follows the pattern of the previous commit.
This commit is contained in:
parent
7ea98dac72
commit
f8961d5578
37 changed files with 183 additions and 181 deletions
|
|
@ -19,7 +19,7 @@ use ruma::{
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::{api::client_server, services, utils, Error, Ra, Result, Ruma};
|
use crate::{api::client_server, services, utils, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
const RANDOM_USER_ID_LENGTH: usize = 10;
|
const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||||
/// Note: This will not reserve the username, so the username might become
|
/// Note: This will not reserve the username, so the username might become
|
||||||
/// invalid when trying to register
|
/// invalid when trying to register
|
||||||
pub(crate) async fn get_register_available_route(
|
pub(crate) async fn get_register_available_route(
|
||||||
body: Ruma<get_username_availability::v3::Request>,
|
body: Ar<get_username_availability::v3::Request>,
|
||||||
) -> Result<Ra<get_username_availability::v3::Response>> {
|
) -> Result<Ra<get_username_availability::v3::Response>> {
|
||||||
// Validate user id
|
// Validate user id
|
||||||
let user_id = UserId::parse_with_server_name(
|
let user_id = UserId::parse_with_server_name(
|
||||||
|
|
@ -87,7 +87,7 @@ pub(crate) async fn get_register_available_route(
|
||||||
/// `access_token`
|
/// `access_token`
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn register_route(
|
pub(crate) async fn register_route(
|
||||||
body: Ruma<register::v3::Request>,
|
body: Ar<register::v3::Request>,
|
||||||
) -> Result<Ra<register::v3::Response>> {
|
) -> Result<Ra<register::v3::Response>> {
|
||||||
if !services().globals.allow_registration()
|
if !services().globals.allow_registration()
|
||||||
&& body.appservice_info.is_none()
|
&& body.appservice_info.is_none()
|
||||||
|
|
@ -327,7 +327,7 @@ pub(crate) async fn register_route(
|
||||||
/// - Forgets to-device events
|
/// - Forgets to-device events
|
||||||
/// - Triggers device list updates
|
/// - Triggers device list updates
|
||||||
pub(crate) async fn change_password_route(
|
pub(crate) async fn change_password_route(
|
||||||
body: Ruma<change_password::v3::Request>,
|
body: Ar<change_password::v3::Request>,
|
||||||
) -> Result<Ra<change_password::v3::Response>> {
|
) -> Result<Ra<change_password::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
@ -390,7 +390,7 @@ pub(crate) async fn change_password_route(
|
||||||
///
|
///
|
||||||
/// Note: Also works for Application Services
|
/// Note: Also works for Application Services
|
||||||
pub(crate) async fn whoami_route(
|
pub(crate) async fn whoami_route(
|
||||||
body: Ruma<whoami::v3::Request>,
|
body: Ar<whoami::v3::Request>,
|
||||||
) -> Result<Ra<whoami::v3::Response>> {
|
) -> Result<Ra<whoami::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let device_id = body.sender_device.as_ref().cloned();
|
let device_id = body.sender_device.as_ref().cloned();
|
||||||
|
|
@ -415,7 +415,7 @@ pub(crate) async fn whoami_route(
|
||||||
/// - Triggers device list updates
|
/// - Triggers device list updates
|
||||||
/// - Removes ability to log in again
|
/// - Removes ability to log in again
|
||||||
pub(crate) async fn deactivate_route(
|
pub(crate) async fn deactivate_route(
|
||||||
body: Ruma<deactivate::v3::Request>,
|
body: Ar<deactivate::v3::Request>,
|
||||||
) -> Result<Ra<deactivate::v3::Response>> {
|
) -> Result<Ra<deactivate::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
@ -472,7 +472,7 @@ pub(crate) async fn deactivate_route(
|
||||||
///
|
///
|
||||||
/// - Currently always returns empty list
|
/// - Currently always returns empty list
|
||||||
pub(crate) async fn third_party_route(
|
pub(crate) async fn third_party_route(
|
||||||
body: Ruma<get_3pids::v3::Request>,
|
body: Ar<get_3pids::v3::Request>,
|
||||||
) -> Result<Ra<get_3pids::v3::Response>> {
|
) -> Result<Ra<get_3pids::v3::Response>> {
|
||||||
let _sender_user =
|
let _sender_user =
|
||||||
body.sender_user.as_ref().expect("user is authenticated");
|
body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
@ -488,7 +488,7 @@ pub(crate) async fn third_party_route(
|
||||||
/// - 403 signals that The homeserver does not allow the third party identifier
|
/// - 403 signals that The homeserver does not allow the third party identifier
|
||||||
/// as a contact option.
|
/// as a contact option.
|
||||||
pub(crate) async fn request_3pid_management_token_via_email_route(
|
pub(crate) async fn request_3pid_management_token_via_email_route(
|
||||||
_body: Ruma<request_3pid_management_token_via_email::v3::Request>,
|
_body: Ar<request_3pid_management_token_via_email::v3::Request>,
|
||||||
) -> Result<Ra<request_3pid_management_token_via_email::v3::Response>> {
|
) -> Result<Ra<request_3pid_management_token_via_email::v3::Response>> {
|
||||||
Err(Error::BadRequest(
|
Err(Error::BadRequest(
|
||||||
ErrorKind::ThreepidDenied,
|
ErrorKind::ThreepidDenied,
|
||||||
|
|
@ -504,7 +504,7 @@ pub(crate) async fn request_3pid_management_token_via_email_route(
|
||||||
/// - 403 signals that The homeserver does not allow the third party identifier
|
/// - 403 signals that The homeserver does not allow the third party identifier
|
||||||
/// as a contact option.
|
/// as a contact option.
|
||||||
pub(crate) async fn request_3pid_management_token_via_msisdn_route(
|
pub(crate) async fn request_3pid_management_token_via_msisdn_route(
|
||||||
_body: Ruma<request_3pid_management_token_via_msisdn::v3::Request>,
|
_body: Ar<request_3pid_management_token_via_msisdn::v3::Request>,
|
||||||
) -> Result<Ra<request_3pid_management_token_via_msisdn::v3::Response>> {
|
) -> Result<Ra<request_3pid_management_token_via_msisdn::v3::Response>> {
|
||||||
Err(Error::BadRequest(
|
Err(Error::BadRequest(
|
||||||
ErrorKind::ThreepidDenied,
|
ErrorKind::ThreepidDenied,
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ use ruma::{
|
||||||
OwnedRoomAliasId,
|
OwnedRoomAliasId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/directory/room/{roomAlias}`
|
/// # `PUT /_matrix/client/r0/directory/room/{roomAlias}`
|
||||||
///
|
///
|
||||||
/// Creates a new room alias on this server.
|
/// Creates a new room alias on this server.
|
||||||
pub(crate) async fn create_alias_route(
|
pub(crate) async fn create_alias_route(
|
||||||
body: Ruma<create_alias::v3::Request>,
|
body: Ar<create_alias::v3::Request>,
|
||||||
) -> Result<Ra<create_alias::v3::Response>> {
|
) -> Result<Ra<create_alias::v3::Response>> {
|
||||||
if body.room_alias.server_name() != services().globals.server_name() {
|
if body.room_alias.server_name() != services().globals.server_name() {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
|
@ -56,7 +56,7 @@ pub(crate) async fn create_alias_route(
|
||||||
/// - TODO: additional access control checks
|
/// - TODO: additional access control checks
|
||||||
/// - TODO: Update canonical alias event
|
/// - TODO: Update canonical alias event
|
||||||
pub(crate) async fn delete_alias_route(
|
pub(crate) async fn delete_alias_route(
|
||||||
body: Ruma<delete_alias::v3::Request>,
|
body: Ar<delete_alias::v3::Request>,
|
||||||
) -> Result<Ra<delete_alias::v3::Response>> {
|
) -> Result<Ra<delete_alias::v3::Response>> {
|
||||||
if body.room_alias.server_name() != services().globals.server_name() {
|
if body.room_alias.server_name() != services().globals.server_name() {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
|
@ -92,7 +92,7 @@ pub(crate) async fn delete_alias_route(
|
||||||
///
|
///
|
||||||
/// - TODO: Suggest more servers to join via
|
/// - TODO: Suggest more servers to join via
|
||||||
pub(crate) async fn get_alias_route(
|
pub(crate) async fn get_alias_route(
|
||||||
body: Ruma<get_alias::v3::Request>,
|
body: Ar<get_alias::v3::Request>,
|
||||||
) -> Result<Ra<get_alias::v3::Response>> {
|
) -> Result<Ra<get_alias::v3::Response>> {
|
||||||
get_alias_helper(body.body.room_alias).await.map(Ra)
|
get_alias_helper(body.body.room_alias).await.map(Ra)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ use ruma::api::client::{
|
||||||
error::ErrorKind,
|
error::ErrorKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/room_keys/version`
|
/// # `POST /_matrix/client/r0/room_keys/version`
|
||||||
///
|
///
|
||||||
/// Creates a new backup.
|
/// Creates a new backup.
|
||||||
pub(crate) async fn create_backup_version_route(
|
pub(crate) async fn create_backup_version_route(
|
||||||
body: Ruma<create_backup_version::v3::Request>,
|
body: Ar<create_backup_version::v3::Request>,
|
||||||
) -> Result<Ra<create_backup_version::v3::Response>> {
|
) -> Result<Ra<create_backup_version::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let version =
|
let version =
|
||||||
|
|
@ -31,7 +31,7 @@ pub(crate) async fn create_backup_version_route(
|
||||||
/// Update information about an existing backup. Only `auth_data` can be
|
/// Update information about an existing backup. Only `auth_data` can be
|
||||||
/// modified.
|
/// modified.
|
||||||
pub(crate) async fn update_backup_version_route(
|
pub(crate) async fn update_backup_version_route(
|
||||||
body: Ruma<update_backup_version::v3::Request>,
|
body: Ar<update_backup_version::v3::Request>,
|
||||||
) -> Result<Ra<update_backup_version::v3::Response>> {
|
) -> Result<Ra<update_backup_version::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
services().key_backups.update_backup(
|
services().key_backups.update_backup(
|
||||||
|
|
@ -47,7 +47,7 @@ pub(crate) async fn update_backup_version_route(
|
||||||
///
|
///
|
||||||
/// Get information about the latest backup version.
|
/// Get information about the latest backup version.
|
||||||
pub(crate) async fn get_latest_backup_info_route(
|
pub(crate) async fn get_latest_backup_info_route(
|
||||||
body: Ruma<get_latest_backup_info::v3::Request>,
|
body: Ar<get_latest_backup_info::v3::Request>,
|
||||||
) -> Result<Ra<get_latest_backup_info::v3::Response>> {
|
) -> Result<Ra<get_latest_backup_info::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ pub(crate) async fn get_latest_backup_info_route(
|
||||||
///
|
///
|
||||||
/// Get information about an existing backup.
|
/// Get information about an existing backup.
|
||||||
pub(crate) async fn get_backup_info_route(
|
pub(crate) async fn get_backup_info_route(
|
||||||
body: Ruma<get_backup_info::v3::Request>,
|
body: Ar<get_backup_info::v3::Request>,
|
||||||
) -> Result<Ra<get_backup_info::v3::Response>> {
|
) -> Result<Ra<get_backup_info::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let algorithm = services()
|
let algorithm = services()
|
||||||
|
|
@ -105,7 +105,7 @@ pub(crate) async fn get_backup_info_route(
|
||||||
/// - Deletes both information about the backup, as well as all key data related
|
/// - Deletes both information about the backup, as well as all key data related
|
||||||
/// to the backup
|
/// to the backup
|
||||||
pub(crate) async fn delete_backup_version_route(
|
pub(crate) async fn delete_backup_version_route(
|
||||||
body: Ruma<delete_backup_version::v3::Request>,
|
body: Ar<delete_backup_version::v3::Request>,
|
||||||
) -> Result<Ra<delete_backup_version::v3::Response>> {
|
) -> Result<Ra<delete_backup_version::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ pub(crate) async fn delete_backup_version_route(
|
||||||
/// - Adds the keys to the backup
|
/// - Adds the keys to the backup
|
||||||
/// - Returns the new number of keys in this backup and the etag
|
/// - Returns the new number of keys in this backup and the etag
|
||||||
pub(crate) async fn add_backup_keys_route(
|
pub(crate) async fn add_backup_keys_route(
|
||||||
body: Ruma<add_backup_keys::v3::Request>,
|
body: Ar<add_backup_keys::v3::Request>,
|
||||||
) -> Result<Ra<add_backup_keys::v3::Response>> {
|
) -> Result<Ra<add_backup_keys::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -171,7 +171,7 @@ pub(crate) async fn add_backup_keys_route(
|
||||||
/// - Adds the keys to the backup
|
/// - Adds the keys to the backup
|
||||||
/// - Returns the new number of keys in this backup and the etag
|
/// - Returns the new number of keys in this backup and the etag
|
||||||
pub(crate) async fn add_backup_keys_for_room_route(
|
pub(crate) async fn add_backup_keys_for_room_route(
|
||||||
body: Ruma<add_backup_keys_for_room::v3::Request>,
|
body: Ar<add_backup_keys_for_room::v3::Request>,
|
||||||
) -> Result<Ra<add_backup_keys_for_room::v3::Response>> {
|
) -> Result<Ra<add_backup_keys_for_room::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ pub(crate) async fn add_backup_keys_for_room_route(
|
||||||
/// - Adds the keys to the backup
|
/// - Adds the keys to the backup
|
||||||
/// - Returns the new number of keys in this backup and the etag
|
/// - Returns the new number of keys in this backup and the etag
|
||||||
pub(crate) async fn add_backup_keys_for_session_route(
|
pub(crate) async fn add_backup_keys_for_session_route(
|
||||||
body: Ruma<add_backup_keys_for_session::v3::Request>,
|
body: Ar<add_backup_keys_for_session::v3::Request>,
|
||||||
) -> Result<Ra<add_backup_keys_for_session::v3::Response>> {
|
) -> Result<Ra<add_backup_keys_for_session::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -256,7 +256,7 @@ pub(crate) async fn add_backup_keys_for_session_route(
|
||||||
///
|
///
|
||||||
/// Retrieves all keys from the backup.
|
/// Retrieves all keys from the backup.
|
||||||
pub(crate) async fn get_backup_keys_route(
|
pub(crate) async fn get_backup_keys_route(
|
||||||
body: Ruma<get_backup_keys::v3::Request>,
|
body: Ar<get_backup_keys::v3::Request>,
|
||||||
) -> Result<Ra<get_backup_keys::v3::Response>> {
|
) -> Result<Ra<get_backup_keys::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ pub(crate) async fn get_backup_keys_route(
|
||||||
///
|
///
|
||||||
/// Retrieves all keys from the backup for a given room.
|
/// Retrieves all keys from the backup for a given room.
|
||||||
pub(crate) async fn get_backup_keys_for_room_route(
|
pub(crate) async fn get_backup_keys_for_room_route(
|
||||||
body: Ruma<get_backup_keys_for_room::v3::Request>,
|
body: Ar<get_backup_keys_for_room::v3::Request>,
|
||||||
) -> Result<Ra<get_backup_keys_for_room::v3::Response>> {
|
) -> Result<Ra<get_backup_keys_for_room::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -290,7 +290,7 @@ pub(crate) async fn get_backup_keys_for_room_route(
|
||||||
///
|
///
|
||||||
/// Retrieves a key from the backup.
|
/// Retrieves a key from the backup.
|
||||||
pub(crate) async fn get_backup_keys_for_session_route(
|
pub(crate) async fn get_backup_keys_for_session_route(
|
||||||
body: Ruma<get_backup_keys_for_session::v3::Request>,
|
body: Ar<get_backup_keys_for_session::v3::Request>,
|
||||||
) -> Result<Ra<get_backup_keys_for_session::v3::Response>> {
|
) -> Result<Ra<get_backup_keys_for_session::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -316,7 +316,7 @@ pub(crate) async fn get_backup_keys_for_session_route(
|
||||||
///
|
///
|
||||||
/// Delete the keys from the backup.
|
/// Delete the keys from the backup.
|
||||||
pub(crate) async fn delete_backup_keys_route(
|
pub(crate) async fn delete_backup_keys_route(
|
||||||
body: Ruma<delete_backup_keys::v3::Request>,
|
body: Ar<delete_backup_keys::v3::Request>,
|
||||||
) -> Result<Ra<delete_backup_keys::v3::Response>> {
|
) -> Result<Ra<delete_backup_keys::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -336,7 +336,7 @@ pub(crate) async fn delete_backup_keys_route(
|
||||||
///
|
///
|
||||||
/// Delete the keys from the backup for a given room.
|
/// Delete the keys from the backup for a given room.
|
||||||
pub(crate) async fn delete_backup_keys_for_room_route(
|
pub(crate) async fn delete_backup_keys_for_room_route(
|
||||||
body: Ruma<delete_backup_keys_for_room::v3::Request>,
|
body: Ar<delete_backup_keys_for_room::v3::Request>,
|
||||||
) -> Result<Ra<delete_backup_keys_for_room::v3::Response>> {
|
) -> Result<Ra<delete_backup_keys_for_room::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -360,7 +360,7 @@ pub(crate) async fn delete_backup_keys_for_room_route(
|
||||||
///
|
///
|
||||||
/// Delete a key from the backup.
|
/// Delete a key from the backup.
|
||||||
pub(crate) async fn delete_backup_keys_for_session_route(
|
pub(crate) async fn delete_backup_keys_for_session_route(
|
||||||
body: Ruma<delete_backup_keys_for_session::v3::Request>,
|
body: Ar<delete_backup_keys_for_session::v3::Request>,
|
||||||
) -> Result<Ra<delete_backup_keys_for_session::v3::Response>> {
|
) -> Result<Ra<delete_backup_keys_for_session::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@ use ruma::api::client::discovery::get_capabilities::{
|
||||||
self, Capabilities, RoomVersionStability, RoomVersionsCapability,
|
self, Capabilities, RoomVersionStability, RoomVersionsCapability,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Ra, Result, Ruma};
|
use crate::{services, Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/capabilities`
|
/// # `GET /_matrix/client/r0/capabilities`
|
||||||
///
|
///
|
||||||
/// Get information on the supported feature set and other relevent capabilities
|
/// Get information on the supported feature set and other relevent capabilities
|
||||||
/// of this server.
|
/// of this server.
|
||||||
pub(crate) async fn get_capabilities_route(
|
pub(crate) async fn get_capabilities_route(
|
||||||
_body: Ruma<get_capabilities::v3::Request>,
|
_body: Ar<get_capabilities::v3::Request>,
|
||||||
) -> Result<Ra<get_capabilities::v3::Response>> {
|
) -> Result<Ra<get_capabilities::v3::Response>> {
|
||||||
let mut available = BTreeMap::new();
|
let mut available = BTreeMap::new();
|
||||||
for room_version in &services().globals.unstable_room_versions {
|
for room_version in &services().globals.unstable_room_versions {
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ use ruma::{
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::{json, value::RawValue as RawJsonValue};
|
use serde_json::{json, value::RawValue as RawJsonValue};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/user/{userId}/account_data/{type}`
|
/// # `PUT /_matrix/client/r0/user/{userId}/account_data/{type}`
|
||||||
///
|
///
|
||||||
/// Sets some account data for the sender user.
|
/// Sets some account data for the sender user.
|
||||||
pub(crate) async fn set_global_account_data_route(
|
pub(crate) async fn set_global_account_data_route(
|
||||||
body: Ruma<set_global_account_data::v3::Request>,
|
body: Ar<set_global_account_data::v3::Request>,
|
||||||
) -> Result<Ra<set_global_account_data::v3::Response>> {
|
) -> Result<Ra<set_global_account_data::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ pub(crate) async fn set_global_account_data_route(
|
||||||
///
|
///
|
||||||
/// Sets some room account data for the sender user.
|
/// Sets some room account data for the sender user.
|
||||||
pub(crate) async fn set_room_account_data_route(
|
pub(crate) async fn set_room_account_data_route(
|
||||||
body: Ruma<set_room_account_data::v3::Request>,
|
body: Ar<set_room_account_data::v3::Request>,
|
||||||
) -> Result<Ra<set_room_account_data::v3::Response>> {
|
) -> Result<Ra<set_room_account_data::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ pub(crate) async fn set_room_account_data_route(
|
||||||
///
|
///
|
||||||
/// Gets some account data for the sender user.
|
/// Gets some account data for the sender user.
|
||||||
pub(crate) async fn get_global_account_data_route(
|
pub(crate) async fn get_global_account_data_route(
|
||||||
body: Ruma<get_global_account_data::v3::Request>,
|
body: Ar<get_global_account_data::v3::Request>,
|
||||||
) -> Result<Ra<get_global_account_data::v3::Response>> {
|
) -> Result<Ra<get_global_account_data::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ pub(crate) async fn get_global_account_data_route(
|
||||||
///
|
///
|
||||||
/// Gets some room account data for the sender user.
|
/// Gets some room account data for the sender user.
|
||||||
pub(crate) async fn get_room_account_data_route(
|
pub(crate) async fn get_room_account_data_route(
|
||||||
body: Ruma<get_room_account_data::v3::Request>,
|
body: Ar<get_room_account_data::v3::Request>,
|
||||||
) -> Result<Ra<get_room_account_data::v3::Response>> {
|
) -> Result<Ra<get_room_account_data::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/context`
|
/// # `GET /_matrix/client/r0/rooms/{roomId}/context`
|
||||||
///
|
///
|
||||||
|
|
@ -20,7 +20,7 @@ use crate::{services, Error, Ra, Result, Ruma};
|
||||||
/// joined, depending on `history_visibility`)
|
/// joined, depending on `history_visibility`)
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn get_context_route(
|
pub(crate) async fn get_context_route(
|
||||||
body: Ruma<get_context::v3::Request>,
|
body: Ar<get_context::v3::Request>,
|
||||||
) -> Result<Ra<get_context::v3::Response>> {
|
) -> Result<Ra<get_context::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ use ruma::api::client::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::SESSION_ID_LENGTH;
|
use super::SESSION_ID_LENGTH;
|
||||||
use crate::{services, utils, Error, Ra, Result, Ruma};
|
use crate::{services, utils, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/devices`
|
/// # `GET /_matrix/client/r0/devices`
|
||||||
///
|
///
|
||||||
/// Get metadata on all devices of the sender user.
|
/// Get metadata on all devices of the sender user.
|
||||||
pub(crate) async fn get_devices_route(
|
pub(crate) async fn get_devices_route(
|
||||||
body: Ruma<get_devices::v3::Request>,
|
body: Ar<get_devices::v3::Request>,
|
||||||
) -> Result<Ra<get_devices::v3::Response>> {
|
) -> Result<Ra<get_devices::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ pub(crate) async fn get_devices_route(
|
||||||
///
|
///
|
||||||
/// Get metadata on a single device of the sender user.
|
/// Get metadata on a single device of the sender user.
|
||||||
pub(crate) async fn get_device_route(
|
pub(crate) async fn get_device_route(
|
||||||
body: Ruma<get_device::v3::Request>,
|
body: Ar<get_device::v3::Request>,
|
||||||
) -> Result<Ra<get_device::v3::Response>> {
|
) -> Result<Ra<get_device::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ pub(crate) async fn get_device_route(
|
||||||
///
|
///
|
||||||
/// Updates the metadata on a given device of the sender user.
|
/// Updates the metadata on a given device of the sender user.
|
||||||
pub(crate) async fn update_device_route(
|
pub(crate) async fn update_device_route(
|
||||||
body: Ruma<update_device::v3::Request>,
|
body: Ar<update_device::v3::Request>,
|
||||||
) -> Result<Ra<update_device::v3::Response>> {
|
) -> Result<Ra<update_device::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ pub(crate) async fn update_device_route(
|
||||||
/// - Forgets to-device events
|
/// - Forgets to-device events
|
||||||
/// - Triggers device list updates
|
/// - Triggers device list updates
|
||||||
pub(crate) async fn delete_device_route(
|
pub(crate) async fn delete_device_route(
|
||||||
body: Ruma<delete_device::v3::Request>,
|
body: Ar<delete_device::v3::Request>,
|
||||||
) -> Result<Ra<delete_device::v3::Response>> {
|
) -> Result<Ra<delete_device::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
@ -136,7 +136,7 @@ pub(crate) async fn delete_device_route(
|
||||||
/// - Forgets to-device events
|
/// - Forgets to-device events
|
||||||
/// - Triggers device list updates
|
/// - Triggers device list updates
|
||||||
pub(crate) async fn delete_devices_route(
|
pub(crate) async fn delete_devices_route(
|
||||||
body: Ruma<delete_devices::v3::Request>,
|
body: Ar<delete_devices::v3::Request>,
|
||||||
) -> Result<Ra<delete_devices::v3::Response>> {
|
) -> Result<Ra<delete_devices::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/publicRooms`
|
/// # `POST /_matrix/client/r0/publicRooms`
|
||||||
///
|
///
|
||||||
|
|
@ -37,7 +37,7 @@ use crate::{services, Error, Ra, Result, Ruma};
|
||||||
///
|
///
|
||||||
/// - Rooms are ordered by the number of joined members
|
/// - Rooms are ordered by the number of joined members
|
||||||
pub(crate) async fn get_public_rooms_filtered_route(
|
pub(crate) async fn get_public_rooms_filtered_route(
|
||||||
body: Ruma<get_public_rooms_filtered::v3::Request>,
|
body: Ar<get_public_rooms_filtered::v3::Request>,
|
||||||
) -> Result<Ra<get_public_rooms_filtered::v3::Response>> {
|
) -> Result<Ra<get_public_rooms_filtered::v3::Response>> {
|
||||||
get_public_rooms_filtered_helper(
|
get_public_rooms_filtered_helper(
|
||||||
body.server.as_deref(),
|
body.server.as_deref(),
|
||||||
|
|
@ -56,7 +56,7 @@ pub(crate) async fn get_public_rooms_filtered_route(
|
||||||
///
|
///
|
||||||
/// - Rooms are ordered by the number of joined members
|
/// - Rooms are ordered by the number of joined members
|
||||||
pub(crate) async fn get_public_rooms_route(
|
pub(crate) async fn get_public_rooms_route(
|
||||||
body: Ruma<get_public_rooms::v3::Request>,
|
body: Ar<get_public_rooms::v3::Request>,
|
||||||
) -> Result<Ra<get_public_rooms::v3::Response>> {
|
) -> Result<Ra<get_public_rooms::v3::Response>> {
|
||||||
let response = get_public_rooms_filtered_helper(
|
let response = get_public_rooms_filtered_helper(
|
||||||
body.server.as_deref(),
|
body.server.as_deref(),
|
||||||
|
|
@ -81,7 +81,7 @@ pub(crate) async fn get_public_rooms_route(
|
||||||
///
|
///
|
||||||
/// - TODO: Access control checks
|
/// - TODO: Access control checks
|
||||||
pub(crate) async fn set_room_visibility_route(
|
pub(crate) async fn set_room_visibility_route(
|
||||||
body: Ruma<set_room_visibility::v3::Request>,
|
body: Ar<set_room_visibility::v3::Request>,
|
||||||
) -> Result<Ra<set_room_visibility::v3::Response>> {
|
) -> Result<Ra<set_room_visibility::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ pub(crate) async fn set_room_visibility_route(
|
||||||
///
|
///
|
||||||
/// Gets the visibility of a given room in the room directory.
|
/// Gets the visibility of a given room in the room directory.
|
||||||
pub(crate) async fn get_room_visibility_route(
|
pub(crate) async fn get_room_visibility_route(
|
||||||
body: Ruma<get_room_visibility::v3::Request>,
|
body: Ar<get_room_visibility::v3::Request>,
|
||||||
) -> Result<Ra<get_room_visibility::v3::Response>> {
|
) -> Result<Ra<get_room_visibility::v3::Response>> {
|
||||||
if !services().rooms.metadata.exists(&body.room_id)? {
|
if !services().rooms.metadata.exists(&body.room_id)? {
|
||||||
// Return 404 if the room doesn't exist
|
// Return 404 if the room doesn't exist
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use ruma::api::client::{
|
||||||
filter::{create_filter, get_filter},
|
filter::{create_filter, get_filter},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/user/{userId}/filter/{filterId}`
|
/// # `GET /_matrix/client/r0/user/{userId}/filter/{filterId}`
|
||||||
///
|
///
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::{services, Error, Ra, Result, Ruma};
|
||||||
///
|
///
|
||||||
/// - A user can only access their own filters
|
/// - A user can only access their own filters
|
||||||
pub(crate) async fn get_filter_route(
|
pub(crate) async fn get_filter_route(
|
||||||
body: Ruma<get_filter::v3::Request>,
|
body: Ar<get_filter::v3::Request>,
|
||||||
) -> Result<Ra<get_filter::v3::Response>> {
|
) -> Result<Ra<get_filter::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let Some(filter) =
|
let Some(filter) =
|
||||||
|
|
@ -30,7 +30,7 @@ pub(crate) async fn get_filter_route(
|
||||||
///
|
///
|
||||||
/// Creates a new filter to be used by other endpoints.
|
/// Creates a new filter to be used by other endpoints.
|
||||||
pub(crate) async fn create_filter_route(
|
pub(crate) async fn create_filter_route(
|
||||||
body: Ruma<create_filter::v3::Request>,
|
body: Ar<create_filter::v3::Request>,
|
||||||
) -> Result<Ra<create_filter::v3::Response>> {
|
) -> Result<Ra<create_filter::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
Ok(Ra(create_filter::v3::Response::new(
|
Ok(Ra(create_filter::v3::Response::new(
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ use serde_json::json;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::SESSION_ID_LENGTH;
|
use super::SESSION_ID_LENGTH;
|
||||||
use crate::{services, utils, Error, Ra, Result, Ruma};
|
use crate::{services, utils, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/keys/upload`
|
/// # `POST /_matrix/client/r0/keys/upload`
|
||||||
///
|
///
|
||||||
|
|
@ -33,7 +33,7 @@ use crate::{services, utils, Error, Ra, Result, Ruma};
|
||||||
/// - If there are no device keys yet: Adds device keys (TODO: merge with
|
/// - If there are no device keys yet: Adds device keys (TODO: merge with
|
||||||
/// existing keys?)
|
/// existing keys?)
|
||||||
pub(crate) async fn upload_keys_route(
|
pub(crate) async fn upload_keys_route(
|
||||||
body: Ruma<upload_keys::v3::Request>,
|
body: Ar<upload_keys::v3::Request>,
|
||||||
) -> Result<Ra<upload_keys::v3::Response>> {
|
) -> Result<Ra<upload_keys::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
@ -80,7 +80,7 @@ pub(crate) async fn upload_keys_route(
|
||||||
/// - The master and self-signing keys contain signatures that the user is
|
/// - The master and self-signing keys contain signatures that the user is
|
||||||
/// allowed to see
|
/// allowed to see
|
||||||
pub(crate) async fn get_keys_route(
|
pub(crate) async fn get_keys_route(
|
||||||
body: Ruma<get_keys::v3::Request>,
|
body: Ar<get_keys::v3::Request>,
|
||||||
) -> Result<Ra<get_keys::v3::Response>> {
|
) -> Result<Ra<get_keys::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ pub(crate) async fn get_keys_route(
|
||||||
///
|
///
|
||||||
/// Claims one-time keys
|
/// Claims one-time keys
|
||||||
pub(crate) async fn claim_keys_route(
|
pub(crate) async fn claim_keys_route(
|
||||||
body: Ruma<claim_keys::v3::Request>,
|
body: Ar<claim_keys::v3::Request>,
|
||||||
) -> Result<Ra<claim_keys::v3::Response>> {
|
) -> Result<Ra<claim_keys::v3::Response>> {
|
||||||
let response = claim_keys_helper(&body.one_time_keys).await?;
|
let response = claim_keys_helper(&body.one_time_keys).await?;
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@ pub(crate) async fn claim_keys_route(
|
||||||
///
|
///
|
||||||
/// - Requires UIAA to verify password
|
/// - Requires UIAA to verify password
|
||||||
pub(crate) async fn upload_signing_keys_route(
|
pub(crate) async fn upload_signing_keys_route(
|
||||||
body: Ruma<upload_signing_keys::v3::Request>,
|
body: Ar<upload_signing_keys::v3::Request>,
|
||||||
) -> Result<Ra<upload_signing_keys::v3::Response>> {
|
) -> Result<Ra<upload_signing_keys::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
@ -163,7 +163,7 @@ pub(crate) async fn upload_signing_keys_route(
|
||||||
///
|
///
|
||||||
/// Uploads end-to-end key signatures from the sender user.
|
/// Uploads end-to-end key signatures from the sender user.
|
||||||
pub(crate) async fn upload_signatures_route(
|
pub(crate) async fn upload_signatures_route(
|
||||||
body: Ruma<upload_signatures::v3::Request>,
|
body: Ar<upload_signatures::v3::Request>,
|
||||||
) -> Result<Ra<upload_signatures::v3::Response>> {
|
) -> Result<Ra<upload_signatures::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -226,7 +226,7 @@ pub(crate) async fn upload_signatures_route(
|
||||||
///
|
///
|
||||||
/// - TODO: left users
|
/// - TODO: left users
|
||||||
pub(crate) async fn get_key_changes_route(
|
pub(crate) async fn get_key_changes_route(
|
||||||
body: Ruma<get_key_changes::v3::Request>,
|
body: Ar<get_key_changes::v3::Request>,
|
||||||
) -> Result<Ra<get_key_changes::v3::Response>> {
|
) -> Result<Ra<get_key_changes::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,7 @@ use ruma::api::client::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{service::media::FileMeta, services, utils, Ar, Error, Ra, Result};
|
||||||
service::media::FileMeta, services, utils, Error, Ra, Result, Ruma,
|
|
||||||
};
|
|
||||||
|
|
||||||
const MXC_LENGTH: usize = 32;
|
const MXC_LENGTH: usize = 32;
|
||||||
|
|
||||||
|
|
@ -18,7 +16,7 @@ const MXC_LENGTH: usize = 32;
|
||||||
///
|
///
|
||||||
/// Returns max upload size.
|
/// Returns max upload size.
|
||||||
pub(crate) async fn get_media_config_route(
|
pub(crate) async fn get_media_config_route(
|
||||||
_body: Ruma<get_media_config::v3::Request>,
|
_body: Ar<get_media_config::v3::Request>,
|
||||||
) -> Result<Ra<get_media_config::v3::Response>> {
|
) -> Result<Ra<get_media_config::v3::Response>> {
|
||||||
Ok(Ra(get_media_config::v3::Response {
|
Ok(Ra(get_media_config::v3::Response {
|
||||||
upload_size: services().globals.max_request_size().into(),
|
upload_size: services().globals.max_request_size().into(),
|
||||||
|
|
@ -32,7 +30,7 @@ pub(crate) async fn get_media_config_route(
|
||||||
/// - Some metadata will be saved in the database
|
/// - Some metadata will be saved in the database
|
||||||
/// - Media will be saved in the media/ directory
|
/// - Media will be saved in the media/ directory
|
||||||
pub(crate) async fn create_content_route(
|
pub(crate) async fn create_content_route(
|
||||||
body: Ruma<create_content::v3::Request>,
|
body: Ar<create_content::v3::Request>,
|
||||||
) -> Result<Ra<create_content::v3::Response>> {
|
) -> Result<Ra<create_content::v3::Response>> {
|
||||||
let mxc = format!(
|
let mxc = format!(
|
||||||
"mxc://{}/{}",
|
"mxc://{}/{}",
|
||||||
|
|
@ -97,7 +95,7 @@ pub(crate) async fn get_remote_content(
|
||||||
///
|
///
|
||||||
/// - Only allows federation if `allow_remote` is true
|
/// - Only allows federation if `allow_remote` is true
|
||||||
pub(crate) async fn get_content_route(
|
pub(crate) async fn get_content_route(
|
||||||
body: Ruma<get_content::v3::Request>,
|
body: Ar<get_content::v3::Request>,
|
||||||
) -> Result<Ra<get_content::v3::Response>> {
|
) -> Result<Ra<get_content::v3::Response>> {
|
||||||
let mxc = format!("mxc://{}/{}", body.server_name, body.media_id);
|
let mxc = format!("mxc://{}/{}", body.server_name, body.media_id);
|
||||||
|
|
||||||
|
|
@ -131,7 +129,7 @@ pub(crate) async fn get_content_route(
|
||||||
///
|
///
|
||||||
/// - Only allows federation if `allow_remote` is true
|
/// - Only allows federation if `allow_remote` is true
|
||||||
pub(crate) async fn get_content_as_filename_route(
|
pub(crate) async fn get_content_as_filename_route(
|
||||||
body: Ruma<get_content_as_filename::v3::Request>,
|
body: Ar<get_content_as_filename::v3::Request>,
|
||||||
) -> Result<Ra<get_content_as_filename::v3::Response>> {
|
) -> Result<Ra<get_content_as_filename::v3::Response>> {
|
||||||
let mxc = format!("mxc://{}/{}", body.server_name, body.media_id);
|
let mxc = format!("mxc://{}/{}", body.server_name, body.media_id);
|
||||||
|
|
||||||
|
|
@ -177,7 +175,7 @@ pub(crate) async fn get_content_as_filename_route(
|
||||||
///
|
///
|
||||||
/// - Only allows federation if `allow_remote` is true
|
/// - Only allows federation if `allow_remote` is true
|
||||||
pub(crate) async fn get_content_thumbnail_route(
|
pub(crate) async fn get_content_thumbnail_route(
|
||||||
body: Ruma<get_content_thumbnail::v3::Request>,
|
body: Ar<get_content_thumbnail::v3::Request>,
|
||||||
) -> Result<Ra<get_content_thumbnail::v3::Response>> {
|
) -> Result<Ra<get_content_thumbnail::v3::Response>> {
|
||||||
let mxc = format!("mxc://{}/{}", body.server_name, body.media_id);
|
let mxc = format!("mxc://{}/{}", body.server_name, body.media_id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ use tracing::{debug, error, info, warn};
|
||||||
use super::get_alias_helper;
|
use super::get_alias_helper;
|
||||||
use crate::{
|
use crate::{
|
||||||
service::pdu::{gen_event_id_canonical_json, PduBuilder},
|
service::pdu::{gen_event_id_canonical_json, PduBuilder},
|
||||||
services, utils, Error, PduEvent, Ra, Result, Ruma,
|
services, utils, Ar, Error, PduEvent, Ra, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/rooms/{roomId}/join`
|
/// # `POST /_matrix/client/r0/rooms/{roomId}/join`
|
||||||
|
|
@ -48,7 +48,7 @@ use crate::{
|
||||||
/// - If the server does not know about the room: asks other servers over
|
/// - If the server does not know about the room: asks other servers over
|
||||||
/// federation
|
/// federation
|
||||||
pub(crate) async fn join_room_by_id_route(
|
pub(crate) async fn join_room_by_id_route(
|
||||||
body: Ruma<join_room_by_id::v3::Request>,
|
body: Ar<join_room_by_id::v3::Request>,
|
||||||
) -> Result<Ra<join_room_by_id::v3::Response>> {
|
) -> Result<Ra<join_room_by_id::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ pub(crate) async fn join_room_by_id_route(
|
||||||
/// - If the server does not know about the room: asks other servers over
|
/// - If the server does not know about the room: asks other servers over
|
||||||
/// federation
|
/// federation
|
||||||
pub(crate) async fn join_room_by_id_or_alias_route(
|
pub(crate) async fn join_room_by_id_or_alias_route(
|
||||||
body: Ruma<join_room_by_id_or_alias::v3::Request>,
|
body: Ar<join_room_by_id_or_alias::v3::Request>,
|
||||||
) -> Result<Ra<join_room_by_id_or_alias::v3::Response>> {
|
) -> Result<Ra<join_room_by_id_or_alias::v3::Response>> {
|
||||||
let sender_user =
|
let sender_user =
|
||||||
body.sender_user.as_deref().expect("user is authenticated");
|
body.sender_user.as_deref().expect("user is authenticated");
|
||||||
|
|
@ -159,7 +159,7 @@ pub(crate) async fn join_room_by_id_or_alias_route(
|
||||||
///
|
///
|
||||||
/// - This should always work if the user is currently joined.
|
/// - This should always work if the user is currently joined.
|
||||||
pub(crate) async fn leave_room_route(
|
pub(crate) async fn leave_room_route(
|
||||||
body: Ruma<leave_room::v3::Request>,
|
body: Ar<leave_room::v3::Request>,
|
||||||
) -> Result<Ra<leave_room::v3::Response>> {
|
) -> Result<Ra<leave_room::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ pub(crate) async fn leave_room_route(
|
||||||
///
|
///
|
||||||
/// Tries to send an invite event into the room.
|
/// Tries to send an invite event into the room.
|
||||||
pub(crate) async fn invite_user_route(
|
pub(crate) async fn invite_user_route(
|
||||||
body: Ruma<invite_user::v3::Request>,
|
body: Ar<invite_user::v3::Request>,
|
||||||
) -> Result<Ra<invite_user::v3::Response>> {
|
) -> Result<Ra<invite_user::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -198,7 +198,7 @@ pub(crate) async fn invite_user_route(
|
||||||
///
|
///
|
||||||
/// Tries to send a kick event into the room.
|
/// Tries to send a kick event into the room.
|
||||||
pub(crate) async fn kick_user_route(
|
pub(crate) async fn kick_user_route(
|
||||||
body: Ruma<kick_user::v3::Request>,
|
body: Ar<kick_user::v3::Request>,
|
||||||
) -> Result<Ra<kick_user::v3::Response>> {
|
) -> Result<Ra<kick_user::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ pub(crate) async fn kick_user_route(
|
||||||
///
|
///
|
||||||
/// Tries to send a ban event into the room.
|
/// Tries to send a ban event into the room.
|
||||||
pub(crate) async fn ban_user_route(
|
pub(crate) async fn ban_user_route(
|
||||||
body: Ruma<ban_user::v3::Request>,
|
body: Ar<ban_user::v3::Request>,
|
||||||
) -> Result<Ra<ban_user::v3::Response>> {
|
) -> Result<Ra<ban_user::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ pub(crate) async fn ban_user_route(
|
||||||
///
|
///
|
||||||
/// Tries to send an unban event into the room.
|
/// Tries to send an unban event into the room.
|
||||||
pub(crate) async fn unban_user_route(
|
pub(crate) async fn unban_user_route(
|
||||||
body: Ruma<unban_user::v3::Request>,
|
body: Ar<unban_user::v3::Request>,
|
||||||
) -> Result<Ra<unban_user::v3::Response>> {
|
) -> Result<Ra<unban_user::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -428,7 +428,7 @@ pub(crate) async fn unban_user_route(
|
||||||
/// Note: Other devices of the user have no way of knowing the room was
|
/// Note: Other devices of the user have no way of knowing the room was
|
||||||
/// forgotten, so this has to be called from every device
|
/// forgotten, so this has to be called from every device
|
||||||
pub(crate) async fn forget_room_route(
|
pub(crate) async fn forget_room_route(
|
||||||
body: Ruma<forget_room::v3::Request>,
|
body: Ar<forget_room::v3::Request>,
|
||||||
) -> Result<Ra<forget_room::v3::Response>> {
|
) -> Result<Ra<forget_room::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -441,7 +441,7 @@ pub(crate) async fn forget_room_route(
|
||||||
///
|
///
|
||||||
/// Lists all rooms the user has joined.
|
/// Lists all rooms the user has joined.
|
||||||
pub(crate) async fn joined_rooms_route(
|
pub(crate) async fn joined_rooms_route(
|
||||||
body: Ruma<joined_rooms::v3::Request>,
|
body: Ar<joined_rooms::v3::Request>,
|
||||||
) -> Result<Ra<joined_rooms::v3::Response>> {
|
) -> Result<Ra<joined_rooms::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -462,7 +462,7 @@ pub(crate) async fn joined_rooms_route(
|
||||||
///
|
///
|
||||||
/// - Only works if the user is currently joined
|
/// - Only works if the user is currently joined
|
||||||
pub(crate) async fn get_member_events_route(
|
pub(crate) async fn get_member_events_route(
|
||||||
body: Ruma<get_member_events::v3::Request>,
|
body: Ar<get_member_events::v3::Request>,
|
||||||
) -> Result<Ra<get_member_events::v3::Response>> {
|
) -> Result<Ra<get_member_events::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -497,7 +497,7 @@ pub(crate) async fn get_member_events_route(
|
||||||
/// - The sender user must be in the room
|
/// - The sender user must be in the room
|
||||||
/// - TODO: An appservice just needs a puppet joined
|
/// - TODO: An appservice just needs a puppet joined
|
||||||
pub(crate) async fn joined_members_route(
|
pub(crate) async fn joined_members_route(
|
||||||
body: Ruma<joined_members::v3::Request>,
|
body: Ar<joined_members::v3::Request>,
|
||||||
) -> Result<Ra<joined_members::v3::Response>> {
|
) -> Result<Ra<joined_members::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use ruma::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
service::{pdu::PduBuilder, rooms::timeline::PduCount},
|
service::{pdu::PduBuilder, rooms::timeline::PduCount},
|
||||||
services, utils, Error, Ra, Result, Ruma,
|
services, utils, Ar, Error, Ra, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}`
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}`
|
||||||
|
|
@ -27,7 +27,7 @@ use crate::{
|
||||||
/// - Tries to send the event into the room, auth rules will determine if it is
|
/// - Tries to send the event into the room, auth rules will determine if it is
|
||||||
/// allowed
|
/// allowed
|
||||||
pub(crate) async fn send_message_event_route(
|
pub(crate) async fn send_message_event_route(
|
||||||
body: Ruma<send_message_event::v3::Request>,
|
body: Ar<send_message_event::v3::Request>,
|
||||||
) -> Result<Ra<send_message_event::v3::Response>> {
|
) -> Result<Ra<send_message_event::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device = body.sender_device.as_deref();
|
let sender_device = body.sender_device.as_deref();
|
||||||
|
|
@ -130,7 +130,7 @@ pub(crate) async fn send_message_event_route(
|
||||||
/// joined, depending on `history_visibility`)
|
/// joined, depending on `history_visibility`)
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn get_message_events_route(
|
pub(crate) async fn get_message_events_route(
|
||||||
body: Ruma<get_message_events::v3::Request>,
|
body: Ar<get_message_events::v3::Request>,
|
||||||
) -> Result<Ra<get_message_events::v3::Response>> {
|
) -> Result<Ra<get_message_events::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use ruma::{
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
use crate::{service::pdu::PduBuilder, services, Error, Ra, Result, Ruma};
|
use crate::{service::pdu::PduBuilder, services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/profile/{userId}/displayname`
|
/// # `PUT /_matrix/client/r0/profile/{userId}/displayname`
|
||||||
///
|
///
|
||||||
|
|
@ -26,7 +26,7 @@ use crate::{service::pdu::PduBuilder, services, Error, Ra, Result, Ruma};
|
||||||
///
|
///
|
||||||
/// - Also makes sure other users receive the update using presence EDUs
|
/// - Also makes sure other users receive the update using presence EDUs
|
||||||
pub(crate) async fn set_displayname_route(
|
pub(crate) async fn set_displayname_route(
|
||||||
body: Ruma<set_display_name::v3::Request>,
|
body: Ar<set_display_name::v3::Request>,
|
||||||
) -> Result<Ra<set_display_name::v3::Response>> {
|
) -> Result<Ra<set_display_name::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ pub(crate) async fn set_displayname_route(
|
||||||
///
|
///
|
||||||
/// - If user is on another server: Fetches displayname over federation
|
/// - If user is on another server: Fetches displayname over federation
|
||||||
pub(crate) async fn get_displayname_route(
|
pub(crate) async fn get_displayname_route(
|
||||||
body: Ruma<get_display_name::v3::Request>,
|
body: Ar<get_display_name::v3::Request>,
|
||||||
) -> Result<Ra<get_display_name::v3::Response>> {
|
) -> Result<Ra<get_display_name::v3::Response>> {
|
||||||
if body.user_id.server_name() != services().globals.server_name() {
|
if body.user_id.server_name() != services().globals.server_name() {
|
||||||
let response = services()
|
let response = services()
|
||||||
|
|
@ -146,7 +146,7 @@ pub(crate) async fn get_displayname_route(
|
||||||
///
|
///
|
||||||
/// - Also makes sure other users receive the update using presence EDUs
|
/// - Also makes sure other users receive the update using presence EDUs
|
||||||
pub(crate) async fn set_avatar_url_route(
|
pub(crate) async fn set_avatar_url_route(
|
||||||
body: Ruma<set_avatar_url::v3::Request>,
|
body: Ar<set_avatar_url::v3::Request>,
|
||||||
) -> Result<Ra<set_avatar_url::v3::Response>> {
|
) -> Result<Ra<set_avatar_url::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ pub(crate) async fn set_avatar_url_route(
|
||||||
/// - If user is on another server: Fetches `avatar_url` and `blurhash` over
|
/// - If user is on another server: Fetches `avatar_url` and `blurhash` over
|
||||||
/// federation
|
/// federation
|
||||||
pub(crate) async fn get_avatar_url_route(
|
pub(crate) async fn get_avatar_url_route(
|
||||||
body: Ruma<get_avatar_url::v3::Request>,
|
body: Ar<get_avatar_url::v3::Request>,
|
||||||
) -> Result<Ra<get_avatar_url::v3::Response>> {
|
) -> Result<Ra<get_avatar_url::v3::Response>> {
|
||||||
if body.user_id.server_name() != services().globals.server_name() {
|
if body.user_id.server_name() != services().globals.server_name() {
|
||||||
let response = services()
|
let response = services()
|
||||||
|
|
@ -271,7 +271,7 @@ pub(crate) async fn get_avatar_url_route(
|
||||||
///
|
///
|
||||||
/// - If user is on another server: Fetches profile over federation
|
/// - If user is on another server: Fetches profile over federation
|
||||||
pub(crate) async fn get_profile_route(
|
pub(crate) async fn get_profile_route(
|
||||||
body: Ruma<get_profile::v3::Request>,
|
body: Ar<get_profile::v3::Request>,
|
||||||
) -> Result<Ra<get_profile::v3::Response>> {
|
) -> Result<Ra<get_profile::v3::Response>> {
|
||||||
if body.user_id.server_name() != services().globals.server_name() {
|
if body.user_id.server_name() != services().globals.server_name() {
|
||||||
let response = services()
|
let response = services()
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ use ruma::{
|
||||||
push::{AnyPushRuleRef, InsertPushRuleError, RemovePushRuleError},
|
push::{AnyPushRuleRef, InsertPushRuleError, RemovePushRuleError},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/pushrules`
|
/// # `GET /_matrix/client/r0/pushrules`
|
||||||
///
|
///
|
||||||
/// Retrieves the push rules event for this user.
|
/// Retrieves the push rules event for this user.
|
||||||
pub(crate) async fn get_pushrules_all_route(
|
pub(crate) async fn get_pushrules_all_route(
|
||||||
body: Ruma<get_pushrules_all::v3::Request>,
|
body: Ar<get_pushrules_all::v3::Request>,
|
||||||
) -> Result<Ra<get_pushrules_all::v3::Response>> {
|
) -> Result<Ra<get_pushrules_all::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ pub(crate) async fn get_pushrules_all_route(
|
||||||
///
|
///
|
||||||
/// Retrieves a single specified push rule for this user.
|
/// Retrieves a single specified push rule for this user.
|
||||||
pub(crate) async fn get_pushrule_route(
|
pub(crate) async fn get_pushrule_route(
|
||||||
body: Ruma<get_pushrule::v3::Request>,
|
body: Ar<get_pushrule::v3::Request>,
|
||||||
) -> Result<Ra<get_pushrule::v3::Response>> {
|
) -> Result<Ra<get_pushrule::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ pub(crate) async fn get_pushrule_route(
|
||||||
///
|
///
|
||||||
/// Creates a single specified push rule for this user.
|
/// Creates a single specified push rule for this user.
|
||||||
pub(crate) async fn set_pushrule_route(
|
pub(crate) async fn set_pushrule_route(
|
||||||
body: Ruma<set_pushrule::v3::Request>,
|
body: Ar<set_pushrule::v3::Request>,
|
||||||
) -> Result<Ra<set_pushrule::v3::Response>> {
|
) -> Result<Ra<set_pushrule::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let body = body.body;
|
let body = body.body;
|
||||||
|
|
@ -164,7 +164,7 @@ pub(crate) async fn set_pushrule_route(
|
||||||
///
|
///
|
||||||
/// Gets the actions of a single specified push rule for this user.
|
/// Gets the actions of a single specified push rule for this user.
|
||||||
pub(crate) async fn get_pushrule_actions_route(
|
pub(crate) async fn get_pushrule_actions_route(
|
||||||
body: Ruma<get_pushrule_actions::v3::Request>,
|
body: Ar<get_pushrule_actions::v3::Request>,
|
||||||
) -> Result<Ra<get_pushrule_actions::v3::Response>> {
|
) -> Result<Ra<get_pushrule_actions::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ pub(crate) async fn get_pushrule_actions_route(
|
||||||
///
|
///
|
||||||
/// Sets the actions of a single specified push rule for this user.
|
/// Sets the actions of a single specified push rule for this user.
|
||||||
pub(crate) async fn set_pushrule_actions_route(
|
pub(crate) async fn set_pushrule_actions_route(
|
||||||
body: Ruma<set_pushrule_actions::v3::Request>,
|
body: Ar<set_pushrule_actions::v3::Request>,
|
||||||
) -> Result<Ra<set_pushrule_actions::v3::Response>> {
|
) -> Result<Ra<set_pushrule_actions::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -264,7 +264,7 @@ pub(crate) async fn set_pushrule_actions_route(
|
||||||
///
|
///
|
||||||
/// Gets the enabled status of a single specified push rule for this user.
|
/// Gets the enabled status of a single specified push rule for this user.
|
||||||
pub(crate) async fn get_pushrule_enabled_route(
|
pub(crate) async fn get_pushrule_enabled_route(
|
||||||
body: Ruma<get_pushrule_enabled::v3::Request>,
|
body: Ar<get_pushrule_enabled::v3::Request>,
|
||||||
) -> Result<Ra<get_pushrule_enabled::v3::Response>> {
|
) -> Result<Ra<get_pushrule_enabled::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -310,7 +310,7 @@ pub(crate) async fn get_pushrule_enabled_route(
|
||||||
///
|
///
|
||||||
/// Sets the enabled status of a single specified push rule for this user.
|
/// Sets the enabled status of a single specified push rule for this user.
|
||||||
pub(crate) async fn set_pushrule_enabled_route(
|
pub(crate) async fn set_pushrule_enabled_route(
|
||||||
body: Ruma<set_pushrule_enabled::v3::Request>,
|
body: Ar<set_pushrule_enabled::v3::Request>,
|
||||||
) -> Result<Ra<set_pushrule_enabled::v3::Response>> {
|
) -> Result<Ra<set_pushrule_enabled::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -365,7 +365,7 @@ pub(crate) async fn set_pushrule_enabled_route(
|
||||||
///
|
///
|
||||||
/// Deletes a single specified push rule for this user.
|
/// Deletes a single specified push rule for this user.
|
||||||
pub(crate) async fn delete_pushrule_route(
|
pub(crate) async fn delete_pushrule_route(
|
||||||
body: Ruma<delete_pushrule::v3::Request>,
|
body: Ar<delete_pushrule::v3::Request>,
|
||||||
) -> Result<Ra<delete_pushrule::v3::Response>> {
|
) -> Result<Ra<delete_pushrule::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -425,7 +425,7 @@ pub(crate) async fn delete_pushrule_route(
|
||||||
///
|
///
|
||||||
/// Gets all currently active pushers for the sender user.
|
/// Gets all currently active pushers for the sender user.
|
||||||
pub(crate) async fn get_pushers_route(
|
pub(crate) async fn get_pushers_route(
|
||||||
body: Ruma<get_pushers::v3::Request>,
|
body: Ar<get_pushers::v3::Request>,
|
||||||
) -> Result<Ra<get_pushers::v3::Response>> {
|
) -> Result<Ra<get_pushers::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -440,7 +440,7 @@ pub(crate) async fn get_pushers_route(
|
||||||
///
|
///
|
||||||
/// - TODO: Handle `append`
|
/// - TODO: Handle `append`
|
||||||
pub(crate) async fn set_pushers_route(
|
pub(crate) async fn set_pushers_route(
|
||||||
body: Ruma<set_pusher::v3::Request>,
|
body: Ar<set_pusher::v3::Request>,
|
||||||
) -> Result<Ra<set_pusher::v3::Response>> {
|
) -> Result<Ra<set_pusher::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
service::rooms::timeline::PduCount, services, Error, Ra, Result, Ruma,
|
service::rooms::timeline::PduCount, services, Ar, Error, Ra, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/rooms/{roomId}/read_markers`
|
/// # `POST /_matrix/client/r0/rooms/{roomId}/read_markers`
|
||||||
|
|
@ -23,7 +23,7 @@ use crate::{
|
||||||
/// - If `read_receipt` is set: Update private marker and public read receipt
|
/// - If `read_receipt` is set: Update private marker and public read receipt
|
||||||
/// EDU
|
/// EDU
|
||||||
pub(crate) async fn set_read_marker_route(
|
pub(crate) async fn set_read_marker_route(
|
||||||
body: Ruma<set_read_marker::v3::Request>,
|
body: Ar<set_read_marker::v3::Request>,
|
||||||
) -> Result<Ra<set_read_marker::v3::Response>> {
|
) -> Result<Ra<set_read_marker::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ pub(crate) async fn set_read_marker_route(
|
||||||
///
|
///
|
||||||
/// Sets private read marker and public read receipt EDU.
|
/// Sets private read marker and public read receipt EDU.
|
||||||
pub(crate) async fn create_receipt_route(
|
pub(crate) async fn create_receipt_route(
|
||||||
body: Ruma<create_receipt::v3::Request>,
|
body: Ar<create_receipt::v3::Request>,
|
||||||
) -> Result<Ra<create_receipt::v3::Response>> {
|
) -> Result<Ra<create_receipt::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
|
|
||||||
use crate::{service::pdu::PduBuilder, services, Ra, Result, Ruma};
|
use crate::{service::pdu::PduBuilder, services, Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/redact/{eventId}/{txnId}`
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/redact/{eventId}/{txnId}`
|
||||||
///
|
///
|
||||||
|
|
@ -14,7 +14,7 @@ use crate::{service::pdu::PduBuilder, services, Ra, Result, Ruma};
|
||||||
///
|
///
|
||||||
/// - TODO: Handle txn id
|
/// - TODO: Handle txn id
|
||||||
pub(crate) async fn redact_event_route(
|
pub(crate) async fn redact_event_route(
|
||||||
body: Ruma<redact_event::v3::Request>,
|
body: Ar<redact_event::v3::Request>,
|
||||||
) -> Result<Ra<redact_event::v3::Response>> {
|
) -> Result<Ra<redact_event::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let body = body.body;
|
let body = body.body;
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ use ruma::{
|
||||||
uint,
|
uint,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{service::rooms::timeline::PduCount, services, Ra, Result, Ruma};
|
use crate::{service::rooms::timeline::PduCount, services, Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/relations/{eventId}/{relType}/{eventType}`
|
/// # `GET /_matrix/client/r0/rooms/{roomId}/relations/{eventId}/{relType}/{eventType}`
|
||||||
pub(crate) async fn get_relating_events_with_rel_type_and_event_type_route(
|
pub(crate) async fn get_relating_events_with_rel_type_and_event_type_route(
|
||||||
body: Ruma<get_relating_events_with_rel_type_and_event_type::v1::Request>,
|
body: Ar<get_relating_events_with_rel_type_and_event_type::v1::Request>,
|
||||||
) -> Result<Ra<get_relating_events_with_rel_type_and_event_type::v1::Response>>
|
) -> Result<Ra<get_relating_events_with_rel_type_and_event_type::v1::Response>>
|
||||||
{
|
{
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
@ -54,7 +54,7 @@ pub(crate) async fn get_relating_events_with_rel_type_and_event_type_route(
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/relations/{eventId}/{relType}`
|
/// # `GET /_matrix/client/r0/rooms/{roomId}/relations/{eventId}/{relType}`
|
||||||
pub(crate) async fn get_relating_events_with_rel_type_route(
|
pub(crate) async fn get_relating_events_with_rel_type_route(
|
||||||
body: Ruma<get_relating_events_with_rel_type::v1::Request>,
|
body: Ar<get_relating_events_with_rel_type::v1::Request>,
|
||||||
) -> Result<Ra<get_relating_events_with_rel_type::v1::Response>> {
|
) -> Result<Ra<get_relating_events_with_rel_type::v1::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ pub(crate) async fn get_relating_events_with_rel_type_route(
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/relations/{eventId}`
|
/// # `GET /_matrix/client/r0/rooms/{roomId}/relations/{eventId}`
|
||||||
pub(crate) async fn get_relating_events_route(
|
pub(crate) async fn get_relating_events_route(
|
||||||
body: Ruma<get_relating_events::v1::Request>,
|
body: Ar<get_relating_events::v1::Request>,
|
||||||
) -> Result<Ra<get_relating_events::v1::Response>> {
|
) -> Result<Ra<get_relating_events::v1::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ use ruma::{
|
||||||
int,
|
int,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/rooms/{roomId}/report/{eventId}`
|
/// # `POST /_matrix/client/r0/rooms/{roomId}/report/{eventId}`
|
||||||
///
|
///
|
||||||
/// Reports an inappropriate event to homeserver admins
|
/// Reports an inappropriate event to homeserver admins
|
||||||
pub(crate) async fn report_event_route(
|
pub(crate) async fn report_event_route(
|
||||||
body: Ruma<report_content::v3::Request>,
|
body: Ar<report_content::v3::Request>,
|
||||||
) -> Result<Ra<report_content::v3::Response>> {
|
) -> Result<Ra<report_content::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ use serde_json::{json, value::to_raw_value};
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::client_server::invite_helper, service::pdu::PduBuilder, services,
|
api::client_server::invite_helper, service::pdu::PduBuilder, services, Ar,
|
||||||
Error, Ra, Result, Ruma,
|
Error, Ra, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/createRoom`
|
/// # `POST /_matrix/client/r0/createRoom`
|
||||||
|
|
@ -52,7 +52,7 @@ use crate::{
|
||||||
/// - Send invite events
|
/// - Send invite events
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn create_room_route(
|
pub(crate) async fn create_room_route(
|
||||||
body: Ruma<create_room::v3::Request>,
|
body: Ar<create_room::v3::Request>,
|
||||||
) -> Result<Ra<create_room::v3::Response>> {
|
) -> Result<Ra<create_room::v3::Response>> {
|
||||||
use create_room::v3::RoomPreset;
|
use create_room::v3::RoomPreset;
|
||||||
|
|
||||||
|
|
@ -548,7 +548,7 @@ pub(crate) async fn create_room_route(
|
||||||
/// - You have to currently be joined to the room (TODO: Respect history
|
/// - You have to currently be joined to the room (TODO: Respect history
|
||||||
/// visibility)
|
/// visibility)
|
||||||
pub(crate) async fn get_room_event_route(
|
pub(crate) async fn get_room_event_route(
|
||||||
body: Ruma<get_room_event::v3::Request>,
|
body: Ar<get_room_event::v3::Request>,
|
||||||
) -> Result<Ra<get_room_event::v3::Response>> {
|
) -> Result<Ra<get_room_event::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -585,7 +585,7 @@ pub(crate) async fn get_room_event_route(
|
||||||
/// - Only users joined to the room are allowed to call this TODO: Allow any
|
/// - Only users joined to the room are allowed to call this TODO: Allow any
|
||||||
/// user to call it if `history_visibility` is world readable
|
/// user to call it if `history_visibility` is world readable
|
||||||
pub(crate) async fn get_room_aliases_route(
|
pub(crate) async fn get_room_aliases_route(
|
||||||
body: Ruma<aliases::v3::Request>,
|
body: Ar<aliases::v3::Request>,
|
||||||
) -> Result<Ra<aliases::v3::Response>> {
|
) -> Result<Ra<aliases::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -618,7 +618,7 @@ pub(crate) async fn get_room_aliases_route(
|
||||||
/// - Modifies old room power levels to prevent users from speaking
|
/// - Modifies old room power levels to prevent users from speaking
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn upgrade_room_route(
|
pub(crate) async fn upgrade_room_route(
|
||||||
body: Ruma<upgrade_room::v3::Request>,
|
body: Ar<upgrade_room::v3::Request>,
|
||||||
) -> Result<Ra<upgrade_room::v3::Response>> {
|
) -> Result<Ra<upgrade_room::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use ruma::{
|
||||||
uint,
|
uint,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/search`
|
/// # `POST /_matrix/client/r0/search`
|
||||||
///
|
///
|
||||||
|
|
@ -24,7 +24,7 @@ use crate::{services, Error, Ra, Result, Ruma};
|
||||||
/// history visibility)
|
/// history visibility)
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn search_events_route(
|
pub(crate) async fn search_events_route(
|
||||||
body: Ruma<search_events::v3::Request>,
|
body: Ar<search_events::v3::Request>,
|
||||||
) -> Result<Ra<search_events::v3::Response>> {
|
) -> Result<Ra<search_events::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use serde::Deserialize;
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::{services, utils, Error, Ra, Result, Ruma};
|
use crate::{services, utils, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct Claims {
|
struct Claims {
|
||||||
|
|
@ -28,7 +28,7 @@ struct Claims {
|
||||||
/// Get the supported login types of this server. One of these should be used as
|
/// Get the supported login types of this server. One of these should be used as
|
||||||
/// the `type` field when logging in.
|
/// the `type` field when logging in.
|
||||||
pub(crate) async fn get_login_types_route(
|
pub(crate) async fn get_login_types_route(
|
||||||
_body: Ruma<get_login_types::v3::Request>,
|
_body: Ar<get_login_types::v3::Request>,
|
||||||
) -> Result<Ra<get_login_types::v3::Response>> {
|
) -> Result<Ra<get_login_types::v3::Response>> {
|
||||||
Ok(Ra(get_login_types::v3::Response::new(vec![
|
Ok(Ra(get_login_types::v3::Response::new(vec![
|
||||||
get_login_types::v3::LoginType::Password(PasswordLoginType::default()),
|
get_login_types::v3::LoginType::Password(PasswordLoginType::default()),
|
||||||
|
|
@ -53,7 +53,7 @@ pub(crate) async fn get_login_types_route(
|
||||||
/// see supported login types.
|
/// see supported login types.
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn login_route(
|
pub(crate) async fn login_route(
|
||||||
body: Ruma<login::v3::Request>,
|
body: Ar<login::v3::Request>,
|
||||||
) -> Result<Ra<login::v3::Response>> {
|
) -> Result<Ra<login::v3::Response>> {
|
||||||
// To allow deprecated login methods
|
// To allow deprecated login methods
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
@ -277,7 +277,7 @@ pub(crate) async fn login_route(
|
||||||
/// - Forgets to-device events
|
/// - Forgets to-device events
|
||||||
/// - Triggers device list updates
|
/// - Triggers device list updates
|
||||||
pub(crate) async fn logout_route(
|
pub(crate) async fn logout_route(
|
||||||
body: Ruma<logout::v3::Request>,
|
body: Ar<logout::v3::Request>,
|
||||||
) -> Result<Ra<logout::v3::Response>> {
|
) -> Result<Ra<logout::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device =
|
let sender_device =
|
||||||
|
|
@ -310,7 +310,7 @@ pub(crate) async fn logout_route(
|
||||||
/// Note: This is equivalent to calling [`GET
|
/// Note: This is equivalent to calling [`GET
|
||||||
/// /_matrix/client/r0/logout`](logout_route) from each device of this user.
|
/// /_matrix/client/r0/logout`](logout_route) from each device of this user.
|
||||||
pub(crate) async fn logout_all_route(
|
pub(crate) async fn logout_all_route(
|
||||||
body: Ruma<logout_all::v3::Request>,
|
body: Ar<logout_all::v3::Request>,
|
||||||
) -> Result<Ra<logout_all::v3::Response>> {
|
) -> Result<Ra<logout_all::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use ruma::{api::client::space::get_hierarchy, uint};
|
use ruma::{api::client::space::get_hierarchy, uint};
|
||||||
|
|
||||||
use crate::{services, Ra, Result, Ruma};
|
use crate::{services, Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/v1/rooms/{room_id}/hierarchy`
|
/// # `GET /_matrix/client/v1/rooms/{room_id}/hierarchy`
|
||||||
///
|
///
|
||||||
/// Paginates over the space tree in a depth-first manner to locate child rooms
|
/// Paginates over the space tree in a depth-first manner to locate child rooms
|
||||||
/// of a given space.
|
/// of a given space.
|
||||||
pub(crate) async fn get_hierarchy_route(
|
pub(crate) async fn get_hierarchy_route(
|
||||||
body: Ruma<get_hierarchy::v1::Request>,
|
body: Ar<get_hierarchy::v1::Request>,
|
||||||
) -> Result<Ra<get_hierarchy::v1::Response>> {
|
) -> Result<Ra<get_hierarchy::v1::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use tracing::log::warn;
|
use tracing::log::warn;
|
||||||
|
|
||||||
use crate::{service::pdu::PduBuilder, services, Error, Ra, Result, Ruma};
|
use crate::{service::pdu::PduBuilder, services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}`
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}`
|
||||||
///
|
///
|
||||||
|
|
@ -25,7 +25,7 @@ use crate::{service::pdu::PduBuilder, services, Error, Ra, Result, Ruma};
|
||||||
/// allowed
|
/// allowed
|
||||||
/// - If event is new `canonical_alias`: Rejects if alias is incorrect
|
/// - If event is new `canonical_alias`: Rejects if alias is incorrect
|
||||||
pub(crate) async fn send_state_event_for_key_route(
|
pub(crate) async fn send_state_event_for_key_route(
|
||||||
body: Ruma<send_state_event::v3::Request>,
|
body: Ar<send_state_event::v3::Request>,
|
||||||
) -> Result<Ra<send_state_event::v3::Response>> {
|
) -> Result<Ra<send_state_event::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ pub(crate) async fn send_state_event_for_key_route(
|
||||||
/// allowed
|
/// allowed
|
||||||
/// - If event is new `canonical_alias`: Rejects if alias is incorrect
|
/// - If event is new `canonical_alias`: Rejects if alias is incorrect
|
||||||
pub(crate) async fn send_state_event_for_empty_key_route(
|
pub(crate) async fn send_state_event_for_empty_key_route(
|
||||||
body: Ruma<send_state_event::v3::Request>,
|
body: Ar<send_state_event::v3::Request>,
|
||||||
) -> Result<Ra<send_state_event::v3::Response>> {
|
) -> Result<Ra<send_state_event::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ pub(crate) async fn send_state_event_for_empty_key_route(
|
||||||
/// - If not joined: Only works if current room history visibility is world
|
/// - If not joined: Only works if current room history visibility is world
|
||||||
/// readable
|
/// readable
|
||||||
pub(crate) async fn get_state_events_route(
|
pub(crate) async fn get_state_events_route(
|
||||||
body: Ruma<get_state_events::v3::Request>,
|
body: Ar<get_state_events::v3::Request>,
|
||||||
) -> Result<Ra<get_state_events::v3::Response>> {
|
) -> Result<Ra<get_state_events::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ pub(crate) async fn get_state_events_route(
|
||||||
/// - If not joined: Only works if current room history visibility is world
|
/// - If not joined: Only works if current room history visibility is world
|
||||||
/// readable
|
/// readable
|
||||||
pub(crate) async fn get_state_events_for_key_route(
|
pub(crate) async fn get_state_events_for_key_route(
|
||||||
body: Ruma<get_state_events_for_key::v3::Request>,
|
body: Ar<get_state_events_for_key::v3::Request>,
|
||||||
) -> Result<Ra<get_state_events_for_key::v3::Response>> {
|
) -> Result<Ra<get_state_events_for_key::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ pub(crate) async fn get_state_events_for_key_route(
|
||||||
/// - If not joined: Only works if current room history visibility is world
|
/// - If not joined: Only works if current room history visibility is world
|
||||||
/// readable
|
/// readable
|
||||||
pub(crate) async fn get_state_events_for_empty_key_route(
|
pub(crate) async fn get_state_events_for_empty_key_route(
|
||||||
body: Ruma<get_state_events_for_key::v3::Request>,
|
body: Ar<get_state_events_for_key::v3::Request>,
|
||||||
) -> Result<Ra<get_state_events_for_key::v3::Response>> {
|
) -> Result<Ra<get_state_events_for_key::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use tracing::{debug, error};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
service::{pdu::EventHash, rooms::timeline::PduCount},
|
service::{pdu::EventHash, rooms::timeline::PduCount},
|
||||||
services, utils, Error, PduEvent, Ra, Result, Ruma,
|
services, utils, Ar, Error, PduEvent, Ra, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/sync`
|
/// # `GET /_matrix/client/r0/sync`
|
||||||
|
|
@ -73,7 +73,7 @@ use crate::{
|
||||||
/// subset of the state at the point of the leave)
|
/// subset of the state at the point of the leave)
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn sync_events_route(
|
pub(crate) async fn sync_events_route(
|
||||||
body: Ruma<sync_events::v3::Request>,
|
body: Ar<sync_events::v3::Request>,
|
||||||
) -> Result<Ra<sync_events::v3::Response>, Ra<UiaaResponse>> {
|
) -> Result<Ra<sync_events::v3::Response>, Ra<UiaaResponse>> {
|
||||||
let sender_user = body.sender_user.expect("user is authenticated");
|
let sender_user = body.sender_user.expect("user is authenticated");
|
||||||
let sender_device = body.sender_device.expect("user is authenticated");
|
let sender_device = body.sender_device.expect("user is authenticated");
|
||||||
|
|
@ -1126,7 +1126,7 @@ fn share_encrypted_room(
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn sync_events_v4_route(
|
pub(crate) async fn sync_events_v4_route(
|
||||||
body: Ruma<sync_events::v4::Request>,
|
body: Ar<sync_events::v4::Request>,
|
||||||
) -> Result<Ra<sync_events::v4::Response>, Ra<UiaaResponse>> {
|
) -> Result<Ra<sync_events::v4::Response>, Ra<UiaaResponse>> {
|
||||||
let sender_user = body.sender_user.expect("user is authenticated");
|
let sender_user = body.sender_user.expect("user is authenticated");
|
||||||
let sender_device = body.sender_device.expect("user is authenticated");
|
let sender_device = body.sender_device.expect("user is authenticated");
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
||||||
///
|
///
|
||||||
|
|
@ -16,7 +16,7 @@ use crate::{services, Error, Ra, Result, Ruma};
|
||||||
///
|
///
|
||||||
/// - Inserts the tag into the tag event of the room account data.
|
/// - Inserts the tag into the tag event of the room account data.
|
||||||
pub(crate) async fn update_tag_route(
|
pub(crate) async fn update_tag_route(
|
||||||
body: Ruma<create_tag::v3::Request>,
|
body: Ar<create_tag::v3::Request>,
|
||||||
) -> Result<Ra<create_tag::v3::Response>> {
|
) -> Result<Ra<create_tag::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ pub(crate) async fn update_tag_route(
|
||||||
///
|
///
|
||||||
/// - Removes the tag from the tag event of the room account data.
|
/// - Removes the tag from the tag event of the room account data.
|
||||||
pub(crate) async fn delete_tag_route(
|
pub(crate) async fn delete_tag_route(
|
||||||
body: Ruma<delete_tag::v3::Request>,
|
body: Ar<delete_tag::v3::Request>,
|
||||||
) -> Result<Ra<delete_tag::v3::Response>> {
|
) -> Result<Ra<delete_tag::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ pub(crate) async fn delete_tag_route(
|
||||||
///
|
///
|
||||||
/// - Gets the tag event of the room account data.
|
/// - Gets the tag event of the room account data.
|
||||||
pub(crate) async fn get_tags_route(
|
pub(crate) async fn get_tags_route(
|
||||||
body: Ruma<get_tags::v3::Request>,
|
body: Ar<get_tags::v3::Request>,
|
||||||
) -> Result<Ra<get_tags::v3::Response>> {
|
) -> Result<Ra<get_tags::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma::api::client::thirdparty::get_protocols;
|
use ruma::api::client::thirdparty::get_protocols;
|
||||||
|
|
||||||
use crate::{Ra, Result, Ruma};
|
use crate::{Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/thirdparty/protocols`
|
/// # `GET /_matrix/client/r0/thirdparty/protocols`
|
||||||
///
|
///
|
||||||
/// TODO: Fetches all metadata about protocols supported by the homeserver.
|
/// TODO: Fetches all metadata about protocols supported by the homeserver.
|
||||||
pub(crate) async fn get_protocols_route(
|
pub(crate) async fn get_protocols_route(
|
||||||
_body: Ruma<get_protocols::v3::Request>,
|
_body: Ar<get_protocols::v3::Request>,
|
||||||
) -> Result<Ra<get_protocols::v3::Response>> {
|
) -> Result<Ra<get_protocols::v3::Response>> {
|
||||||
// TODO
|
// TODO
|
||||||
Ok(Ra(get_protocols::v3::Response {
|
Ok(Ra(get_protocols::v3::Response {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use ruma::api::client::{error::ErrorKind, threads::get_threads};
|
use ruma::api::client::{error::ErrorKind, threads::get_threads};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/threads`
|
/// # `GET /_matrix/client/r0/rooms/{roomId}/threads`
|
||||||
pub(crate) async fn get_threads_route(
|
pub(crate) async fn get_threads_route(
|
||||||
body: Ruma<get_threads::v1::Request>,
|
body: Ar<get_threads::v1::Request>,
|
||||||
) -> Result<Ra<get_threads::v1::Response>> {
|
) -> Result<Ra<get_threads::v1::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ use ruma::{
|
||||||
to_device::DeviceIdOrAllDevices,
|
to_device::DeviceIdOrAllDevices,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Error, Ra, Result, Ruma};
|
use crate::{services, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId}`
|
/// # `PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId}`
|
||||||
///
|
///
|
||||||
/// Send a to-device event to a set of client devices.
|
/// Send a to-device event to a set of client devices.
|
||||||
pub(crate) async fn send_event_to_device_route(
|
pub(crate) async fn send_event_to_device_route(
|
||||||
body: Ruma<send_event_to_device::v3::Request>,
|
body: Ar<send_event_to_device::v3::Request>,
|
||||||
) -> Result<Ra<send_event_to_device::v3::Response>> {
|
) -> Result<Ra<send_event_to_device::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let sender_device = body.sender_device.as_deref();
|
let sender_device = body.sender_device.as_deref();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use ruma::api::client::{error::ErrorKind, typing::create_typing_event};
|
use ruma::api::client::{error::ErrorKind, typing::create_typing_event};
|
||||||
|
|
||||||
use crate::{services, utils, Error, Ra, Result, Ruma};
|
use crate::{services, utils, Ar, Error, Ra, Result};
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}`
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}`
|
||||||
///
|
///
|
||||||
/// Sets the typing state of the sender user.
|
/// Sets the typing state of the sender user.
|
||||||
pub(crate) async fn create_typing_event_route(
|
pub(crate) async fn create_typing_event_route(
|
||||||
body: Ruma<create_typing_event::v3::Request>,
|
body: Ar<create_typing_event::v3::Request>,
|
||||||
) -> Result<Ra<create_typing_event::v3::Response>> {
|
) -> Result<Ra<create_typing_event::v3::Response>> {
|
||||||
use create_typing_event::v3::Typing;
|
use create_typing_event::v3::Typing;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::{collections::BTreeMap, iter::FromIterator};
|
||||||
|
|
||||||
use ruma::api::client::discovery::get_supported_versions;
|
use ruma::api::client::discovery::get_supported_versions;
|
||||||
|
|
||||||
use crate::{Ra, Result, Ruma};
|
use crate::{Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/versions`
|
/// # `GET /_matrix/client/versions`
|
||||||
///
|
///
|
||||||
|
|
@ -17,7 +17,7 @@ use crate::{Ra, Result, Ruma};
|
||||||
/// Note: Unstable features are used while developing new features. Clients
|
/// Note: Unstable features are used while developing new features. Clients
|
||||||
/// should avoid using unstable features in their stable releases
|
/// should avoid using unstable features in their stable releases
|
||||||
pub(crate) async fn get_supported_versions_route(
|
pub(crate) async fn get_supported_versions_route(
|
||||||
_body: Ruma<get_supported_versions::Request>,
|
_body: Ar<get_supported_versions::Request>,
|
||||||
) -> Result<Ra<get_supported_versions::Response>> {
|
) -> Result<Ra<get_supported_versions::Response>> {
|
||||||
let resp = get_supported_versions::Response {
|
let resp = get_supported_versions::Response {
|
||||||
versions: vec![
|
versions: vec![
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Ra, Result, Ruma};
|
use crate::{services, Ar, Ra, Result};
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/user_directory/search`
|
/// # `POST /_matrix/client/r0/user_directory/search`
|
||||||
///
|
///
|
||||||
|
|
@ -16,7 +16,7 @@ use crate::{services, Ra, Result, Ruma};
|
||||||
/// have the join rule set to public)
|
/// 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(crate) async fn search_users_route(
|
pub(crate) async fn search_users_route(
|
||||||
body: Ruma<search_users::v3::Request>,
|
body: Ar<search_users::v3::Request>,
|
||||||
) -> Result<Ra<search_users::v3::Response>> {
|
) -> Result<Ra<search_users::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
let limit = body.limit.try_into().unwrap_or(usize::MAX);
|
let limit = body.limit.try_into().unwrap_or(usize::MAX);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use hmac::{Hmac, Mac};
|
||||||
use ruma::{api::client::voip::get_turn_server_info, SecondsSinceUnixEpoch};
|
use ruma::{api::client::voip::get_turn_server_info, SecondsSinceUnixEpoch};
|
||||||
use sha1::Sha1;
|
use sha1::Sha1;
|
||||||
|
|
||||||
use crate::{services, Ra, Result, Ruma};
|
use crate::{services, Ar, Ra, Result};
|
||||||
|
|
||||||
type HmacSha1 = Hmac<Sha1>;
|
type HmacSha1 = Hmac<Sha1>;
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ type HmacSha1 = Hmac<Sha1>;
|
||||||
///
|
///
|
||||||
/// TODO: Returns information about the recommended turn server.
|
/// TODO: Returns information about the recommended turn server.
|
||||||
pub(crate) async fn turn_server_route(
|
pub(crate) async fn turn_server_route(
|
||||||
body: Ruma<get_turn_server_info::v3::Request>,
|
body: Ar<get_turn_server_info::v3::Request>,
|
||||||
) -> Result<Ra<get_turn_server_info::v3::Response>> {
|
) -> Result<Ra<get_turn_server_info::v3::Response>> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,12 @@ use crate::{service::appservice::RegistrationInfo, Error};
|
||||||
|
|
||||||
mod axum;
|
mod axum;
|
||||||
|
|
||||||
/// Extractor for Ruma request structs
|
/// A wrapper to convert an Axum request to Ruma data
|
||||||
pub(crate) struct Ruma<T> {
|
///
|
||||||
|
/// Named so because this converts from **A**xum to **R**uma. See also [`Ra`],
|
||||||
|
/// which is roughly the inverse of this type.
|
||||||
|
pub(crate) struct Ar<T> {
|
||||||
|
/// The Ruma type to deserialize the body into
|
||||||
pub(crate) body: T,
|
pub(crate) body: T,
|
||||||
pub(crate) sender_user: Option<OwnedUserId>,
|
pub(crate) sender_user: Option<OwnedUserId>,
|
||||||
pub(crate) sender_device: Option<OwnedDeviceId>,
|
pub(crate) sender_device: Option<OwnedDeviceId>,
|
||||||
|
|
@ -20,7 +24,7 @@ pub(crate) struct Ruma<T> {
|
||||||
pub(crate) appservice_info: Option<RegistrationInfo>,
|
pub(crate) appservice_info: Option<RegistrationInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Deref for Ruma<T> {
|
impl<T> Deref for Ar<T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
|
|
@ -30,7 +34,7 @@ impl<T> Deref for Ruma<T> {
|
||||||
|
|
||||||
/// A wrapper to convert Ruma data to an Axum response
|
/// A wrapper to convert Ruma data to an Axum response
|
||||||
///
|
///
|
||||||
/// Named so because this converts from **R**uma to **A**xum. See also [`Ruma`],
|
/// Named so because this converts from **R**uma to **A**xum. See also [`Ar`],
|
||||||
/// which is roughly the inverse of this type.
|
/// which is roughly the inverse of this type.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct Ra<T>(pub(crate) T);
|
pub(crate) struct Ra<T>(pub(crate) T);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use ruma::{
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tracing::{debug, error, warn};
|
use tracing::{debug, error, warn};
|
||||||
|
|
||||||
use super::{Ra, Ruma};
|
use super::{Ar, Ra};
|
||||||
use crate::{service::appservice::RegistrationInfo, services, Error, Result};
|
use crate::{service::appservice::RegistrationInfo, services, Error, Result};
|
||||||
|
|
||||||
enum Token {
|
enum Token {
|
||||||
|
|
@ -35,7 +35,7 @@ enum Token {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<T, S, B> FromRequest<S, B> for Ruma<T>
|
impl<T, S, B> FromRequest<S, B> for Ar<T>
|
||||||
where
|
where
|
||||||
T: IncomingRequest,
|
T: IncomingRequest,
|
||||||
B: HttpBody + Send + 'static,
|
B: HttpBody + Send + 'static,
|
||||||
|
|
@ -379,7 +379,7 @@ where
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(Ruma {
|
Ok(Ar {
|
||||||
body,
|
body,
|
||||||
sender_user,
|
sender_user,
|
||||||
sender_device,
|
sender_device,
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ use tracing::{debug, error, warn};
|
||||||
use crate::{
|
use crate::{
|
||||||
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
||||||
service::pdu::{gen_event_id_canonical_json, PduBuilder},
|
service::pdu::{gen_event_id_canonical_json, PduBuilder},
|
||||||
services, utils, Error, PduEvent, Ra, Result, Ruma,
|
services, utils, Ar, Error, PduEvent, Ra, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Wraps either an literal IP address plus port, or a hostname plus complement
|
/// Wraps either an literal IP address plus port, or a hostname plus complement
|
||||||
|
|
@ -553,7 +553,7 @@ async fn request_well_known(destination: &str) -> Option<String> {
|
||||||
///
|
///
|
||||||
/// Get version information on this server.
|
/// Get version information on this server.
|
||||||
pub(crate) async fn get_server_version_route(
|
pub(crate) async fn get_server_version_route(
|
||||||
_body: Ruma<get_server_version::v1::Request>,
|
_body: Ar<get_server_version::v1::Request>,
|
||||||
) -> Result<Ra<get_server_version::v1::Response>> {
|
) -> Result<Ra<get_server_version::v1::Response>> {
|
||||||
Ok(Ra(get_server_version::v1::Response {
|
Ok(Ra(get_server_version::v1::Response {
|
||||||
server: Some(get_server_version::v1::Server {
|
server: Some(get_server_version::v1::Server {
|
||||||
|
|
@ -630,7 +630,7 @@ pub(crate) async fn get_server_keys_deprecated_route() -> impl IntoResponse {
|
||||||
///
|
///
|
||||||
/// Lists the public rooms on this server.
|
/// Lists the public rooms on this server.
|
||||||
pub(crate) async fn get_public_rooms_filtered_route(
|
pub(crate) async fn get_public_rooms_filtered_route(
|
||||||
body: Ruma<get_public_rooms_filtered::v1::Request>,
|
body: Ar<get_public_rooms_filtered::v1::Request>,
|
||||||
) -> Result<Ra<get_public_rooms_filtered::v1::Response>> {
|
) -> Result<Ra<get_public_rooms_filtered::v1::Response>> {
|
||||||
let response = client_server::get_public_rooms_filtered_helper(
|
let response = client_server::get_public_rooms_filtered_helper(
|
||||||
None,
|
None,
|
||||||
|
|
@ -653,7 +653,7 @@ pub(crate) async fn get_public_rooms_filtered_route(
|
||||||
///
|
///
|
||||||
/// Lists the public rooms on this server.
|
/// Lists the public rooms on this server.
|
||||||
pub(crate) async fn get_public_rooms_route(
|
pub(crate) async fn get_public_rooms_route(
|
||||||
body: Ruma<get_public_rooms::v1::Request>,
|
body: Ar<get_public_rooms::v1::Request>,
|
||||||
) -> Result<Ra<get_public_rooms::v1::Response>> {
|
) -> Result<Ra<get_public_rooms::v1::Response>> {
|
||||||
let response = client_server::get_public_rooms_filtered_helper(
|
let response = client_server::get_public_rooms_filtered_helper(
|
||||||
None,
|
None,
|
||||||
|
|
@ -708,7 +708,7 @@ pub(crate) fn parse_incoming_pdu(
|
||||||
/// Push EDUs and PDUs to this server.
|
/// Push EDUs and PDUs to this server.
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn send_transaction_message_route(
|
pub(crate) async fn send_transaction_message_route(
|
||||||
body: Ruma<send_transaction_message::v1::Request>,
|
body: Ar<send_transaction_message::v1::Request>,
|
||||||
) -> Result<Ra<send_transaction_message::v1::Response>> {
|
) -> Result<Ra<send_transaction_message::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -991,7 +991,7 @@ pub(crate) async fn send_transaction_message_route(
|
||||||
/// - Only works if a user of this server is currently invited or joined the
|
/// - Only works if a user of this server is currently invited or joined the
|
||||||
/// room
|
/// room
|
||||||
pub(crate) async fn get_event_route(
|
pub(crate) async fn get_event_route(
|
||||||
body: Ruma<get_event::v1::Request>,
|
body: Ar<get_event::v1::Request>,
|
||||||
) -> Result<Ra<get_event::v1::Response>> {
|
) -> Result<Ra<get_event::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1047,7 +1047,7 @@ pub(crate) async fn get_event_route(
|
||||||
/// Retrieves events from before the sender joined the room, if the room's
|
/// Retrieves events from before the sender joined the room, if the room's
|
||||||
/// history visibility allows.
|
/// history visibility allows.
|
||||||
pub(crate) async fn get_backfill_route(
|
pub(crate) async fn get_backfill_route(
|
||||||
body: Ruma<get_backfill::v1::Request>,
|
body: Ar<get_backfill::v1::Request>,
|
||||||
) -> Result<Ra<get_backfill::v1::Response>> {
|
) -> Result<Ra<get_backfill::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1117,7 +1117,7 @@ pub(crate) async fn get_backfill_route(
|
||||||
///
|
///
|
||||||
/// Retrieves events that the sender is missing.
|
/// Retrieves events that the sender is missing.
|
||||||
pub(crate) async fn get_missing_events_route(
|
pub(crate) async fn get_missing_events_route(
|
||||||
body: Ruma<get_missing_events::v1::Request>,
|
body: Ar<get_missing_events::v1::Request>,
|
||||||
) -> Result<Ra<get_missing_events::v1::Response>> {
|
) -> Result<Ra<get_missing_events::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1219,7 +1219,7 @@ pub(crate) async fn get_missing_events_route(
|
||||||
///
|
///
|
||||||
/// - This does not include the event itself
|
/// - This does not include the event itself
|
||||||
pub(crate) async fn get_event_authorization_route(
|
pub(crate) async fn get_event_authorization_route(
|
||||||
body: Ruma<get_event_authorization::v1::Request>,
|
body: Ar<get_event_authorization::v1::Request>,
|
||||||
) -> Result<Ra<get_event_authorization::v1::Response>> {
|
) -> Result<Ra<get_event_authorization::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1277,7 +1277,7 @@ pub(crate) async fn get_event_authorization_route(
|
||||||
///
|
///
|
||||||
/// Retrieves the current state of the room.
|
/// Retrieves the current state of the room.
|
||||||
pub(crate) async fn get_room_state_route(
|
pub(crate) async fn get_room_state_route(
|
||||||
body: Ruma<get_room_state::v1::Request>,
|
body: Ar<get_room_state::v1::Request>,
|
||||||
) -> Result<Ra<get_room_state::v1::Response>> {
|
) -> Result<Ra<get_room_state::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1347,7 +1347,7 @@ pub(crate) async fn get_room_state_route(
|
||||||
///
|
///
|
||||||
/// Retrieves the current state of the room.
|
/// Retrieves the current state of the room.
|
||||||
pub(crate) async fn get_room_state_ids_route(
|
pub(crate) async fn get_room_state_ids_route(
|
||||||
body: Ruma<get_room_state_ids::v1::Request>,
|
body: Ar<get_room_state_ids::v1::Request>,
|
||||||
) -> Result<Ra<get_room_state_ids::v1::Response>> {
|
) -> Result<Ra<get_room_state_ids::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1402,7 +1402,7 @@ pub(crate) async fn get_room_state_ids_route(
|
||||||
///
|
///
|
||||||
/// Creates a join template.
|
/// Creates a join template.
|
||||||
pub(crate) async fn create_join_event_template_route(
|
pub(crate) async fn create_join_event_template_route(
|
||||||
body: Ruma<prepare_join_event::v1::Request>,
|
body: Ar<prepare_join_event::v1::Request>,
|
||||||
) -> Result<Ra<prepare_join_event::v1::Response>> {
|
) -> Result<Ra<prepare_join_event::v1::Response>> {
|
||||||
if !services().rooms.metadata.exists(&body.room_id)? {
|
if !services().rooms.metadata.exists(&body.room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
|
@ -1660,7 +1660,7 @@ async fn create_join_event(
|
||||||
///
|
///
|
||||||
/// Submits a signed join event.
|
/// Submits a signed join event.
|
||||||
pub(crate) async fn create_join_event_v1_route(
|
pub(crate) async fn create_join_event_v1_route(
|
||||||
body: Ruma<create_join_event::v1::Request>,
|
body: Ar<create_join_event::v1::Request>,
|
||||||
) -> Result<Ra<create_join_event::v1::Response>> {
|
) -> Result<Ra<create_join_event::v1::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1677,7 +1677,7 @@ pub(crate) async fn create_join_event_v1_route(
|
||||||
///
|
///
|
||||||
/// Submits a signed join event.
|
/// Submits a signed join event.
|
||||||
pub(crate) async fn create_join_event_v2_route(
|
pub(crate) async fn create_join_event_v2_route(
|
||||||
body: Ruma<create_join_event::v2::Request>,
|
body: Ar<create_join_event::v2::Request>,
|
||||||
) -> Result<Ra<create_join_event::v2::Response>> {
|
) -> Result<Ra<create_join_event::v2::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1705,7 +1705,7 @@ pub(crate) async fn create_join_event_v2_route(
|
||||||
/// Invites a remote user to a room.
|
/// Invites a remote user to a room.
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub(crate) async fn create_invite_route(
|
pub(crate) async fn create_invite_route(
|
||||||
body: Ruma<create_invite::v2::Request>,
|
body: Ar<create_invite::v2::Request>,
|
||||||
) -> Result<Ra<create_invite::v2::Response>> {
|
) -> Result<Ra<create_invite::v2::Response>> {
|
||||||
let sender_servername =
|
let sender_servername =
|
||||||
body.sender_servername.as_ref().expect("server is authenticated");
|
body.sender_servername.as_ref().expect("server is authenticated");
|
||||||
|
|
@ -1836,7 +1836,7 @@ pub(crate) async fn create_invite_route(
|
||||||
///
|
///
|
||||||
/// Gets information on all devices of the user.
|
/// Gets information on all devices of the user.
|
||||||
pub(crate) async fn get_devices_route(
|
pub(crate) async fn get_devices_route(
|
||||||
body: Ruma<get_devices::v1::Request>,
|
body: Ar<get_devices::v1::Request>,
|
||||||
) -> Result<Ra<get_devices::v1::Response>> {
|
) -> Result<Ra<get_devices::v1::Response>> {
|
||||||
if body.user_id.server_name() != services().globals.server_name() {
|
if body.user_id.server_name() != services().globals.server_name() {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
|
@ -1888,7 +1888,7 @@ pub(crate) async fn get_devices_route(
|
||||||
///
|
///
|
||||||
/// Resolve a room alias to a room id.
|
/// Resolve a room alias to a room id.
|
||||||
pub(crate) async fn get_room_information_route(
|
pub(crate) async fn get_room_information_route(
|
||||||
body: Ruma<get_room_information::v1::Request>,
|
body: Ar<get_room_information::v1::Request>,
|
||||||
) -> Result<Ra<get_room_information::v1::Response>> {
|
) -> Result<Ra<get_room_information::v1::Response>> {
|
||||||
let room_id =
|
let room_id =
|
||||||
services().rooms.alias.resolve_local_alias(&body.room_alias)?.ok_or(
|
services().rooms.alias.resolve_local_alias(&body.room_alias)?.ok_or(
|
||||||
|
|
@ -1905,7 +1905,7 @@ pub(crate) async fn get_room_information_route(
|
||||||
///
|
///
|
||||||
/// Gets information on a profile.
|
/// Gets information on a profile.
|
||||||
pub(crate) async fn get_profile_information_route(
|
pub(crate) async fn get_profile_information_route(
|
||||||
body: Ruma<get_profile_information::v1::Request>,
|
body: Ar<get_profile_information::v1::Request>,
|
||||||
) -> Result<Ra<get_profile_information::v1::Response>> {
|
) -> Result<Ra<get_profile_information::v1::Response>> {
|
||||||
if body.user_id.server_name() != services().globals.server_name() {
|
if body.user_id.server_name() != services().globals.server_name() {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
|
@ -1946,7 +1946,7 @@ pub(crate) async fn get_profile_information_route(
|
||||||
///
|
///
|
||||||
/// Gets devices and identity keys for the given users.
|
/// Gets devices and identity keys for the given users.
|
||||||
pub(crate) async fn get_keys_route(
|
pub(crate) async fn get_keys_route(
|
||||||
body: Ruma<get_keys::v1::Request>,
|
body: Ar<get_keys::v1::Request>,
|
||||||
) -> Result<Ra<get_keys::v1::Response>> {
|
) -> Result<Ra<get_keys::v1::Response>> {
|
||||||
if body
|
if body
|
||||||
.device_keys
|
.device_keys
|
||||||
|
|
@ -1975,7 +1975,7 @@ pub(crate) async fn get_keys_route(
|
||||||
///
|
///
|
||||||
/// Claims one-time keys.
|
/// Claims one-time keys.
|
||||||
pub(crate) async fn claim_keys_route(
|
pub(crate) async fn claim_keys_route(
|
||||||
body: Ruma<claim_keys::v1::Request>,
|
body: Ar<claim_keys::v1::Request>,
|
||||||
) -> Result<Ra<claim_keys::v1::Response>> {
|
) -> Result<Ra<claim_keys::v1::Response>> {
|
||||||
if body
|
if body
|
||||||
.one_time_keys
|
.one_time_keys
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ mod database;
|
||||||
mod service;
|
mod service;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
pub(crate) use api::ruma_wrapper::{Ra, Ruma};
|
pub(crate) use api::ruma_wrapper::{Ar, Ra};
|
||||||
use api::{client_server, server_server};
|
use api::{client_server, server_server};
|
||||||
pub(crate) use config::Config;
|
pub(crate) use config::Config;
|
||||||
pub(crate) use database::KeyValueDatabase;
|
pub(crate) use database::KeyValueDatabase;
|
||||||
|
|
@ -580,11 +580,11 @@ macro_rules! impl_ruma_handler {
|
||||||
#[axum::async_trait]
|
#[axum::async_trait]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl<Req, Resp, E, F, Fut, $($ty,)*>
|
impl<Req, Resp, E, F, Fut, $($ty,)*>
|
||||||
RumaHandler<($($ty,)* Ruma<Req>,)> for F
|
RumaHandler<($($ty,)* Ar<Req>,)> for F
|
||||||
where
|
where
|
||||||
Req: IncomingRequest + Send + 'static,
|
Req: IncomingRequest + Send + 'static,
|
||||||
Resp: IntoResponse,
|
Resp: IntoResponse,
|
||||||
F: FnOnce($($ty,)* Ruma<Req>) -> Fut + Clone + Send + 'static,
|
F: FnOnce($($ty,)* Ar<Req>) -> Fut + Clone + Send + 'static,
|
||||||
Fut: Future<Output = Result<Resp, E>>
|
Fut: Future<Output = Result<Resp, E>>
|
||||||
+ Send,
|
+ Send,
|
||||||
E: IntoResponse,
|
E: IntoResponse,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue