Compare commits

..

2 commits

Author SHA1 Message Date
b562b8cf92
feat: add alpine ci
Some checks failed
/ build (push) Failing after 32m37s
2025-05-07 17:51:16 +02:00
80e8900f04
add initial alpine packaging
notes:
- to build the package, you must use the cargo version from the edge branch
  (by building on edge or by installing it manually)
- building from git requires some work (abuild supports snapshots for getting
  the release from git, but the version number would remain unchanged)
- the apkbuild doesn't include any packaging tests (as i don't know what to include)
2025-05-04 13:22:48 +02:00
12 changed files with 195 additions and 101 deletions

View file

@ -0,0 +1,49 @@
on:
- workflow-dispatch
- push
jobs:
build:
runs-on: ubuntu-latest
container:
image: alpine:edge
steps:
- name: set up dependencies
run: |
apk update
apk upgrade
apk add nodejs git alpine-sdk
- uses: actions/checkout@v4
name: checkout the alpine dir
with:
sparse-checkout: "alpine/"
# - uses: actions/checkout@v4
# name: checkout the rest in the alpine dir
# with:
# path: 'alpine/continuwuity'
- name: set up user
run: adduser -DG abuild ci
- name: set up keys
run: |
pwd
mkdir ~/.abuild
echo "${{ secrets.abuild_privkey }}" > ~/.abuild/ci@continuwuity.rsa
echo "${{ secrets.abuild_pubkey }}" > ~/.abuild/ci@continuwuity.rsa.pub
echo $HOME
echo 'PACKAGER_PRIVKEY="/root/.abuild/ci@continuwuity.rsa"' > ~/.abuild/abuild.conf
ls ~/.abuild
- name: go go gadget abuild
run: |
cd alpine
# modify the APKBUILD to use the current branch instead of the release
# note that it seems to require the repo to be public (as you'll get
# a 404 even if the token is provided)
export ARCHIVE_URL="${{ github.server_url }}/${{ github.repository }}/archive/${{ github.ref_name }}.tar.gz"
echo $ARCHIVE_URL
sed -i '/^source=/c\source="'"$ARCHIVE_URL" APKBUILD
abuild -F checksum
abuild -Fr

101
Cargo.lock generated
View file

