appservice: Depend on ruma directly
parent
26788f83f0
commit
54063513a3
|
@ -21,6 +21,7 @@ futures = "0.3"
|
|||
futures-util = "0.3"
|
||||
http = "0.2"
|
||||
regex = "1"
|
||||
serde = "1.0.126"
|
||||
serde_yaml = "0.8"
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1"
|
||||
|
@ -28,6 +29,10 @@ url = "2"
|
|||
|
||||
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]
|
||||
env_logger = "0.8"
|
||||
mockito = "0.30"
|
||||
|
|
|
@ -29,7 +29,7 @@ use actix_web::{
|
|||
};
|
||||
use futures::Future;
|
||||
use futures_util::{TryFutureExt, TryStreamExt};
|
||||
use matrix_sdk::api_appservice as api;
|
||||
use ruma::api::appservice as api;
|
||||
|
||||
use crate::{error::Error, Appservice};
|
||||
|
||||
|
@ -102,7 +102,7 @@ pub struct IncomingRequest<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 Future = Pin<Box<dyn Future<Output = Result<Self, Self::Error>>>>;
|
||||
type Config = ();
|
||||
|
@ -145,7 +145,7 @@ impl<T: matrix_sdk::IncomingRequest> FromRequest for IncomingRequest<T> {
|
|||
|
||||
let access_token = match request.uri().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)
|
||||
}
|
||||
None => None,
|
||||
|
@ -160,7 +160,7 @@ impl<T: matrix_sdk::IncomingRequest> FromRequest for IncomingRequest<T> {
|
|||
|
||||
Ok(IncomingRequest {
|
||||
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,
|
||||
|
||||
#[error(transparent)]
|
||||
HttpRequest(#[from] matrix_sdk::FromHttpRequestError),
|
||||
HttpRequest(#[from] ruma::api::error::FromHttpRequestError),
|
||||
|
||||
#[error(transparent)]
|
||||
Identifier(#[from] matrix_sdk::identifiers::Error),
|
||||
Identifier(#[from] ruma::identifiers::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
Http(#[from] http::Error),
|
||||
|
@ -44,7 +44,7 @@ pub enum Error {
|
|||
Url(#[from] url::ParseError),
|
||||
|
||||
#[error(transparent)]
|
||||
Serde(#[from] matrix_sdk::SerdeError),
|
||||
Serde(#[from] serde::de::value::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
|
|
|
@ -87,23 +87,24 @@ use std::{
|
|||
|
||||
use dashmap::DashMap;
|
||||
use http::Uri;
|
||||
use matrix_sdk::{reqwest::Url, Client, ClientConfig, EventHandler, HttpError, Session};
|
||||
use regex::Regex;
|
||||
#[doc(inline)]
|
||||
pub use matrix_sdk::api_appservice as api;
|
||||
use matrix_sdk::{
|
||||
pub use ruma::api::appservice as api;
|
||||
use ruma::{
|
||||
api::{
|
||||
appservice::Registration,
|
||||
client::{
|
||||
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,
|
||||
error::{FromHttpResponseError, ServerError},
|
||||
},
|
||||
assign, identifiers, DeviceId, ServerNameBox, UserId,
|
||||
};
|
||||
use regex::Regex;
|
||||
use tracing::warn;
|
||||
|
||||
#[cfg(feature = "actix")]
|
||||
|
|
Loading…
Reference in New Issue