chore: Migrate to axum 0.8
Co-authored-by: dasha_uwu Co-authored-by: Jason Volk <jason@zemos.net> Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
48
Cargo.lock
generated
48
Cargo.lock
generated
@@ -261,13 +261,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum"
|
name = "axum"
|
||||||
version = "0.7.9"
|
version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
|
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
|
||||||
"axum-core",
|
"axum-core",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"form_urlencoded",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
@@ -295,9 +295,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum-client-ip"
|
name = "axum-client-ip"
|
||||||
version = "0.6.1"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9eefda7e2b27e1bda4d6fa8a06b50803b8793769045918bc37ad062d48a6efac"
|
checksum = "dff8ee1869817523c8f91c20bf17fd932707f66c2e7e0b0f811b29a227289562"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"forwarded-header-value",
|
"forwarded-header-value",
|
||||||
@@ -306,13 +306,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum-core"
|
name = "axum-core"
|
||||||
version = "0.4.5"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
|
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-core",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
@@ -327,9 +326,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum-extra"
|
name = "axum-extra"
|
||||||
version = "0.9.6"
|
version = "0.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04"
|
checksum = "45bf463831f5131b7d3c756525b305d40f1185b688565648a92e1392ca35713d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-core",
|
"axum-core",
|
||||||
@@ -341,6 +340,7 @@ dependencies = [
|
|||||||
"http-body-util",
|
"http-body-util",
|
||||||
"mime",
|
"mime",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"rustversion",
|
||||||
"serde",
|
"serde",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
@@ -2409,9 +2409,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchit"
|
name = "matchit"
|
||||||
version = "0.7.3"
|
version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "maybe-rayon"
|
name = "maybe-rayon"
|
||||||
@@ -3438,7 +3438,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -3458,7 +3458,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -3470,7 +3470,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"assign",
|
"assign",
|
||||||
@@ -3493,7 +3493,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"base64",
|
"base64",
|
||||||
@@ -3525,7 +3525,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.28.1"
|
version = "0.28.1"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
@@ -3550,7 +3550,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"headers",
|
"headers",
|
||||||
@@ -3572,7 +3572,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
@@ -3581,7 +3581,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identity-service-api"
|
name = "ruma-identity-service-api"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -3591,7 +3591,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-macros"
|
name = "ruma-macros"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
@@ -3606,7 +3606,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -3618,7 +3618,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.15.0"
|
version = "0.15.0"
|
||||||
source = "git+https://github.com/matrix-construct/ruma?rev=920148dca1076454ca0ca5d43b5ce1aa708381d4#920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
source = "git+https://github.com/matrix-construct/ruma?rev=a91c1b70fa3cc57fc87a6ce92d2c42a19124a666#a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ version = "2.3.1"
|
|||||||
version = "0.1.88"
|
version = "0.1.88"
|
||||||
|
|
||||||
[workspace.dependencies.axum]
|
[workspace.dependencies.axum]
|
||||||
version = "0.7.9"
|
version = "0.8.3"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"form",
|
"form",
|
||||||
@@ -70,10 +70,10 @@ features = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies.axum-client-ip]
|
[workspace.dependencies.axum-client-ip]
|
||||||
version = "0.6.1"
|
version = "0.7"
|
||||||
|
|
||||||
[workspace.dependencies.axum-extra]
|
[workspace.dependencies.axum-extra]
|
||||||
version = "0.9.6"
|
version = "0.10.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"typed-header",
|
"typed-header",
|
||||||
@@ -86,6 +86,7 @@ default-features = false
|
|||||||
|
|
||||||
[workspace.dependencies.axum-server-dual-protocol]
|
[workspace.dependencies.axum-server-dual-protocol]
|
||||||
version = "0.7"
|
version = "0.7"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
[workspace.dependencies.base64]
|
[workspace.dependencies.base64]
|
||||||
version = "0.22.1"
|
version = "0.22.1"
|
||||||
@@ -304,7 +305,7 @@ default-features = false
|
|||||||
|
|
||||||
[workspace.dependencies.ruma]
|
[workspace.dependencies.ruma]
|
||||||
git = "https://github.com/matrix-construct/ruma"
|
git = "https://github.com/matrix-construct/ruma"
|
||||||
rev = "920148dca1076454ca0ca5d43b5ce1aa708381d4"
|
rev = "a91c1b70fa3cc57fc87a6ce92d2c42a19124a666"
|
||||||
features = [
|
features = [
|
||||||
"compat",
|
"compat",
|
||||||
"rand",
|
"rand",
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ pub(crate) async fn get_mutual_rooms_route(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `DELETE /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz`
|
/// # `DELETE /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/us.cloke.msc4175.tz`
|
||||||
///
|
///
|
||||||
/// Deletes the `tz` (timezone) of a user, as per MSC4133 and MSC4175.
|
/// Deletes the `tz` (timezone) of a user, as per MSC4133 and MSC4175.
|
||||||
///
|
///
|
||||||
@@ -88,7 +88,7 @@ pub(crate) async fn delete_timezone_key_route(
|
|||||||
Ok(delete_timezone_key::unstable::Response {})
|
Ok(delete_timezone_key::unstable::Response {})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz`
|
/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/us.cloke.msc4175.tz`
|
||||||
///
|
///
|
||||||
/// Updates the `tz` (timezone) of a user, as per MSC4133 and MSC4175.
|
/// Updates the `tz` (timezone) of a user, as per MSC4133 and MSC4175.
|
||||||
///
|
///
|
||||||
@@ -270,7 +270,7 @@ pub(crate) async fn delete_profile_key_route(
|
|||||||
Ok(delete_profile_key::unstable::Response {})
|
Ok(delete_profile_key::unstable::Response {})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz`
|
/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/us.cloke.msc4175.tz`
|
||||||
///
|
///
|
||||||
/// Returns the `timezone` of the user as per MSC4133 and MSC4175.
|
/// Returns the `timezone` of the user as per MSC4133 and MSC4175.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -124,23 +124,23 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
|||||||
// Ruma doesn't have support for multiple paths for a single endpoint yet, and these routes
|
// Ruma doesn't have support for multiple paths for a single endpoint yet, and these routes
|
||||||
// share one Ruma request / response type pair with {get,send}_state_event_for_key_route
|
// share one Ruma request / response type pair with {get,send}_state_event_for_key_route
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type",
|
"/_matrix/client/r0/rooms/{room_id}/state/{event_type}",
|
||||||
get(client::get_state_events_for_empty_key_route)
|
get(client::get_state_events_for_empty_key_route)
|
||||||
.put(client::send_state_event_for_empty_key_route),
|
.put(client::send_state_event_for_empty_key_route),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/client/v3/rooms/:room_id/state/:event_type",
|
"/_matrix/client/v3/rooms/{room_id}/state/{event_type}",
|
||||||
get(client::get_state_events_for_empty_key_route)
|
get(client::get_state_events_for_empty_key_route)
|
||||||
.put(client::send_state_event_for_empty_key_route),
|
.put(client::send_state_event_for_empty_key_route),
|
||||||
)
|
)
|
||||||
// These two endpoints allow trailing slashes
|
// These two endpoints allow trailing slashes
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type/",
|
"/_matrix/client/r0/rooms/{room_id}/state/{event_type}/",
|
||||||
get(client::get_state_events_for_empty_key_route)
|
get(client::get_state_events_for_empty_key_route)
|
||||||
.put(client::send_state_event_for_empty_key_route),
|
.put(client::send_state_event_for_empty_key_route),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/client/v3/rooms/:room_id/state/:event_type/",
|
"/_matrix/client/v3/rooms/{room_id}/state/{event_type}/",
|
||||||
get(client::get_state_events_for_empty_key_route)
|
get(client::get_state_events_for_empty_key_route)
|
||||||
.put(client::send_state_event_for_empty_key_route),
|
.put(client::send_state_event_for_empty_key_route),
|
||||||
)
|
)
|
||||||
@@ -179,7 +179,7 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
|||||||
.ruma_route(&client::get_mutual_rooms_route)
|
.ruma_route(&client::get_mutual_rooms_route)
|
||||||
.ruma_route(&client::get_room_summary)
|
.ruma_route(&client::get_room_summary)
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/client/unstable/im.nheko.summary/rooms/:room_id_or_alias/summary",
|
"/_matrix/client/unstable/im.nheko.summary/rooms/{room_id_or_alias}/summary",
|
||||||
get(client::get_room_summary_legacy)
|
get(client::get_room_summary_legacy)
|
||||||
)
|
)
|
||||||
.ruma_route(&client::well_known_support)
|
.ruma_route(&client::well_known_support)
|
||||||
@@ -193,7 +193,7 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
|||||||
.ruma_route(&server::get_server_version_route)
|
.ruma_route(&server::get_server_version_route)
|
||||||
.route("/_matrix/key/v2/server", get(server::get_server_keys_route))
|
.route("/_matrix/key/v2/server", get(server::get_server_keys_route))
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/key/v2/server/:key_id",
|
"/_matrix/key/v2/server/{key_id}",
|
||||||
get(server::get_server_keys_deprecated_route),
|
get(server::get_server_keys_deprecated_route),
|
||||||
)
|
)
|
||||||
.ruma_route(&server::get_public_rooms_route)
|
.ruma_route(&server::get_public_rooms_route)
|
||||||
@@ -227,9 +227,9 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
|||||||
.route("/_tuwunel/local_user_count", get(client::tuwunel_local_user_count));
|
.route("/_tuwunel/local_user_count", get(client::tuwunel_local_user_count));
|
||||||
} else {
|
} else {
|
||||||
router = router
|
router = router
|
||||||
.route("/_matrix/federation/*path", any(federation_disabled))
|
.route("/_matrix/federation/{*path}", any(federation_disabled))
|
||||||
.route("/.well-known/matrix/server", any(federation_disabled))
|
.route("/.well-known/matrix/server", any(federation_disabled))
|
||||||
.route("/_matrix/key/*path", any(federation_disabled))
|
.route("/_matrix/key/{*path}", any(federation_disabled))
|
||||||
.route("/_tuwunel/local_user_count", any(federation_disabled));
|
.route("/_tuwunel/local_user_count", any(federation_disabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,27 +247,27 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
|||||||
get(client::get_media_preview_legacy_legacy_route),
|
get(client::get_media_preview_legacy_legacy_route),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/media/v1/download/:server_name/:media_id",
|
"/_matrix/media/v1/download/{server_name}/{media_id}",
|
||||||
get(client::get_content_legacy_legacy_route),
|
get(client::get_content_legacy_legacy_route),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/media/v1/download/:server_name/:media_id/:file_name",
|
"/_matrix/media/v1/download/{server_name}/{media_id}/{file_name}",
|
||||||
get(client::get_content_as_filename_legacy_legacy_route),
|
get(client::get_content_as_filename_legacy_legacy_route),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
"/_matrix/media/v1/thumbnail/:server_name/:media_id",
|
"/_matrix/media/v1/thumbnail/{server_name}/{media_id}",
|
||||||
get(client::get_content_thumbnail_legacy_legacy_route),
|
get(client::get_content_thumbnail_legacy_legacy_route),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
router = router
|
router = router
|
||||||
.route("/_matrix/media/v1/*path", any(legacy_media_disabled))
|
.route("/_matrix/media/v1/{*path}", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/v3/config", any(legacy_media_disabled))
|
.route("/_matrix/media/v3/config", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/v3/download/*path", any(legacy_media_disabled))
|
.route("/_matrix/media/v3/download/{*path}", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/v3/thumbnail/*path", any(legacy_media_disabled))
|
.route("/_matrix/media/v3/thumbnail/{*path}", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/v3/preview_url", any(redirect_legacy_preview))
|
.route("/_matrix/media/v3/preview_url", any(redirect_legacy_preview))
|
||||||
.route("/_matrix/media/r0/config", any(legacy_media_disabled))
|
.route("/_matrix/media/r0/config", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/r0/download/*path", any(legacy_media_disabled))
|
.route("/_matrix/media/r0/download/{*path}", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/r0/thumbnail/*path", any(legacy_media_disabled))
|
.route("/_matrix/media/r0/thumbnail/{*path}", any(legacy_media_disabled))
|
||||||
.route("/_matrix/media/r0/preview_url", any(redirect_legacy_preview));
|
.route("/_matrix/media/r0/preview_url", any(redirect_legacy_preview));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use std::{mem, ops::Deref};
|
use std::{mem, ops::Deref};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
|
||||||
use axum::{body::Body, extract::FromRequest};
|
use axum::{body::Body, extract::FromRequest};
|
||||||
use bytes::{BufMut, Bytes, BytesMut};
|
use bytes::{BufMut, Bytes, BytesMut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
@@ -79,7 +78,6 @@ where
|
|||||||
fn deref(&self) -> &Self::Target { &self.body }
|
fn deref(&self) -> &Self::Target { &self.body }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl<T> FromRequest<State, Body> for Args<T>
|
impl<T> FromRequest<State, Body> for Args<T>
|
||||||
where
|
where
|
||||||
T: IncomingRequest + Send + Sync + 'static,
|
T: IncomingRequest + Send + Sync + 'static,
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ pub(super) async fn auth(
|
|||||||
json_body: Option<&CanonicalJsonValue>,
|
json_body: Option<&CanonicalJsonValue>,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
) -> Result<Auth> {
|
) -> Result<Auth> {
|
||||||
let bearer: Option<TypedHeader<Authorization<Bearer>>> = request.parts.extract().await?;
|
let bearer: Option<TypedHeader<Authorization<Bearer>>> =
|
||||||
|
request.parts.extract().await.unwrap_or(None);
|
||||||
let token = match &bearer {
|
let token = match &bearer {
|
||||||
| Some(TypedHeader(Authorization(bearer))) => Some(bearer.token()),
|
| Some(TypedHeader(Authorization(bearer))) => Some(bearer.token()),
|
||||||
| None => request.query.access_token.as_deref(),
|
| None => request.query.access_token.as_deref(),
|
||||||
|
|||||||
Reference in New Issue
Block a user