Compare commits
No commits in common. "8552052a46d58cc9f8bf86a6c16fd98ccddba6da" and "cef5e8c19b2444570f88addf61ac9f9a97482422" have entirely different histories.
8552052a46
...
cef5e8c19b
6 changed files with 9 additions and 53 deletions
|
@ -9,7 +9,6 @@ quick-xml = { version = "0.37.0", features = ["overlapped-lists", "serialize"] }
|
|||
reqwest = { version = "0.12.9", features = ["json", "stream"] }
|
||||
serde = { version = "1.0.214", features = ["derive"] }
|
||||
serde_json = "1.0.132"
|
||||
thiserror = "2.0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_env_logger = "0.5.0"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use serde::Deserialize;
|
||||
use thiserror::Error;
|
||||
|
||||
/// A resource descriptor object.
|
||||
///
|
||||
|
@ -478,22 +477,19 @@ impl ResourceDescriptor {
|
|||
}
|
||||
|
||||
/// Error occurred during [`ResourceDescriptor::discover`].
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum ResourceDescriptorDiscoveryError {
|
||||
/// Manipulation of the provided base [`reqwest::Url`] failed.
|
||||
///
|
||||
/// See [reqwest::Url::set_scheme] for possible causes.
|
||||
#[error("manipulation of the provided URL failed")]
|
||||
UrlManipulation(()),
|
||||
|
||||
/// All attempts of fetching a resource descriptor document failed.
|
||||
#[error("fetchign the resource descriptor document failed")]
|
||||
Fetch(ResourceDescriptorDiscoveryFailures),
|
||||
}
|
||||
|
||||
/// Request errors occurred during [`ResourceDescriptor::discover`].
|
||||
#[derive(Debug, Error)]
|
||||
#[error("all attempts of fetching the resource descriptor document failed")]
|
||||
#[derive(Debug)]
|
||||
pub struct ResourceDescriptorDiscoveryFailures {
|
||||
/// HTTPS XRD retrieval.
|
||||
pub https_xrd: GetXRDError,
|
||||
|
@ -515,46 +511,30 @@ pub struct ResourceDescriptorDiscoveryFailures {
|
|||
}
|
||||
|
||||
/// Error occurred during [`ResourceDescriptor::get_xrd`].
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum GetXRDError {
|
||||
/// The HTTP request failed.
|
||||
#[error("the HTTP request failed")]
|
||||
Request(reqwest::Error),
|
||||
|
||||
/// The `Content-Type` header of the response is missing.
|
||||
#[error("the Content-Type header of the response is missing")]
|
||||
ContentTypeMissing,
|
||||
|
||||
/// The `Content-Type` header of the response is invalid.
|
||||
#[error("the Content-Type header of the response is invalid")]
|
||||
ContentTypeInvalid,
|
||||
|
||||
/// The document failed to be decoded as text.
|
||||
#[error("the document failed to be decoded as text")]
|
||||
/// The document failed to be read as text.
|
||||
Decode(reqwest::Error),
|
||||
|
||||
/// The document failed to be parsed as XML by [`quick_xml`].
|
||||
#[error("the document failed to be parsed as XML")]
|
||||
Parse(quick_xml::DeError),
|
||||
}
|
||||
|
||||
/// Error occurred during [`ResourceDescriptor::get_jrd`].
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum GetJRDError {
|
||||
/// The HTTP request failed.
|
||||
#[error("the HTTP request failed")]
|
||||
Request(reqwest::Error),
|
||||
|
||||
/// The `Content-Type` header of the response is missing.
|
||||
#[error("the Content-Type header of the response is missing")]
|
||||
ContentTypeMissing,
|
||||
|
||||
/// The `Content-Type` header of the response is invalid.
|
||||
#[error("the Content-Type header of the response is invalid")]
|
||||
ContentTypeInvalid,
|
||||
|
||||
/// The document failed to be parsed as JSON by [`reqwest`].
|
||||
#[error("the document failed to be parsed as JSON")]
|
||||
Parse(reqwest::Error),
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use anyhow::Context;
|
||||
|
||||
mod config;
|
||||
mod route;
|
||||
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -10,8 +9,7 @@ async fn main() -> anyhow::Result<std::convert::Infallible> {
|
|||
log::debug!("Logging initialized!");
|
||||
|
||||
log::trace!("Creating Axum router...");
|
||||
let app = axum::Router::new()
|
||||
.route("/inbox", axum::routing::post(route::inbox_handler));
|
||||
let app = axum::Router::new();
|
||||
log::trace!("Axum router created successfully!");
|
||||
|
||||
log::trace!("Creating Tokio listener...");
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#[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");
|
||||
}
|
|
@ -9,7 +9,6 @@ log = "0.4.22"
|
|||
reqwest = { version = "0.12.9", features = ["json", "stream"] }
|
||||
serde = { version = "1.0.214", features = ["derive"] }
|
||||
serde_json = "1.0.132"
|
||||
thiserror = "2.0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_env_logger = "0.5.0"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
//! - <https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md>
|
||||
|
||||
use serde::Deserialize;
|
||||
use thiserror::Error;
|
||||
|
||||
/// A variant of a NodeInfo document.
|
||||
///
|
||||
|
@ -310,13 +309,11 @@ impl NodeInfo {
|
|||
}
|
||||
|
||||
/// An error occurred during [`NodeInfo::get_latest_wellknown`].
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum NodeInfoGetWellknownError {
|
||||
/// The discovery of possible locations for NodeInfo documents failed.
|
||||
#[error("the discovery of possible locations for NodeInfo documents failed")]
|
||||
Discovery(acrate_hostmeta::ResourceDescriptorDiscoveryError),
|
||||
/// No compatible NodeInfo documents were detected at the given URL.
|
||||
#[error("no compatible NodeInfo documents were detected at the given URL")]
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
|
@ -449,26 +446,17 @@ impl NodeInfo2 {
|
|||
}
|
||||
|
||||
/// An error encountered during [`NodeInfo1::get`] or [`NodeInfo2::get`].
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum NodeInfoGetError {
|
||||
/// The HTTP request failed.
|
||||
#[error("the HTTP request failed")]
|
||||
Request(reqwest::Error),
|
||||
|
||||
/// The `Content-Type` header of the response is missing.
|
||||
#[error("the Content-Type header of the response is missing")]
|
||||
ContentTypeMissing,
|
||||
|
||||
/// The `Content-Type` header of the response is invalid.
|
||||
#[error("the Content-Type header of the response is invalid")]
|
||||
ContentTypeInvalid,
|
||||
|
||||
/// The document failed to be parsed as JSON by [`reqwest`].
|
||||
#[error("the document failed to be parsed as JSON")]
|
||||
Parse(reqwest::Error),
|
||||
|
||||
/// The returned NodeInfo version would not match the version of the called method.
|
||||
#[error("the returned NodeInfo version would not match the version of the called method")]
|
||||
/// The returned version does not match the version of the created struct.
|
||||
Version,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue