Create webfinger
crate #5
4 changed files with 11 additions and 5 deletions
|
@ -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"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
micronfig::config!(
|
micronfig::config!(
|
||||||
ACRATE_INBOX_BIND_ADDRESS: String,
|
ACRATE_WEBFINGER_BIND_ADDRESS: String,
|
||||||
);
|
);
|
||||||
|
|
|
@ -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")?;
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue