1
Fork 0

Create webfinger crate #5

Merged
steffo merged 53 commits from feature/webfinger into main 2024-11-16 06:33:06 +00:00
4 changed files with 11 additions and 5 deletions
Showing only changes of commit 025311e100 - Show all commits

View file

@ -5,7 +5,7 @@ edition = "2021"
[dependencies] [dependencies]
anyhow = "1.0.93" anyhow = "1.0.93"
axum = "0.7.7" axum = { version = "0.7.7", features = ["macros"] }
axum-extra = { version = "0.9.4", features = ["query"] } axum-extra = { version = "0.9.4", features = ["query"] }
log = "0.4.22" log = "0.4.22"
micronfig = "0.3.0" micronfig = "0.3.0"

View file

@ -1,3 +1,3 @@
micronfig::config!( micronfig::config!(
ACRATE_INBOX_BIND_ADDRESS: String, ACRATE_WEBFINGER_BIND_ADDRESS: String,
); );

View file

@ -15,7 +15,7 @@ async fn main() -> anyhow::Result<std::convert::Infallible> {
log::trace!("Axum router created successfully!"); log::trace!("Axum router created successfully!");
log::trace!("Creating Tokio listener..."); log::trace!("Creating Tokio listener...");
let bind_address = config::ACRATE_INBOX_BIND_ADDRESS(); let bind_address = config::ACRATE_WEBFINGER_BIND_ADDRESS();
let listener = tokio::net::TcpListener::bind(bind_address) let listener = tokio::net::TcpListener::bind(bind_address)
.await .await
.context("failed to bind listener to address")?; .context("failed to bind listener to address")?;

View file

@ -1,3 +1,4 @@
use axum::http::StatusCode;
use axum_extra::extract::Query; use axum_extra::extract::Query;
use serde::Deserialize; use serde::Deserialize;
@ -9,8 +10,13 @@ pub struct WebfingerQuery {
pub rel: Vec<String>, pub rel: Vec<String>,
} }
#[axum::debug_handler]
pub async fn webfinger_handler( pub async fn webfinger_handler(
Query(WebfingerQuery {resource, rel}): Query<WebfingerQuery> Query(WebfingerQuery {resource, rel}): Query<WebfingerQuery>
) { ) -> StatusCode {
todo!() log::info!("Handling a WebFinger request!");
log::debug!("Resource is: {resource:#?}");
log::debug!("Rel is: {rel:#?}");
StatusCode::NO_CONTENT
} }