mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00:00
WIP
This commit is contained in:
parent
54a0f21347
commit
42a7a9f795
3 changed files with 47 additions and 41 deletions
39
Cargo.lock
generated
39
Cargo.lock
generated
|
@ -1655,7 +1655,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.0.3"
|
version = "0.0.3"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
|
@ -1676,7 +1676,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-api"
|
name = "ruma-api"
|
||||||
version = "0.17.0-alpha.4"
|
version = "0.17.0-alpha.4"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http",
|
||||||
|
@ -1692,7 +1692,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-api-macros"
|
name = "ruma-api-macros"
|
||||||
version = "0.17.0-alpha.4"
|
version = "0.17.0-alpha.4"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1703,7 +1703,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.2.0-alpha.3"
|
version = "0.2.0-alpha.3"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -1717,7 +1717,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client"
|
name = "ruma-client"
|
||||||
version = "0.5.0-alpha.2"
|
version = "0.5.0-alpha.2"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
|
@ -1725,6 +1725,7 @@ dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"http",
|
"http",
|
||||||
|
"reqwest",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
"ruma-events",
|
"ruma-events",
|
||||||
|
@ -1737,7 +1738,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.10.0-alpha.3"
|
version = "0.10.0-alpha.3"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -1757,7 +1758,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"js_int",
|
"js_int",
|
||||||
|
@ -1773,7 +1774,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.22.0-alpha.3"
|
version = "0.22.0-alpha.3"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -1787,7 +1788,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events-macros"
|
name = "ruma-events-macros"
|
||||||
version = "0.22.0-alpha.3"
|
version = "0.22.0-alpha.3"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1798,7 +1799,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.1.0-alpha.2"
|
version = "0.1.0-alpha.2"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
|
@ -1813,7 +1814,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers"
|
name = "ruma-identifiers"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"paste",
|
"paste",
|
||||||
"rand",
|
"rand",
|
||||||
|
@ -1827,7 +1828,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-macros"
|
name = "ruma-identifiers-macros"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1838,12 +1839,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identity-service-api"
|
name = "ruma-identity-service-api"
|
||||||
version = "0.1.0-alpha.1"
|
version = "0.1.0-alpha.1"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
|
@ -1857,7 +1858,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.1.0-alpha.1"
|
version = "0.1.0-alpha.1"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
|
@ -1872,7 +1873,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-serde"
|
name = "ruma-serde"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
|
@ -1886,7 +1887,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-serde-macros"
|
name = "ruma-serde-macros"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1897,7 +1898,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=bdb38279c34e423a80533f3f7b0c8cada238559f#bdb38279c34e423a80533f3f7b0c8cada238559f"
|
source = "git+https://github.com/ruma/ruma?rev=097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2#097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"ring",
|
"ring",
|
||||||
|
@ -2210,7 +2211,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "state-res"
|
name = "state-res"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/ruma/state-res?rev=a4d2182d2fb23f5357a6e52179e951acb0dc43cb#a4d2182d2fb23f5357a6e52179e951acb0dc43cb"
|
source = "git+https://github.com/ruma/state-res?rev=bca91bcc17df4d16942ff8b8c3be622b1795e3f0#bca91bcc17df4d16942ff8b8c3be622b1795e3f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools 0.10.0",
|
"itertools 0.10.0",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
@ -18,12 +18,12 @@ rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev = "801e04bd5
|
||||||
#rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] }
|
#rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] }
|
||||||
|
|
||||||
# Used for matrix spec type definitions and helpers
|
# Used for matrix spec type definitions and helpers
|
||||||
ruma = { git = "https://github.com/ruma/ruma", rev = "bdb38279c34e423a80533f3f7b0c8cada238559f", features = ["client", "compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
ruma = { git = "https://github.com/ruma/ruma", rev = "097f20c837fcbaef1d9c18c30d3ec5a24a6e4ec2", features = ["client-reqwest", "compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
#ruma = { git = "https://github.com/timokoesters/ruma", rev = "220d5b4a76b3b781f7f8297fbe6b14473b04214b", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
#ruma = { git = "https://github.com/timokoesters/ruma", rev = "220d5b4a76b3b781f7f8297fbe6b14473b04214b", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
#ruma = { path = "../ruma/ruma", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
#ruma = { path = "../ruma/ruma", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
|
|
||||||
# Used when doing state resolution
|
# Used when doing state resolution
|
||||||
state-res = { git = "https://github.com/ruma/state-res", rev = "a4d2182d2fb23f5357a6e52179e951acb0dc43cb", features = ["unstable-pre-spec"] }
|
state-res = { git = "https://github.com/ruma/state-res", rev = "bca91bcc17df4d16942ff8b8c3be622b1795e3f0", features = ["unstable-pre-spec"] }
|
||||||
#state-res = { path = "../state-res", features = ["unstable-pre-spec"] }
|
#state-res = { path = "../state-res", features = ["unstable-pre-spec"] }
|
||||||
|
|
||||||
# Used for long polling and federation sender, should be the same as rocket::tokio
|
# Used for long polling and federation sender, should be the same as rocket::tokio
|
||||||
|
|
|
@ -22,28 +22,33 @@ where
|
||||||
let destination = registration.get("url").unwrap().as_str().unwrap();
|
let destination = registration.get("url").unwrap().as_str().unwrap();
|
||||||
let hs_token = registration.get("hs_token").unwrap().as_str().unwrap();
|
let hs_token = registration.get("hs_token").unwrap().as_str().unwrap();
|
||||||
|
|
||||||
let mut http_request = request
|
globals
|
||||||
.try_into_http_request::<BytesMut>(&destination, SendAccessToken::IfRequired(""))
|
.reqwest_client()
|
||||||
.unwrap()
|
.send_customized_matrix_request(
|
||||||
.map(|body| body.freeze());
|
&destination,
|
||||||
|
SendAccessToken::IfRequired(""),
|
||||||
|
request,
|
||||||
|
|http_request| {
|
||||||
|
let mut parts = http_request.uri().clone().into_parts();
|
||||||
|
let old_path_and_query = parts.path_and_query.unwrap().as_str().to_owned();
|
||||||
|
let symbol = if old_path_and_query.contains('?') {
|
||||||
|
"&"
|
||||||
|
} else {
|
||||||
|
"?"
|
||||||
|
};
|
||||||
|
|
||||||
let mut parts = http_request.uri().clone().into_parts();
|
parts.path_and_query =
|
||||||
let old_path_and_query = parts.path_and_query.unwrap().as_str().to_owned();
|
Some((old_path_and_query + symbol + "access_token=" + hs_token).parse()?);
|
||||||
let symbol = if old_path_and_query.contains('?') {
|
*http_request.uri_mut() = parts.try_into()?;
|
||||||
"&"
|
|
||||||
} else {
|
|
||||||
"?"
|
|
||||||
};
|
|
||||||
|
|
||||||
parts.path_and_query = Some(
|
Ok(())
|
||||||
(old_path_and_query + symbol + "access_token=" + hs_token)
|
},
|
||||||
.parse()
|
)
|
||||||
.unwrap(),
|
.await
|
||||||
);
|
.map_err(|e| {
|
||||||
*http_request.uri_mut() = parts.try_into().expect("our manipulation is always valid");
|
warn!("Appservice error: {}", e);
|
||||||
|
Error::BadServerResponse("Server returned an error.")
|
||||||
let mut reqwest_request = reqwest::Request::try_from(http_request)
|
})?;
|
||||||
.expect("all http requests are valid reqwest requests");
|
|
||||||
|
|
||||||
*reqwest_request.timeout_mut() = Some(Duration::from_secs(30));
|
*reqwest_request.timeout_mut() = Some(Duration::from_secs(30));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue