appservice: Depend on ruma directly
parent
26788f83f0
commit
54063513a3
|
@ -21,6 +21,7 @@ futures = "0.3"
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
http = "0.2"
|
http = "0.2"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
|
serde = "1.0.126"
|
||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
|
@ -28,6 +29,10 @@ url = "2"
|
||||||
|
|
||||||
matrix-sdk = { version = "0.2", path = "../matrix_sdk", default-features = false, features = ["appservice", "native-tls"] }
|
matrix-sdk = { version = "0.2", path = "../matrix_sdk", default-features = false, features = ["appservice", "native-tls"] }
|
||||||
|
|
||||||
|
[dependencies.ruma]
|
||||||
|
version = "0.1.2"
|
||||||
|
features = ["client-api-c", "appservice-api-s", "unstable-pre-spec"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
mockito = "0.30"
|
mockito = "0.30"
|
||||||
|
|
|
@ -29,7 +29,7 @@ use actix_web::{
|
||||||
};
|
};
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use futures_util::{TryFutureExt, TryStreamExt};
|
use futures_util::{TryFutureExt, TryStreamExt};
|
||||||
use matrix_sdk::api_appservice as api;
|
use ruma::api::appservice as api;
|
||||||
|
|
||||||
use crate::{error::Error, Appservice};
|
use crate::{error::Error, Appservice};
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ pub struct IncomingRequest<T> {
|
||||||
incoming: T,
|
incoming: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: matrix_sdk::IncomingRequest> FromRequest for IncomingRequest<T> {
|
impl<T: ruma::api::IncomingRequest> FromRequest for IncomingRequest<T> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Future = Pin<Box<dyn Future<Output = Result<Self, Self::Error>>>>;
|
type Future = Pin<Box<dyn Future<Output = Result<Self, Self::Error>>>>;
|
||||||
type Config = ();
|
type Config = ();
|
||||||
|
@ -145,7 +145,7 @@ impl<T: matrix_sdk::IncomingRequest> FromRequest for IncomingRequest<T> {
|
||||||
|
|
||||||
let access_token = match request.uri().query() {
|
let access_token = match request.uri().query() {
|
||||||
Some(query) => {
|
Some(query) => {
|
||||||
let query: Vec<(String, String)> = matrix_sdk::urlencoded::from_str(query)?;
|
let query: Vec<(String, String)> = ruma::serde::urlencoded::from_str(query)?;
|
||||||
query.into_iter().find(|(key, _)| key == "access_token").map(|(_, value)| value)
|
query.into_iter().find(|(key, _)| key == "access_token").map(|(_, value)| value)
|
||||||
}
|
}
|
||||||
None => None,
|
None => None,
|
||||||
|
@ -160,7 +160,7 @@ impl<T: matrix_sdk::IncomingRequest> FromRequest for IncomingRequest<T> {
|
||||||
|
|
||||||
Ok(IncomingRequest {
|
Ok(IncomingRequest {
|
||||||
access_token,
|
access_token,
|
||||||
incoming: matrix_sdk::IncomingRequest::try_from_http_request(request)?,
|
incoming: ruma::api::IncomingRequest::try_from_http_request(request)?,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@ pub enum Error {
|
||||||
NoClientForLocalpart,
|
NoClientForLocalpart,
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
HttpRequest(#[from] matrix_sdk::FromHttpRequestError),
|
HttpRequest(#[from] ruma::api::error::FromHttpRequestError),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Identifier(#[from] matrix_sdk::identifiers::Error),
|
Identifier(#[from] ruma::identifiers::Error),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Http(#[from] http::Error),
|
Http(#[from] http::Error),
|
||||||
|
@ -44,7 +44,7 @@ pub enum Error {
|
||||||
Url(#[from] url::ParseError),
|
Url(#[from] url::ParseError),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Serde(#[from] matrix_sdk::SerdeError),
|
Serde(#[from] serde::de::value::Error),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Io(#[from] std::io::Error),
|
Io(#[from] std::io::Error),
|
||||||
|
|
|
@ -87,23 +87,24 @@ use std::{
|
||||||
|
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use http::Uri;
|
use http::Uri;
|
||||||
#[doc(inline)]
|
use matrix_sdk::{reqwest::Url, Client, ClientConfig, EventHandler, HttpError, Session};
|
||||||
pub use matrix_sdk::api_appservice as api;
|
|
||||||
use matrix_sdk::{
|
|
||||||
api::{
|
|
||||||
error::ErrorKind,
|
|
||||||
r0::{
|
|
||||||
account::register::{LoginType, Request as RegistrationRequest},
|
|
||||||
uiaa::UiaaResponse,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
api_appservice::Registration,
|
|
||||||
assign,
|
|
||||||
identifiers::{self, DeviceId, ServerNameBox, UserId},
|
|
||||||
reqwest::Url,
|
|
||||||
Client, ClientConfig, EventHandler, FromHttpResponseError, HttpError, ServerError, Session,
|
|
||||||
};
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
#[doc(inline)]
|
||||||
|
pub use ruma::api::appservice as api;
|
||||||
|
use ruma::{
|
||||||
|
api::{
|
||||||
|
appservice::Registration,
|
||||||
|
client::{
|
||||||
|
error::ErrorKind,
|
||||||
|
r0::{
|
||||||
|
account::register::{LoginType, Request as RegistrationRequest},
|
||||||
|
uiaa::UiaaResponse,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
error::{FromHttpResponseError, ServerError},
|
||||||
|
},
|
||||||
|
assign, identifiers, DeviceId, ServerNameBox, UserId,
|
||||||
|
};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
#[cfg(feature = "actix")]
|
#[cfg(feature = "actix")]
|
||||||
|
|
Loading…
Reference in New Issue