@ -260,43 +260,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
dependencies = [
"async-trait",
"axum-core 0.4.5",
"axum-core",
"bytes",
"futures-util",
"http",
"http-body",
"http-body-util",
"itoa",
"matchit 0.7.3",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper",
"tower 0.5.2",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de45108900e1f9b9242f7f2e254aa3e2c029c921c258fe9e6b4217eeebd54288"
dependencies = [
"axum-core 0.5.2",
"bytes",
"form_urlencoded",
"futures-util",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-util",
"itoa",
"matchit 0.8.4",
"matchit",
"memchr",
"mime",
"percent-encoding",
@ -316,11 +289,11 @@ dependencies = [
[[package]]
name = "axum-client-ip"
version = "0.7.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff8ee1869817523c8f91c20bf17fd932707f66c2e7e0b0f811b29a227289562"
checksum = "9eefda7e2b27e1bda4d6fa8a06b50803b8793769045918bc37ad062d48a6efac"
dependencies = [
"axum 0.8.3",
"axum",
"forwarded-header-value",
"serde",
]
@ -343,36 +316,17 @@ dependencies = [
"sync_wrapper",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
dependencies = [
"bytes",
"futures-core",
"http",
"http-body",
"http-body-util",
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "axum-extra"
version = "0.10.1"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45bf463831f5131b7d3c756525b305d40f1185b688565648a92e1392ca35713d"
checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04"
dependencies = [
"axum 0.8.3",
"axum-core 0.5.2",
"axum",
"axum-core",
"bytes",
"futures-util",
"headers",
@ -381,7 +335,6 @@ dependencies = [
"http-body-util",
"mime",
"pin-project-lite",
"rustversion",
"serde",
"tower 0.5.2",
"tower-layer",
@ -825,7 +778,7 @@ name = "conduwuit_api"
version = "0.5.0-rc.5"
dependencies = [
"async-trait",
"axum 0.8.3",
"axum",
"axum-client-ip",
"axum-extra",
"base64 0.22.1",
@ -858,7 +811,7 @@ version = "0.5.0-rc.5"
dependencies = [
"argon2",
"arrayvec",
"axum 0.8.3",
"axum",
"axum-extra",
"bytes",
"bytesize",
@ -942,7 +895,7 @@ dependencies = [
name = "conduwuit_router"
version = "0.5.0-rc.5"
dependencies = [
"axum 0.8.3",
"axum",
"axum-client-ip",
"axum-server",
"axum-server-dual-protocol",
@ -2659,12 +2612,6 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]]
name = "matchit"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
[[package]]
name = "maybe-rayon"
version = "0.1.1"
@ -3705,7 +3652,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.10.1"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"assign",
"js_int",
@ -3725,7 +3672,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.10.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"js_int",
"ruma-common",
@ -3737,7 +3684,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.18.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"as_variant",
"assign",
@ -3760,7 +3707,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.13.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"as_variant",
"base64 0.22.1",
@ -3792,7 +3739,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.28.1"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"as_variant",
"indexmap 2.8.0",
@ -3817,7 +3764,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.9.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"bytes",
"headers",
@ -3839,7 +3786,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.9.5"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"js_int",
"thiserror 2.0.12",
@ -3848,7 +3795,7 @@ dependencies = [
[[package]]
name = "ruma-identity-service-api"
version = "0.9.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"js_int",
"ruma-common",
@ -3858,7 +3805,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.13.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"cfg-if",
"proc-macro-crate",
@ -3873,7 +3820,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.9.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"js_int",
"ruma-common",
@ -3885,7 +3832,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.15.0"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e"
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
@ -4937,7 +4884,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52"
dependencies = [
"async-stream",
"async-trait",
"axum 0.7.9",
"axum",
"base64 0.22.1",
"bytes",
"h2",

View file

@ -93,7 +93,7 @@ version = "1.3.1"
version = "1.11.1"
[workspace.dependencies.axum]
version = "0.8.3"
version = "0.7.9"
default-features = false
features = [
"form",
@ -106,7 +106,7 @@ features = [
]
[workspace.dependencies.axum-extra]
version = "0.10.1"
version = "0.9.6"
default-features = false
features = ["typed-header", "tracing"]
@ -119,7 +119,7 @@ default-features = false
version = "0.7"
[workspace.dependencies.axum-client-ip]
version = "0.7"
version = "0.6.1"
[workspace.dependencies.tower]
version = "0.5.2"
@ -350,7 +350,7 @@ version = "0.1.2"
[workspace.dependencies.ruma]
git = "https://forgejo.ellis.link/continuwuation/ruwuma"
#branch = "conduwuit-changes"
rev = "62b675cc020624d11309797d6f02d75b9a1c448e"
rev = "d6870a7fb7f6cccff63f7fd0ff6c581bad80e983"
features = [
"compat",
"rand",

63
alpine/APKBUILD Normal file
View file

@ -0,0 +1,63 @@
# Contributor: magmaus3 <maia@magmaus3.eu.org>
# Maintainer: magmaus3 <maia@magmaus3.eu.org>
pkgname=continuwuity
# abuild doesn't like the format of v0.5.0-rc.5, so i had to change it
# see https://wiki.alpinelinux.org/wiki/Package_policies
pkgver=0.5.0_rc5
pkgrel=0
pkgdesc="a continuwuation of a very cool, featureful fork of conduit"
url="https://continuwuity.org/"
arch="all"
license="Apache-2.0"
depends="liburing"
# cargo version on alpine v3.21 is too old to use the 2024 edition
# i recommend either building everything on edge, or adding
# the edge repo as a tag
makedepends="cargo liburing-dev clang-dev linux-headers"
checkdepends=""
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="https://forgejo.ellis.link/continuwuation/continuwuity/archive/v0.5.0-rc.5.tar.gz
continuwuity.initd
continuwuity.confd
"
builddir="$srcdir/continuwuity"
options="net !check"
prepare() {
default_prepare
cd $srcdir/continuwuity
# add the default database path to the config (commented out)
cat conduwuit-example.toml \
| sed '/#database_path/ s:$: "/var/lib/continuwuity":' \
> "$srcdir"/continuwuity.toml
cargo fetch --target="$CTARGET" --locked
}
build() {
cargo build --frozen --release --all-features
}
check() {
# TODO: make sure the tests work
#cargo test --frozen
return
}
package() {
cd $srcdir
install -Dm755 continuwuity/target/release/conduwuit "$pkgdir"/usr/bin/continuwuity
install -Dm644 "$srcdir"/continuwuity.toml -t "$pkgdir"/etc/continuwuity
install -Dm755 "$srcdir"/continuwuity.initd "$pkgdir"/etc/init.d/continuwuity
install -Dm644 "$srcdir"/continuwuity.confd "$pkgdir"/etc/conf.d/continuwuity
}
sha512sums="
66f6da5e98b6f7bb8c1082500101d5c87b1b79955c139b44c6ef5123919fb05feb0dffc669a3af1bc8d571ddb9f3576660f08dc10a6b19eab6db9e391175436a v0.5.0-rc.5.tar.gz
0482674be24740496d70da256d4121c5a5e3b749f2445d2bbe0e8991f1449de052724f8427da21a6f55574bc53eac9ca1e47e5012b4c13049b2b39044734d80d continuwuity.initd
38e2576278b450d16ba804dd8f4a128f18cd793e6c3ce55aedee1e186905755b31ee23baaa6586b1ab0e25a1f29bf1ea86bfaae4185b0cb1a29203726a199426 continuwuity.confd
"

7
alpine/README.md Normal file
View file

@ -0,0 +1,7 @@
# building
1. [set up your build
environment](https://wiki.alpinelinux.org/wiki/Include:Setup_your_system_and_account_for_building_packages)
2. run `abuild` (or `abuild -K` if you want to keep the source directory to make
rebuilding faster)

View file

@ -0,0 +1,3 @@
supervisor=supervise-daemon
export CONTINUWUITY_CONFIG=/etc/continuwuity/continuwuity.toml

19
alpine/continuwuity.initd Normal file
View file

@ -0,0 +1,19 @@
#!/sbin/openrc-run
command="/usr/bin/continuwuity"
command_user="continuwuity:continuwuity"
command_args="--config ${CONTINUWUITY_CONFIG=/etc/continuwuity/continuwuity.toml}"
command_background=true
pidfile="/run/$RC_SVCNAME.pid"
output_log="/var/log/continuwuity.log"
error_log="/var/log/continuwuity.log"
depend() {
need net
}
start_pre() {
checkpath -d -m 0755 -o "$command_user" /var/lib/continuwuity
checkpath -f -m 0644 -o "$command_user" "$output_log"
}

View file

@ -0,0 +1,4 @@
#!/bin/sh
addgroup -S continuwuity 2>/dev/null
adduser -S -D -H -h /var/lib/continuwuity -s /sbin/nologin -G continuwuity -g continuwuity continuwuity 2>/dev/null
exit 0

View file

@ -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.
///
@ -88,7 +88,7 @@ pub(crate) async fn delete_timezone_key_route(
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.
///
@ -268,7 +268,7 @@ pub(crate) async fn delete_profile_key_route(
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.
///

View file

@ -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
// share one Ruma request / response type pair with {get,send}_state_event_for_key_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)
.put(client::send_state_event_for_empty_key_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)
.put(client::send_state_event_for_empty_key_route),
)
// These two endpoints allow trailing slashes
.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)
.put(client::send_state_event_for_empty_key_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)
.put(client::send_state_event_for_empty_key_route),
)
@ -180,7 +180,7 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
.ruma_route(&client::get_mutual_rooms_route)
.ruma_route(&client::get_room_summary)
.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)
)
.ruma_route(&client::well_known_support)
@ -194,7 +194,7 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
.ruma_route(&server::get_server_version_route)
.route("/_matrix/key/v2/server", get(server::get_server_keys_route))
.route(
"/_matrix/key/v2/server/{key_id}",
"/_matrix/key/v2/server/:key_id",
get(server::get_server_keys_deprecated_route),
)
.ruma_route(&server::get_public_rooms_route)
@ -228,9 +228,9 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
.route("/_conduwuit/local_user_count", get(client::conduwuit_local_user_count));
} else {
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("/_matrix/key/{*path}", any(federation_disabled))
.route("/_matrix/key/*path", any(federation_disabled))
.route("/_conduwuit/local_user_count", any(federation_disabled));
}
@ -248,27 +248,27 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
get(client::get_media_preview_legacy_legacy_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),
)
.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),
)
.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),
);
} else {
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/download/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/thumbnail/{*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/preview_url", any(redirect_legacy_preview))
.route("/_matrix/media/r0/config", 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/download/*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));
}

View file

@ -1,5 +1,6 @@
use std::{mem, ops::Deref};
use async_trait::async_trait;
use axum::{body::Body, extract::FromRequest};
use bytes::{BufMut, Bytes, BytesMut};
use conduwuit::{Error, Result, debug, debug_warn, err, trace, utils::string::EMPTY};
@ -78,6 +79,7 @@ where
fn deref(&self) -> &Self::Target { &self.body }
}
#[async_trait]
impl<T> FromRequest<State, Body> for Args<T>
where
T: IncomingRequest + Send + Sync + 'static,

View file

@ -48,7 +48,7 @@ pub(super) async fn auth(
json_body: Option<&CanonicalJsonValue>,
metadata: &Metadata,
) -> Result<Auth> {
let bearer: Option<TypedHeader<Authorization<Bearer>>> = request.parts.extract().await.unwrap_or(None);
let bearer: Option<TypedHeader<Authorization<Bearer>>> = request.parts.extract().await?;
let token = match &bearer {
| Some(TypedHeader(Authorization(bearer))) => Some(bearer.token()),
| None => request.query.access_token.as_deref(),