mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-08-06 17:40:59 +00:00
a lot more endpoints
This commit is contained in:
parent
e3cfe360a1
commit
619ea68405
3 changed files with 61 additions and 25 deletions
27
Cargo.lock
generated
27
Cargo.lock
generated
|
@ -2247,7 +2247,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma"
|
||||
version = "0.10.1"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"assign",
|
||||
"js_int",
|
||||
|
@ -2268,7 +2268,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-appservice-api"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
@ -2280,7 +2280,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-client-api"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"as_variant",
|
||||
"assign",
|
||||
|
@ -2303,7 +2303,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-common"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"as_variant",
|
||||
"base64 0.22.1",
|
||||
|
@ -2333,7 +2333,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-events"
|
||||
version = "0.28.1"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"as_variant",
|
||||
"indexmap 2.2.6",
|
||||
|
@ -2349,13 +2349,14 @@ dependencies = [
|
|||
"thiserror",
|
||||
"tracing",
|
||||
"url",
|
||||
"web-time",
|
||||
"wildmatch",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruma-federation-api"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
@ -2367,7 +2368,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-identifiers-validation"
|
||||
version = "0.9.5"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"thiserror",
|
||||
|
@ -2376,7 +2377,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-identity-service-api"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
@ -2386,7 +2387,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-macros"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro-crate",
|
||||
|
@ -2401,7 +2402,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-push-gateway-api"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
@ -2413,7 +2414,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-server-util"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"headers",
|
||||
"http 1.1.0",
|
||||
|
@ -2426,7 +2427,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-signatures"
|
||||
version = "0.15.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"ed25519-dalek",
|
||||
|
@ -2442,7 +2443,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-state-res"
|
||||
version = "0.11.0"
|
||||
source = "git+https://github.com/ruma/ruma#fec2152d879a6c6c2bccce984d4b8f424f460cb2"
|
||||
source = "git+https://github.com/ruma/ruma#50a46cc5f658fd1cef5bdae6f08db292c3135366"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"js_int",
|
||||
|
|
|
@ -110,6 +110,15 @@ pub enum Restriction {
|
|||
Registration,
|
||||
Login,
|
||||
RegistrationTokenValidity,
|
||||
Message,
|
||||
Join,
|
||||
Invite,
|
||||
Knock,
|
||||
CreateMedia,
|
||||
Transaction,
|
||||
FederatedJoin,
|
||||
FederatedInvite,
|
||||
FederatedKnock,
|
||||
|
||||
#[default]
|
||||
CatchAll,
|
||||
|
|
|
@ -9,7 +9,17 @@ use ruma::{
|
|||
api::{
|
||||
client::{
|
||||
account::{check_registration_token_validity, register},
|
||||
knock::knock_room,
|
||||
media::{create_content, create_content_async},
|
||||
membership::{invite_user, join_room_by_id, join_room_by_id_or_alias},
|
||||
message::send_message_event,
|
||||
session::login,
|
||||
state::send_state_event,
|
||||
},
|
||||
federation::{
|
||||
knock::send_knock,
|
||||
membership::{create_invite, create_join_event},
|
||||
transactions::send_transaction_message,
|
||||
},
|
||||
IncomingRequest, Metadata,
|
||||
},
|
||||
|
@ -20,18 +30,33 @@ use crate::{config::Restriction, services, Result};
|
|||
|
||||
impl From<Metadata> for Restriction {
|
||||
fn from(metadata: Metadata) -> Self {
|
||||
[
|
||||
(register::v3::Request::METADATA, Restriction::Registration),
|
||||
(login::v3::Request::METADATA, Restriction::Login),
|
||||
(
|
||||
check_registration_token_validity::v1::Request::METADATA,
|
||||
Restriction::RegistrationTokenValidity,
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.find(|(other, _)| metadata.history.all_paths().eq(other.history.all_paths()))
|
||||
.map(|(_, restriction)| restriction)
|
||||
.unwrap_or_default()
|
||||
#[allow(deprecated)]
|
||||
match metadata {
|
||||
register::v3::Request::METADATA => Restriction::Registration,
|
||||
login::v3::Request::METADATA => Restriction::Login,
|
||||
check_registration_token_validity::v1::Request::METADATA => {
|
||||
Restriction::RegistrationTokenValidity
|
||||
}
|
||||
send_message_event::v3::Request::METADATA | send_state_event::v3::Request::METADATA => {
|
||||
Restriction::Message
|
||||
}
|
||||
join_room_by_id::v3::Request::METADATA
|
||||
| join_room_by_id_or_alias::v3::Request::METADATA => Restriction::Join,
|
||||
invite_user::v3::Request::METADATA => Restriction::Invite,
|
||||
create_content::v3::Request::METADATA | create_content_async::v3::Request::METADATA => {
|
||||
Restriction::CreateMedia
|
||||
}
|
||||
send_transaction_message::v1::Request::METADATA => Restriction::Transaction,
|
||||
create_join_event::v1::Request::METADATA | create_join_event::v2::Request::METADATA => {
|
||||
Restriction::FederatedJoin
|
||||
}
|
||||
create_invite::v1::Request::METADATA | create_invite::v2::Request::METADATA => {
|
||||
Restriction::FederatedInvite
|
||||
}
|
||||
send_knock::v1::Request::METADATA => Restriction::FederatedKnock,
|
||||
knock_room::v3::Request::METADATA => Restriction::Knock,
|
||||
_ => Self::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +67,7 @@ pub struct Service {
|
|||
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub enum Target {
|
||||
User(OwnedUserId),
|
||||
// Server endpoints should be rate-limited on a server and room basis
|
||||
Server(OwnedServerName),
|
||||
Appservice(String),
|
||||
Ip(IpAddr),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue