webfinger
: Parse query string with serde
and axum_extra
This commit is contained in:
parent
646696a49e
commit
8145ce57cc
4 changed files with 19 additions and 8 deletions
|
@ -9,6 +9,7 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/acrate-inbox/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/acrate-nodeinfo/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/acrate-nodeinfo/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/acrate-webfinger/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
|
|
@ -6,7 +6,9 @@ edition = "2021"
|
|||
[dependencies]
|
||||
anyhow = "1.0.93"
|
||||
axum = "0.7.7"
|
||||
axum-extra = { version = "0.9.4", features = ["query"] }
|
||||
log = "0.4.22"
|
||||
micronfig = "0.3.0"
|
||||
pretty_env_logger = "0.5.0"
|
||||
serde = { version = "1.0.215", features = ["derive"] }
|
||||
tokio = { version = "1.41.1", features = ["macros", "net", "rt-multi-thread"] }
|
||||
|
|
|
@ -11,7 +11,7 @@ async fn main() -> anyhow::Result<std::convert::Infallible> {
|
|||
|
||||
log::trace!("Creating Axum router...");
|
||||
let app = axum::Router::new()
|
||||
.route("/inbox", axum::routing::post(route::inbox_handler));
|
||||
.route("/.well-known/webfinger", axum::routing::get(route::webfinger_handler));
|
||||
log::trace!("Axum router created successfully!");
|
||||
|
||||
log::trace!("Creating Tokio listener...");
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
#[allow(unreachable_code)]
|
||||
pub async fn inbox_handler() {
|
||||
todo!("pre-validation hook");
|
||||
todo!("validate signature");
|
||||
todo!("post-validation hook");
|
||||
todo!("database storage");
|
||||
todo!("post-storage hook");
|
||||
use axum_extra::extract::Query;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct WebfingerQuery {
|
||||
pub resource: String,
|
||||
|
||||
#[serde(default)]
|
||||
pub rel: Vec<String>,
|
||||
}
|
||||
|
||||
pub async fn webfinger_handler(
|
||||
Query(WebfingerQuery {resource, rel}): Query<WebfingerQuery>
|
||||
) {
|
||||
todo!()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue